X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FCallTelephonyManager.cpp;h=f1dacba3668946ed054a85d468a34eb5bbbba3dd;hb=5d64c84ca0864769d25bec71b914996ce581fa58;hp=b057fbe9f5298aa58d59a948b6bb783cae2a0886;hpb=6cd92c632cdd4ceca7206dfa99cd2064f430a1ec;p=apps%2Fosp%2FCall.git diff --git a/src/CallTelephonyManager.cpp b/src/CallTelephonyManager.cpp index b057fbe..f1dacba 100644 --- a/src/CallTelephonyManager.cpp +++ b/src/CallTelephonyManager.cpp @@ -35,6 +35,7 @@ using namespace Tizen::Social; using namespace Tizen::System; using namespace Tizen::Base::Collection; using namespace Tizen::Telephony; +using namespace Tizen::Base::Utility; const char* callEventList[] = { TAPI_NOTI_VOICE_CALL_STATUS_IDLE, @@ -2378,6 +2379,19 @@ TelephonyManager::CheckValidTelePhoneNumber(const String& contactNumber) { r = E_FAILURE; } + + //Pattern to compare all characters except 0-9 * # P ; , + + String phoneNumberPattern(L"[^0-9*#P,p+;]"); + RegularExpression checkPhoneNumber; + checkPhoneNumber.Construct(phoneNumberPattern); + //If there is any character other than these listed above then display invalid number + bool resultMatch = checkPhoneNumber.Match(contactNumber,false); + //return false for patterns other than 0-9 * # P ; , + + if(resultMatch == true) + { + //return phone number is invalid + r = E_FAILURE; + } //TODO: check if valid phone number else return error message return r; }