Changeset 363:03aeb63408f1 in SMSSender


Ignore:
Timestamp:
Apr 1, 2014 7:01:41 PM (5 years ago)
Author:
Sämy Zehnder <saemy.zehnder@…>
Branch:
separation-frontend-backend
Message:
  • Improves phone number parsing (numbers of the form "079 123 45 67" are now recognized).
  • Fixes bug in number detection where phone numbers not starting with a '+' were not recognized at all.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/domain/snumber.cpp

    r321 r363  
    8787            SNumber n("+41 " + numberStr, SNumber::GuessFormat);
    8888            if (n.isValid()) {
    89                 return setNumber(n.toString(SNumber::IsoFormat), SNumber::IsoFormat);
     89                return setNumber(n.toString(SNumber::IsoFormatLong), SNumber::IsoFormatLong);
    9090            }
    9191        }
     
    220220}
    221221void SNumber::setUserNumber(const QString& userNumberStr){
    222     if (userNumberStr.toInt() <= 0)
     222    QString no = userNumberStr;
     223    no.remove(QRegExp("[^0-9]"));
     224    if (no.toInt() <= 0)
    223225        return;
    224226
    225     SET_IF_DIFFERENT(d->userNumber, userNumberStr);
     227    SET_IF_DIFFERENT(d->userNumber, no);
    226228}
    227229
Note: See TracChangeset for help on using the changeset viewer.