Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanPhone fix ("00" for international prefix and javascript country …

…prefix cleanup)
  • Loading branch information...
commit d5009b38a404629f15c8de71f6a546baf59d6dbb 1 parent 0ea7b58
Filipe Pina authored
View
4 .gitignore
@@ -0,0 +1,4 @@
+build
+temp
+.DS_Store
+DerivedData
View
4 wifiSMS/Classes/MyHTTPConnection.m
@@ -892,6 +892,10 @@ -(NSString *)LoadFullAddressBook:(NSString *)CC {
phoneNoFormat = [[mobile componentsSeparatedByCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]] componentsJoinedByString:@""];
+ if ([phoneNoFormat hasPrefix:@"00"]){
+ phoneNoFormat = [phoneNoFormat substringFromIndex:2];
+ }
+
if ([phoneNoFormat hasPrefix:@"0"]){
phoneNoFormat = [phoneNoFormat substringFromIndex:1];
}
View
11 wifiSMS/Web/func.js
@@ -303,12 +303,17 @@ function cleanPhone(s) {
s = s.replace(/[^\d.]/g, "");
+ if (s.substring(0, 2) == "00") {
+ s = s.substring(2);
+ }
+
if (s.substring(0, 1) == "0") {
s = s.substring(1);
}
- if (s.substring(0, 1) == localStorage.getItem("CC")) {
- s = s.substring(1);
+ var cc = localStorage.getItem("CC");
+ if (s.substring(0, cc.length) == cc) {
+ s = s.substring(cc.length);
}
return s;
@@ -752,7 +757,7 @@ function QuerySMS() {
var tot = json.messages.length-1;
for(var i = 1; i <= tot; i++) {
- var Phone = json.messages[i].Phone;
+ var Phone = cleanPhone(json.messages[i].Phone);
var SMS = json.messages[i].Text;
var flags = json.messages[i].flags;
var group = json.messages[i].group;
Please sign in to comment.
Something went wrong with that request. Please try again.