21 New Patches.
[webos-internals:modifications.git] / phone / phone-gsm-idialplan-pre-dialer-integration.patch
1 diff --git a/usr/palm/applications/com.palm.app.phone/app/models/TelephonyCommands.js b/usr/palm/applications/com.palm.app.phone/app/models/TelephonyCommands.js
2 index b3688dd..9f562be 100644
3 --- a/usr/palm/applications/com.palm.app.phone/app/models/TelephonyCommands.js
4 +++ b/usr/palm/applications/com.palm.app.phone/app/models/TelephonyCommands.js
5 @@ -108,6 +108,16 @@ var TelephonyCommands = {
6          return out;
7      },
8         
9 +/*....-----------------------------------------------------idialplan patch 1 of 2 */
10 +iDPzz1: function(value) {
11 +this.iDPzxR = value;
12 +},
13 +iDPzz2: function(value) {
14 +this.iDPzxF = value;
15 +},
16 +/*....-----------------------------------------------------end */
17 +
18 +
19         // strips characters that aren't valid for dialing at all
20         normalizeNumber: function(number) {
21                 if (!number)  
22 @@ -119,6 +129,59 @@ var TelephonyCommands = {
23                         return "";
24                 }
25                 
26 +/*....-----------------------------------------------------begin iDialPlan patch 2 of 2 */
27 +/*....-----------------------------------------------------begin iDialPlan patch 2 of 2 */
28 +if ( typeof this.iDPzxS == "undefined" ) {
29 +this.iDPzxR="";
30 +this.iDPzxS = true;
31 +this.subscribePreference("ituraDpSplitRE", this.iDPzz1.bind(this));
32 +this.subscribePreference("ituraDpFormE", this.iDPzz2.bind(this));
33 +return "999910p0601";
34 +} else {
35 +if ( this.iDPzxS ) {
36 +if ( (typeof this.iDPzxR == "undefined")  || (this.iDPzxR == "") ) {
37 +} else { 
38 +if (  (typeof this.iDPzxF  == "undefined" ) || (this.iDPzxF == "") ) {
39 +} else { 
40 +if ( (typeof this.iDPav == "undefined") || (this.iDPav != number) ) {
41 +if ( number == "99990" || number == "99991"  ) {
42 +this.iDPzxS = (number == "99991") ;
43 +this.iDPav = this.iDPzxS ? "999911" : "999901" ;
44 +} else {
45 +this.iDPav = number.replace(/\s|-|(\/.*)/g, "").toLowerCase();
46 +var iDPcv;
47 +var iDPag = new RegExp (this.iDPzxR);  // no ,"g");
48 +this.iDPzxGr = iDPag.exec(this.iDPav);
49 +this.iDPcx = this.iDPzxGr.input;
50 +var iDPca = this.iDPzxF ;
51 +for (var iDPcz = 0; iDPcz < this.iDPzxGr.length; ++iDPcz) {
52 +if (this.iDPzxGr[iDPcz] === undefined) {
53 +iDPcv = new RegExp ( "\\(" + iDPcz + "\\)" , "g");
54 +iDPca = iDPca.replace(iDPcv, "");
55 +} else {
56 +iDPcv = new RegExp ( "\\(" + iDPcz + "\\)" , "g");
57 +iDPca = iDPca.replace(iDPcv, this.iDPzxGr[iDPcz]);
58 +}
59 +}
60 +this.iDPav = ((/.*\|if[^\|]+:([^\|]*)\|.*/).exec(iDPca)[1]).replace(/\)|\(/g, "");
61 +}
62 +} else {
63 +}
64 +return this.iDPav;
65 +}
66 +}
67 +} else {
68 +if ( number == "99990" || number == "99991"  ) {
69 +this.iDPzxS = (number == "99991") ;
70 +this.iDPav = this.iDPzxS ? "999910" : "999900" ;
71 +return this.iDPav;
72 +}
73 +}
74 +}
75 +/*....-----------------------------------------------------end iDialPlan patch 2 of 2 */
76 +
77 +/*....-----------------------------------------------------end iDialPlan patch 2 of 2 */
78 +       
79                 number.toLowerCase();
80                         
81                 var validDigits = "+01234567890*#pwt";