~kamalmostafa/ubuntu/lucid/firegpg/fix-515872-ftbfs

« back to all changes in this revision

Viewing changes to content/Core/cgpg.js

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kahn Gillmor
  • Date: 2009-11-17 01:49:16 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091117014916-mk2h2odgagazlq9r
Tags: 0.7.10-1
* New Upstream Version (Closes: #556568)
* moved defaults/preferences/firegpg.js into
  /etc/mozilla-extensions/firegpg.js per Mike Hommey's good suggestion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
*/
41
41
 
 
42
if (typeof(FireGPG)=='undefined') { FireGPG = {}; }
 
43
if (typeof(FireGPG.Const)=='undefined') { FireGPG.Const = {}; }
 
44
 
42
45
 
43
46
/*
44
47
   Constants: FireGPG's actions results
45
48
 
46
 
   FireGPGResults.SUCCESS - The operation was successfull or the signature is correct
47
 
   FireGPGResults.CANCEL - The operation was canceled, for exemple the user click on cancel when his password is asked.
48
 
   FireGPGResults.ERROR_UNKNOW - An unkonw error happend
49
 
   FireGPGResults.ERROR_PASSWORD - The specified password was wrong.
50
 
   FireGPGResults.ERROR_NO_DATA - There wasen't any text to do the operation
51
 
   FireGPGResults.ERROR_ALREADY_SIGN - The text is already signed
52
 
   FireGPGResults.ERROR_BAD_SIGN - The signature was bad
53
 
   FireGPGResults.ERROR_NO_KEY - Impossible to verify the signature beacause there wasn't the public key in the keyring
54
 
   FireGPGResults.ERROR_ALREADY_CRYPT - The text is already encrypted
55
 
   FireGPGResults.ERROR_NO_GPG_DATA - The text is not a vlid PGP block
56
 
   FireGPGResults.ERROR_INIT_FAILLED - There is a problem with GPG, impossible to execute the executable.
 
49
   FireGPG.Const.Results.SUCCESS - The operation was successfull or the signature is correct
 
50
   FireGPG.Const.Results.CANCEL - The operation was canceled, for exemple the user click on cancel when his password is asked.
 
51
   FireGPG.Const.Results.ERROR_UNKNOW - An unkonw error happend
 
52
   FireGPG.Const.Results.ERROR_PASSWORD - The specified password was wrong.
 
53
   FireGPG.Const.Results.ERROR_NO_DATA - There wasen't any text to do the operation
 
54
   FireGPG.Const.Results.ERROR_ALREADY_SIGN - The text is already signed
 
55
   FireGPG.Const.Results.ERROR_BAD_SIGN - The signature was bad
 
56
   FireGPG.Const.Results.ERROR_NO_KEY - Impossible to verify the signature beacause there wasn't the public key in the keyring
 
57
   FireGPG.Const.Results.ERROR_ALREADY_CRYPT - The text is already encrypted
 
58
   FireGPG.Const.Results.ERROR_NO_GPG_DATA - The text is not a vlid PGP block
 
59
   FireGPG.Const.Results.ERROR_INIT_FAILLED - There is a problem with GPG, impossible to execute the executable.
57
60
 
58
61
*/
59
62
 
60
 
const FireGPGResults = {
 
63
FireGPG.Const.Results = {
61
64
    SUCCESS: 0,
62
65
    CANCEL: 1,
63
66
    ERROR_UNKNOW: 2,
72
75
}
73
76
 
74
77
/*
75
 
    Function: FireGPG_GPGReturn
 
78
    Function: FireGPG.GPGReturn
76
79
 
77
80
    This function return a basic object, with variable to return informations about a FireGPG's operation
78
81
 
86
89
        encrypted - The encrypted data with GnuPG
87
90
        decrypted - The decrypted data with GnuPG
88
91
        signed - The signed data with GnuPG
89
 
        signsresults - An array with <FireGPG_GPGReturn> data for each sign's result in the data.
 
92
        signsresults - An array with <FireGPG.GPGReturn> data for each sign's result in the data.
90
93
        signresult - The sign result for the first sign (or the current sign if we're in the signsresults array)
91
94
        signresulttext - The message for the result of the test on the first sign (or the current sign if we're in the signsresults array)
92
95
        signresultuser - The username of the key of the first sign (or the current sign if we're in the signsresults array)
93
96
        signresultdate - The date of the first sign (or the current sign if we're in the signsresults array)
94
 
        keylist - An array of <FireGPG_GPGKey> with the key of the specified keyring (private or public)
 
97
        keylist - An array of <FireGPG.GPGKey> with the key of the specified keyring (private or public)
95
98
        exported - The exported key with GnuPG
96
99
        messagetext - The message who is showed in the lasted alert (usefull when the silent mode is activated)
97
100
 
98
101
*/
99
102
 
100
 
function FireGPG_GPGReturn() {
 
103
FireGPG.GPGReturn = function() {
101
104
 
102
105
    this.result = null;
103
106
    this.ouput = null;
117
120
}
118
121
 
119
122
/*
120
 
    Function: FireGPG_GPGKey
 
123
    Function: FireGPG.GPGKey
121
124
 
122
125
    This function return a basic object, who represent a PGP key
123
126
 
129
132
        keyExpi - The key's expire date
130
133
        keyDate - The key's creation date (ou de la signature)
131
134
        keyId - The key's id
132
 
        subKeys - An array of <FireGPG_GPGKey> with the subkey of the key.
 
135
        subKeys - An array of <FireGPG.GPGKey> with the subkey of the key.
133
136
                expired - True if the key is expired
134
137
                revoked - True if the key is revoked
135
138
                keyTrust - Trust of the key
136
139
                fingerPrint - The fingerprint of the ey
137
140
 
138
141
*/
139
 
function FireGPG_GPGKey() {
 
142
FireGPG.GPGKey = function() {
140
143
    this.keyName = null;
141
144
    this.keyExpi = null;
142
145
    this.keyDate = null;
151
154
}
152
155
 
153
156
/*
154
 
    Function: FireGPG_Sortage
 
157
    Function: FireGPG.Sortage
155
158
 
156
 
    This is a function used to sort an array of <FireGPG_GPGKey> by the key name
 
159
    This is a function used to sort an array of <FireGPG.GPGKey> by the key name
157
160
    Use it like this : thearray.sort(Sortage)
158
161
 
159
162
    Parameters:
161
164
        b - Internal
162
165
 
163
166
*/
164
 
function FireGPG_Sortage(a,b) {
 
167
FireGPG.Sortage = function(a,b) {
165
168
 
166
169
    var x = a.keyName.toLowerCase();
167
170
    var y = b.keyName.toLowerCase();
187
190
   Class: FireGPG
188
191
   This is the main kernel for FireGPG, who give access to all GPG functions (sign, encrypt, ...)
189
192
*/
190
 
var FireGPG = {
 
193
FireGPG.Core = {
191
194
 
192
195
    /*
193
196
        Function: sign
194
197
        Function to sign a text.
195
198
 
196
 
        Return a <FireGPG_GPGReturn> object.
 
199
        Return a <FireGPG.GPGReturn> object.
197
200
 
198
201
        Parameters:
199
202
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
210
213
    */
211
214
    sign: function(silent, text, keyID, password, notClear, autoSelectPrivate, wrap, fileMode, fileFrom, fileTo) {
212
215
 
213
 
        var returnObject = new FireGPG_GPGReturn();
 
216
        var returnObject = new FireGPG.GPGReturn();
214
217
 
215
218
        if (silent == undefined)
216
219
            silent = false;
246
249
                }
247
250
 
248
251
                if (fileFrom == null | fileFrom == '') {
249
 
                    returnObject.result = FireGPGResults.CANCEL;
 
252
                    returnObject.result = FireGPG.Const.Results.CANCEL;
250
253
                    return returnObject;
251
254
                }
252
255
 
285
288
               } else {
286
289
 
287
290
                    fileTo = fileFrom + '.sig';
288
 
                    FireGPGMisc.removeFile(fileTo); //If the already exist
 
291
                    FireGPG.Misc.removeFile(fileTo); //If the already exist
289
292
               }
290
293
 
291
294
                if (fileTo == null | fileTo == '') {
292
 
                    returnObject.result = FireGPGResults.CANCEL;
 
295
                    returnObject.result = FireGPG.Const.Results.CANCEL;
293
296
                    return returnObject;
294
297
                }
295
298
 
296
 
                FireGPGMisc.removeFile(fileTo);
 
299
                FireGPG.Misc.removeFile(fileTo);
297
300
 
298
301
            }
299
302
        }
300
303
 
301
304
 
302
305
        // GPG verification
303
 
        var gpgTest = FireGPG.selfTest(silent);
 
306
        var gpgTest = FireGPG.Core.selfTest(silent);
304
307
 
305
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
308
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
306
309
            returnObject.result = gpgTest.result;
307
310
            return returnObject;
308
311
        }
310
313
 
311
314
        if ((text == undefined || text == null) && !fileMode) {
312
315
            var autoSetMode = true;
313
 
            text = FireGPG_Selection.get();
 
316
            text = FireGPG.Selection.get();
314
317
 
315
318
 
316
319
            //Vu que c'est peut etre un webmail, on passe dans l'autowrap
317
 
            //text = FireGPGAutoWrap.checkAndWrap(text);
 
320
            //text = FireGPG.AutoWrap.checkAndWrap(text);
318
321
            if (wrap)
319
 
                text = FireGPGAutoWrap.wrap(text);
 
322
                text = FireGPG.AutoWrap.wrap(text);
320
323
 
321
324
        }
322
325
 
326
329
 
327
330
            returnObject.messagetext = i18n.getString("noData");
328
331
 
329
 
            returnObject.result = FireGPGResults.ERROR_NO_DATA;
 
332
            returnObject.result = FireGPG.Const.Results.ERROR_NO_DATA;
330
333
                        return returnObject;
331
334
                }
332
335
 
334
337
 
335
338
        if (tryPosition != -1 && !fileMode) {
336
339
                        if (!silent && !confirm(i18n.getString("alreadySign"))) {
337
 
                returnObject.result = FireGPGResults.ERROR_ALREADY_SIGN;
 
340
                returnObject.result = FireGPG.Const.Results.ERROR_ALREADY_SIGN;
338
341
                return returnObject;
339
342
            }
340
343
                }
341
344
 
342
345
                // Needed for a sign
343
346
                if (keyID == undefined || keyID == null) {
344
 
            keyID = FireGPGMisc.getSelfKey(autoSelectPrivate);
 
347
            keyID = FireGPG.Misc.getSelfKey(autoSelectPrivate);
345
348
        }
346
349
 
347
350
        if(keyID == null) {
348
 
            returnObject.result = FireGPGResults.CANCEL;
 
351
            returnObject.result = FireGPG.Const.Results.CANCEL;
349
352
            return returnObject;
350
353
        }
351
354
 
352
 
                if (!FireGPG_isGpgAgentActivated() && (password == undefined || password == null)) {
353
 
            password = FireGPGMisc.getPrivateKeyPassword();
 
355
                if (!FireGPG.isGpgAgentActivated() && (password == undefined || password == null)) {
 
356
            password = FireGPG.Misc.getPrivateKeyPassword();
354
357
        }
355
358
 
356
 
                if(!FireGPG_isGpgAgentActivated() && password == null) {
357
 
                        returnObject.result = FireGPGResults.CANCEL;
 
359
                if(!FireGPG.isGpgAgentActivated() && password == null) {
 
360
                        returnObject.result = FireGPG.Const.Results.CANCEL;
358
361
            return returnObject;
359
362
        }
360
363
 
371
374
 
372
375
            returnObject.messagetext = i18n.getString("signFailedPassword");
373
376
 
374
 
            FireGPGMisc.eraseSavedPassword();
 
377
            FireGPG.Misc.eraseSavedPassword();
375
378
 
376
 
            returnObject.result = FireGPGResults.ERROR_PASSWORD;
 
379
            returnObject.result = FireGPG.Const.Results.ERROR_PASSWORD;
377
380
            return returnObject;
378
381
                }
379
382
 
383
386
                alert(i18n.getString("signFailed") + "\n" + result.sdOut);
384
387
 
385
388
            returnObject.messagetext = i18n.getString("signFailed" + "\n" + result.sdOut);
386
 
            FireGPGMisc.eraseSavedPassword();
387
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
389
            FireGPG.Misc.eraseSavedPassword();
 
390
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
388
391
            return returnObject;
389
392
                }
390
393
 
391
394
 
392
395
        if (autoSetMode) {
393
396
                        // We test if the selection is editable :
394
 
                        if(FireGPG_Selection.isEditable()) {
 
397
                        if(FireGPG.Selection.isEditable()) {
395
398
                                // If yes, we edit this selection with the new text
396
 
                                FireGPG_Selection.set(result.output);
 
399
                                FireGPG.Selection.set(result.output);
397
400
                        }
398
401
                        else //Else, we show a windows with the result
399
 
                                FireGPGMisc.showText(result.output);
 
402
                                FireGPG.Misc.showText(result.output);
400
403
                }
401
404
 
402
405
        if (fileMode) {
405
408
 
406
409
        returnObject.signed = result.output;
407
410
 
408
 
        returnObject.result = FireGPGResults.SUCCESS;
 
411
        returnObject.result = FireGPG.Const.Results.SUCCESS;
409
412
        return returnObject;
410
413
 
411
414
    },
427
430
        Function: listKeys
428
431
        Who return a list of key in the keyring
429
432
 
430
 
        Return a <FireGPG_GPGReturn> object.
 
433
        Return a <FireGPG.GPGReturn> object.
431
434
 
432
435
        Parameters:
433
436
            onlyPrivate - _Optional_, default to false. Set this to true to get only the private keys.
437
440
    */
438
441
        listKeys: function(onlyPrivate, allKeys, onlySignOfThisKey) {
439
442
 
440
 
        var returnObject = new FireGPG_GPGReturn();
 
443
        var returnObject = new FireGPG.GPGReturn();
441
444
 
442
445
        this.initGPGACCESS();
443
446
        var i18n = document.getElementById("firegpg-strings");
444
447
 
445
448
        // GPG verification
446
 
        var gpgTest = FireGPG.selfTest();
 
449
        var gpgTest = FireGPG.Core.selfTest();
447
450
 
448
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
451
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
449
452
            returnObject.result = gpgTest.result;
450
453
            return returnObject;
451
454
        }
459
462
            var result = this.FireGPGGPGAccess.listsigns(onlySignOfThisKey);
460
463
 
461
464
                // We get informations from GPG
462
 
                result = FireGPGMisc.EnigConvertGpgToUnicode(result.sdOut);
 
465
                result = FireGPG.Misc.EnigConvertGpgToUnicode(result.sdOut);
463
466
 
464
467
        returnObject.sdOut = result;
465
468
 
546
549
 
547
550
                    var keyName = infos[9].replace(/\\e3A/g, ":");
548
551
 
549
 
                    var theKey = new FireGPG_GPGKey();
 
552
                    var theKey = new FireGPG.GPGKey();
550
553
 
551
554
                    theKey.keyDate = keyDate;
552
555
                    theKey.keyExpi  = keyExpi;
603
606
                            returnObject.keylist.push(theKey);
604
607
                    }
605
608
                }
606
 
                        } catch (e) { fireGPGDebug(e,'cgpg.listkeys',true);  }
 
609
                        } catch (e) { FireGPG.debug(e,'cgpg.listkeys',true);  }
607
610
                }
608
611
 
609
612
        // Sorts keys
610
 
        returnObject.keylist = returnObject.keylist.sort(FireGPG_Sortage);
 
613
        returnObject.keylist = returnObject.keylist.sort(FireGPG.Sortage);
611
614
        for (var i = 0; i < returnObject.keylist.length; i++)
612
 
            returnObject.keylist[i].subKeys = returnObject.keylist[i].subKeys.sort(FireGPG_Sortage);
 
615
            returnObject.keylist[i].subKeys = returnObject.keylist[i].subKeys.sort(FireGPG.Sortage);
613
616
 
614
 
        returnObject.result = FireGPGResults.SUCCESS;
 
617
        returnObject.result = FireGPG.Const.Results.SUCCESS;
615
618
 
616
619
                return returnObject;
617
620
        },
620
623
        Function: kimport
621
624
        Function to import a sign.
622
625
 
623
 
        Return a <FireGPG_GPGReturn> object.
 
626
        Return a <FireGPG.GPGReturn> object.
624
627
 
625
628
        Parameters:
626
629
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
629
632
    */
630
633
        kimport: function(silent, text, passSecurity) {
631
634
 
632
 
        var returnObject = new FireGPG_GPGReturn();
 
635
        var returnObject = new FireGPG.GPGReturn();
633
636
 
634
637
        if (silent == undefined)
635
638
            silent = false;
641
644
        var i18n = document.getElementById("firegpg-strings");
642
645
 
643
646
        // GPG verification
644
 
        var gpgTest = FireGPG.selfTest(silent);
 
647
        var gpgTest = FireGPG.Core.selfTest(silent);
645
648
 
646
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
649
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
647
650
            returnObject.result = gpgTest.result;
648
651
            return returnObject;
649
652
        }
650
653
 
651
654
        if (text == undefined || text == null)
652
 
            text = FireGPG_Selection.get();
 
655
            text = FireGPG.Selection.get();
653
656
 
654
657
        if (text == "") {
655
658
            if (!silent)
657
660
 
658
661
            returnObject.messagetext = i18n.getString("noData");
659
662
 
660
 
            returnObject.result = FireGPGResults.ERROR_NO_DATA;
 
663
            returnObject.result = FireGPG.Const.Results.ERROR_NO_DATA;
661
664
                        return returnObject;
662
665
                }
663
666
 
670
673
                alert(i18n.getString("noGPGData"));
671
674
 
672
675
            returnObject.messagetext = i18n.getString("noGPGData");
673
 
            returnObject.result = FireGPGResults.ERROR_NO_GPG_DATA;
 
676
            returnObject.result = FireGPG.Const.Results.ERROR_NO_GPG_DATA;
674
677
            return returnObject;
675
678
                }
676
679
 
687
690
                alert(i18n.getString("importFailed") + "\n" + result.sdOut);
688
691
 
689
692
            returnObject.messagetext = i18n.getString("importFailed")  + "\n" + result.sdOut;
690
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
693
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
691
694
            return returnObject;
692
695
 
693
696
        } else {
695
698
                alert(i18n.getString("importOk"));
696
699
 
697
700
            returnObject.messagetext = i18n.getString("importOk");
698
 
            returnObject.result = FireGPGResults.SUCCESS;
 
701
            returnObject.result = FireGPG.Const.Results.SUCCESS;
699
702
            return returnObject;
700
703
        }
701
704
 
706
709
        Function: kexport
707
710
        Function to export a key
708
711
 
709
 
        Return a <FireGPG_GPGReturn> object.
 
712
        Return a <FireGPG.GPGReturn> object.
710
713
 
711
714
        Parameters:
712
715
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
713
716
            keyID - _Optional_, if not set use ask the user. The public keyID to export
714
717
    */
715
718
        kexport: function(silent, keyID) {
716
 
                var returnObject = new FireGPG_GPGReturn();
 
719
                var returnObject = new FireGPG.GPGReturn();
717
720
 
718
721
        if (silent == undefined)
719
722
            silent = false;
722
725
        var i18n = document.getElementById("firegpg-strings");
723
726
 
724
727
        // GPG verification
725
 
        var gpgTest = FireGPG.selfTest(silent);
 
728
        var gpgTest = FireGPG.Core.selfTest(silent);
726
729
 
727
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
730
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
728
731
            returnObject.result = gpgTest.result;
729
732
            return returnObject;
730
733
        }
731
734
 
732
735
                // Needed for a crypt
733
736
        if (keyID == undefined || keyID == null)
734
 
            keyID = FireGPGMisc.choosePublicKey();
 
737
            keyID = FireGPG.Misc.choosePublicKey();
735
738
 
736
739
 
737
740
                if(keyID == null) {
738
 
            returnObject.result = FireGPGResults.CANCEL;
 
741
            returnObject.result = FireGPG.Const.Results.CANCEL;
739
742
            return returnObject;
740
743
        }
741
744
 
751
754
                alert(i18n.getString("exportFailed"));
752
755
 
753
756
            returnObject.messagetext = i18n.getString("exportFailed");
754
 
                        returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
757
                        returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
755
758
            return returnObject;
756
759
                }       else  {
757
760
                if (!silent)
758
 
                    FireGPGMisc.showText(result.sdOut);
 
761
                    FireGPG.Misc.showText(result.sdOut);
759
762
 
760
763
                returnObject.exported = result.sdOut;
761
 
                returnObject.result = FireGPGResults.SUCCESS;
 
764
                returnObject.result = FireGPG.Const.Results.SUCCESS;
762
765
                return returnObject;
763
766
                }
764
767
        },
767
770
        Function: crypt
768
771
        Function to encrypt a text.
769
772
 
770
 
        Return a <FireGPG_GPGReturn> object.
 
773
        Return a <FireGPG.GPGReturn> object.
771
774
 
772
775
        Parameters:
773
776
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
784
787
    */
785
788
        crypt: function(silent, text, keyIdList, fromGpgAuth, binFileMode, autoSelect, symetrical, password, fileMode, fileFrom, fileTo) {
786
789
 
787
 
        var returnObject = new FireGPG_GPGReturn();
 
790
        var returnObject = new FireGPG.GPGReturn();
788
791
 
789
792
        if (silent == undefined)
790
793
            silent = false;
813
816
                }
814
817
 
815
818
                if (fileFrom == null | fileFrom == '') {
816
 
                    returnObject.result = FireGPGResults.CANCEL;
 
819
                    returnObject.result = FireGPG.Const.Results.CANCEL;
817
820
                    return returnObject;
818
821
                }
819
822
 
847
850
                }
848
851
 
849
852
                if (fileTo == null | fileTo == '') {
850
 
                    returnObject.result = FireGPGResults.CANCEL;
 
853
                    returnObject.result = FireGPG.Const.Results.CANCEL;
851
854
                    return returnObject;
852
855
                }
853
856
 
854
 
                FireGPGMisc.removeFile(fileTo);
 
857
                FireGPG.Misc.removeFile(fileTo);
855
858
 
856
859
            }
857
860
        }
858
861
 
859
862
        // GPG verification
860
 
        var gpgTest = FireGPG.selfTest(silent);
 
863
        var gpgTest = FireGPG.Core.selfTest(silent);
861
864
 
862
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
865
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
863
866
            returnObject.result = gpgTest.result;
864
867
            return returnObject;
865
868
        }
870
873
 
871
874
        if ((text == undefined || text == null)  && !fileMode) {
872
875
            var autoSetMode = true;
873
 
            text = FireGPG_Selection.get();
 
876
            text = FireGPG.Selection.get();
874
877
        }
875
878
 
876
879
        if (text == "" && !fileMode) {
878
881
                alert(i18n.getString("noData"));
879
882
 
880
883
            returnObject.messagetext = i18n.getString("noData");
881
 
            returnObject.result = FireGPGResults.ERROR_NO_DATA;
 
884
            returnObject.result = FireGPG.Const.Results.ERROR_NO_DATA;
882
885
                        return returnObject;
883
886
                }
884
887
 
887
890
        if (tryPosition != -1 && !fileMode) {
888
891
                        if (!silent && !confirm(i18n.getString("alreadyCrypt"))) {
889
892
 
890
 
                returnObject.result = FireGPGResults.ERROR_ALREADY_CRYPT;
 
893
                returnObject.result = FireGPG.Const.Results.ERROR_ALREADY_CRYPT;
891
894
                return returnObject;
892
895
            }
893
896
                }
894
897
 
895
898
                // Needed for a sign
896
899
                if ((keyIdList == undefined || keyIdList == null) && !symetrical) {
897
 
            keyIdList = FireGPGMisc.choosePublicKey(autoSelect);
 
900
            keyIdList = FireGPG.Misc.choosePublicKey(autoSelect);
898
901
        }
899
902
 
900
903
        if(keyIdList == null && !symetrical) {
901
 
            returnObject.result = FireGPGResults.CANCEL;
 
904
            returnObject.result = FireGPG.Const.Results.CANCEL;
902
905
            return returnObject;
903
906
        }
904
907
 
907
910
 
908
911
 
909
912
            if (password == undefined || password == null) {
910
 
                password = FireGPGMisc.getPrivateKeyPassword(false,false,i18n.getString("symetricalPass") + ":", true);
 
913
                password = FireGPG.Misc.getPrivateKeyPassword(false,false,i18n.getString("symetricalPass") + ":", true);
911
914
 
912
 
                password2 = FireGPGMisc.getPrivateKeyPassword(false,false,i18n.getString("symetricalPass2") + ":", true);
 
915
                password2 = FireGPG.Misc.getPrivateKeyPassword(false,false,i18n.getString("symetricalPass2") + ":", true);
913
916
 
914
917
                if (password2 != password) {
915
918
 
916
919
                    if (!silent)
917
920
                        alert(i18n.getString("differentPassword"));
918
921
 
919
 
                    returnObject.result = FireGPGResults.CANCEL;
 
922
                    returnObject.result = FireGPG.Const.Results.CANCEL;
920
923
                     return returnObject;
921
924
                }
922
925
            }
923
926
 
924
927
            if(password == null || password == "") {
925
 
                returnObject.result = FireGPGResults.CANCEL;
 
928
                returnObject.result = FireGPG.Const.Results.CANCEL;
926
929
                return returnObject;
927
930
            }
928
931
 
957
960
                        if (!silent)
958
961
                alert(i18n.getString("cryptFailed") + "\n" + result.sdOut);
959
962
 
960
 
            FireGPGMisc.eraseSavedPassword();
 
963
            FireGPG.Misc.eraseSavedPassword();
961
964
            returnObject.messagetext = i18n.getString("cryptFailed") + "\n" + result.sdOut;
962
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
965
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
963
966
            return returnObject;
964
967
                }
965
968
 
966
969
 
967
970
        if (autoSetMode) {
968
971
                        // We test if the selection is editable :
969
 
                        if(FireGPG_Selection.isEditable()) {
 
972
                        if(FireGPG.Selection.isEditable()) {
970
973
                                // If yes, we edit this selection with the new text
971
 
                                FireGPG_Selection.set(result.output);
 
974
                                FireGPG.Selection.set(result.output);
972
975
                        }
973
976
                        else //Else, we show a windows with the result
974
 
                                FireGPGMisc.showText(result.output);
 
977
                                FireGPG.Misc.showText(result.output);
975
978
                }
976
979
 
977
980
 
981
984
 
982
985
        returnObject.encrypted = result.output;
983
986
 
984
 
        returnObject.result = FireGPGResults.SUCCESS;
 
987
        returnObject.result = FireGPG.Const.Results.SUCCESS;
985
988
        return returnObject;
986
989
 
987
990
 
991
994
        Function: cryptAndSign
992
995
        Function to encrypt and sign a text.
993
996
 
994
 
        Return a <FireGPG_GPGReturn> object.
 
997
        Return a <FireGPG.GPGReturn> object.
995
998
 
996
999
        Parameters:
997
1000
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
1009
1012
    */
1010
1013
    cryptAndSign: function(silent, text, keyIdList, fromGpgAuth, password, keyID, binFileMode, autoSelect, autoSelectPrivate, fileMode, fileFrom, fileTo) {
1011
1014
 
1012
 
        var returnObject = new FireGPG_GPGReturn();
 
1015
        var returnObject = new FireGPG.GPGReturn();
1013
1016
 
1014
1017
        if (silent == undefined)
1015
1018
            silent = false;
1038
1041
                }
1039
1042
 
1040
1043
                if (fileFrom == null | fileFrom == '') {
1041
 
                    returnObject.result = FireGPGResults.CANCEL;
 
1044
                    returnObject.result = FireGPG.Const.Results.CANCEL;
1042
1045
                    return returnObject;
1043
1046
                }
1044
1047
 
1072
1075
                }
1073
1076
 
1074
1077
                if (fileTo == null | fileTo == '') {
1075
 
                    returnObject.result = FireGPGResults.CANCEL;
 
1078
                    returnObject.result = FireGPG.Const.Results.CANCEL;
1076
1079
                    return returnObject;
1077
1080
                }
1078
1081
 
1079
 
                FireGPGMisc.removeFile(fileTo);
 
1082
                FireGPG.Misc.removeFile(fileTo);
1080
1083
 
1081
1084
            }
1082
1085
        }
1083
1086
 
1084
1087
        // GPG verification
1085
 
        var gpgTest = FireGPG.selfTest(silent);
 
1088
        var gpgTest = FireGPG.Core.selfTest(silent);
1086
1089
 
1087
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
1090
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
1088
1091
            returnObject.result = gpgTest.result;
1089
1092
            return returnObject;
1090
1093
        }
1092
1095
 
1093
1096
        if ((text == undefined || text == null) && !fileMode) {
1094
1097
            var autoSetMode = true;
1095
 
            text = FireGPG_Selection.get();
 
1098
            text = FireGPG.Selection.get();
1096
1099
        }
1097
1100
 
1098
1101
        if (text == "" && !fileMode) {
1100
1103
                alert(i18n.getString("noData"));
1101
1104
 
1102
1105
            returnObject.messagetext = i18n.getString("noData");
1103
 
            returnObject.result = FireGPGResults.ERROR_NO_DATA;
 
1106
            returnObject.result = FireGPG.Const.Results.ERROR_NO_DATA;
1104
1107
                        return returnObject;
1105
1108
                }
1106
1109
 
1108
1111
 
1109
1112
        if (tryPosition != -1 && !fileMode) {
1110
1113
                        if (!silent && !confirm(i18n.getString("alreadyCrypt"))) {
1111
 
                returnObject.result = FireGPGResults.ERROR_ALREADY_CRYPT;
 
1114
                returnObject.result = FireGPG.Const.Results.ERROR_ALREADY_CRYPT;
1112
1115
                return returnObject;
1113
1116
            }
1114
1117
                }
1115
1118
 
1116
1119
                // Needed for a sign
1117
1120
                if (keyIdList == undefined || keyIdList == null) {
1118
 
            keyIdList = FireGPGMisc.choosePublicKey(autoSelect);
 
1121
            keyIdList = FireGPG.Misc.choosePublicKey(autoSelect);
1119
1122
        }
1120
1123
 
1121
1124
        if(keyIdList == null) {
1122
 
            returnObject.result = FireGPGResults.CANCEL;
 
1125
            returnObject.result = FireGPG.Const.Results.CANCEL;
1123
1126
            return returnObject;
1124
1127
        }
1125
1128
 
1126
1129
        // Needed for a sign
1127
1130
                if (keyID == undefined || keyID == null) {
1128
 
            keyID = FireGPGMisc.getSelfKey(autoSelectPrivate);
 
1131
            keyID = FireGPG.Misc.getSelfKey(autoSelectPrivate);
1129
1132
        }
1130
1133
 
1131
1134
        if(keyID == null) {
1132
 
            returnObject.result = FireGPGResults.CANCEL;
 
1135
            returnObject.result = FireGPG.Const.Results.CANCEL;
1133
1136
            return returnObject;
1134
1137
        }
1135
1138
 
1136
 
                if (!FireGPG_isGpgAgentActivated() && (password == undefined || password == null)) {
1137
 
            password = FireGPGMisc.getPrivateKeyPassword();
 
1139
                if (!FireGPG.isGpgAgentActivated() && (password == undefined || password == null)) {
 
1140
            password = FireGPG.Misc.getPrivateKeyPassword();
1138
1141
        }
1139
1142
 
1140
 
                if(!FireGPG_isGpgAgentActivated() &&password == null) {
1141
 
                        returnObject.result = FireGPGResults.CANCEL;
 
1143
                if(!FireGPG.isGpgAgentActivated() &&password == null) {
 
1144
                        returnObject.result = FireGPG.Const.Results.CANCEL;
1142
1145
            return returnObject;
1143
1146
        }
1144
1147
 
1155
1158
                        if (!silent)
1156
1159
                alert(i18n.getString("cryptAndSignFailedPass"));
1157
1160
 
1158
 
            FireGPGMisc.eraseSavedPassword();
 
1161
            FireGPG.Misc.eraseSavedPassword();
1159
1162
            returnObject.messagetext = i18n.getString("cryptAndSignFailedPass");
1160
 
            returnObject.result = FireGPGResults.ERROR_PASSWORD;
 
1163
            returnObject.result = FireGPG.Const.Results.ERROR_PASSWORD;
1161
1164
            return returnObject;
1162
1165
                }
1163
1166
 
1166
1169
                        if (!silent)
1167
1170
                alert(i18n.getString("cryptAndSignFailed") + "\n" + result.sdOut);
1168
1171
 
1169
 
            FireGPGMisc.eraseSavedPassword();
 
1172
            FireGPG.Misc.eraseSavedPassword();
1170
1173
            returnObject.messagetext = i18n.getString("cryptAndSignFailed") + "\n" + result.sdOut;
1171
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
1174
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
1172
1175
            return returnObject;
1173
1176
                }
1174
1177
 
1175
1178
 
1176
1179
        if (autoSetMode) {
1177
1180
                        // We test if the selection is editable :
1178
 
                        if(FireGPG_Selection.isEditable()) {
 
1181
                        if(FireGPG.Selection.isEditable()) {
1179
1182
                                // If yes, we edit this selection with the new text
1180
 
                                FireGPG_Selection.set(result.output);
 
1183
                                FireGPG.Selection.set(result.output);
1181
1184
                        }
1182
1185
                        else //Else, we show a windows with the result
1183
 
                                FireGPGMisc.showText(result.output);
 
1186
                                FireGPG.Misc.showText(result.output);
1184
1187
                }
1185
1188
 
1186
1189
 
1190
1193
 
1191
1194
        returnObject.encrypted = result.output;
1192
1195
 
1193
 
        returnObject.result = FireGPGResults.SUCCESS;
 
1196
        returnObject.result = FireGPG.Const.Results.SUCCESS;
1194
1197
        return returnObject;
1195
1198
 
1196
1199
 
1200
1203
        Function: verify
1201
1204
        Function to verify signs in a text.
1202
1205
 
1203
 
        Return a <FireGPG_GPGReturn> object.
 
1206
        Return a <FireGPG.GPGReturn> object.
1204
1207
 
1205
1208
        Parameters:
1206
1209
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
1215
1218
    */
1216
1219
        verify: function(silent, text, charset, signData, fileMode, fileFrom, fileSig, fileDataForSign, fromDTA) {
1217
1220
 
1218
 
        var returnObject = new FireGPG_GPGReturn();
 
1221
        var returnObject = new FireGPG.GPGReturn();
1219
1222
 
1220
1223
        if (silent == undefined)
1221
1224
            silent = false;
1248
1251
                }
1249
1252
 
1250
1253
                if (fileFrom == null | fileFrom == '') {
1251
 
                    returnObject.result = FireGPGResults.CANCEL;
 
1254
                    returnObject.result = FireGPG.Const.Results.CANCEL;
1252
1255
                    return returnObject;
1253
1256
                }
1254
1257
 
1256
1259
 
1257
1260
            if (fileSig == undefined && fileDataForSign == undefined) {
1258
1261
 
1259
 
                if (FireGPGMisc.fileExist(fileFrom + '.sig')) {
 
1262
                if (FireGPG.Misc.fileExist(fileFrom + '.sig')) {
1260
1263
 
1261
1264
                    if (confirm(i18n.getString('sigFoundSelectAFile'))) {
1262
1265
 
1281
1284
                        }
1282
1285
 
1283
1286
                        if (fileSig == null | fileSig == '') {
1284
 
                            returnObject.result = FireGPGResults.CANCEL;
 
1287
                            returnObject.result = FireGPG.Const.Results.CANCEL;
1285
1288
                            return returnObject;
1286
1289
                        }
1287
1290
 
1292
1295
 
1293
1296
 
1294
1297
        // GPG verification
1295
 
        var gpgTest = FireGPG.selfTest(silent);
 
1298
        var gpgTest = FireGPG.Core.selfTest(silent);
1296
1299
 
1297
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
1300
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
1298
1301
            returnObject.result = gpgTest.result;
1299
1302
            return returnObject;
1300
1303
        }
1302
1305
 
1303
1306
        if ((text == undefined || text == null) && !fileMode ) {
1304
1307
            var autoSetMode = true;
1305
 
            text = FireGPG_Selection.get();
 
1308
            text = FireGPG.Selection.get();
1306
1309
        }
1307
1310
 
1308
1311
        if (text == "" && !fileMode) {
1310
1313
                alert(i18n.getString("noData"));
1311
1314
 
1312
1315
            returnObject.messagetext = i18n.getString("noData");
1313
 
            returnObject.result = FireGPGResults.ERROR_NO_DATA;
 
1316
            returnObject.result = FireGPG.Const.Results.ERROR_NO_DATA;
1314
1317
                        return returnObject;
1315
1318
                }
1316
1319
 
1331
1334
                alert(i18n.getString("noGPGData"));
1332
1335
 
1333
1336
            returnObject.messagetext = i18n.getString("noGPGData");
1334
 
            returnObject.result = FireGPGResults.ERROR_NO_GPG_DATA;
 
1337
            returnObject.result = FireGPG.Const.Results.ERROR_NO_GPG_DATA;
1335
1338
                        return returnObject;
1336
1339
                }
1337
1340
        else {
1343
1346
 
1344
1347
            for (var rid in results) {
1345
1348
 
1346
 
                result = results[rid];
 
1349
                var result = results[rid];
1347
1350
 
1348
 
                if (result.result == FireGPGResults.ERROR_UNKNOW)
 
1351
                if (result.result == FireGPG.Const.Results.ERROR_UNKNOW)
1349
1352
                    resulttxt += i18n.getString("verifFailed") + "\n";
1350
 
                else if (result.result == FireGPGResults.ERROR_BAD_SIGN)
 
1353
                else if (result.result == FireGPG.Const.Results.ERROR_BAD_SIGN)
1351
1354
                        resulttxt += i18n.getString("verifFailed") + " (" + i18n.getString("falseSign") + ")\n";
1352
 
                else if (result.result == FireGPGResults.ERROR_NO_KEY)
 
1355
                else if (result.result == FireGPG.Const.Results.ERROR_NO_KEY)
1353
1356
                        resulttxt +=  i18n.getString("verifFailed") + " (" + i18n.getString("keyNotFound") + ")\n";
1354
1357
                else {
1355
1358
                    resulttxt +=  i18n.getString("verifSuccess") + " " + result.signresulttext + "\n";
1366
1369
            returnObject.signresultuser = results[0].signresultuser;
1367
1370
            returnObject.signresultdate = results[0].signresultdate;
1368
1371
 
 
1372
 
1369
1373
            if (results[0].revoked)
1370
1374
                returnObject.revoked  = results[0].revoked;
1371
1375
 
1373
1377
                returnObject.notTrusted  = results[0].notTrusted;
1374
1378
 
1375
1379
 
1376
 
            returnObject.result = FireGPGResults.SUCCESS;
 
1380
            returnObject.result = FireGPG.Const.Results.SUCCESS;
1377
1381
 
1378
1382
            return returnObject;
1379
1383
 
1384
1388
        Function: layers
1385
1389
        Find each layer of a test and verify it (resurcise function)
1386
1390
 
1387
 
        Return an array of resultss <FireGPG_GPGReturn> object.
 
1391
        Return an array of resultss <FireGPG.GPGReturn> object.
1388
1392
 
1389
1393
        Parameters:
1390
1394
            text - The text to verify
1462
1466
        Function: layerverify
1463
1467
        Internal, verify a part of a test.
1464
1468
 
1465
 
        Return a <FireGPG_GPGReturn> object.
 
1469
        Return a <FireGPG.GPGReturn> object.
1466
1470
 
1467
1471
        Parameters:
1468
1472
            text - The text to verify
1478
1482
            fromDTA - _Optional_. True if called form DTA
1479
1483
    */
1480
1484
    layerverify: function(text,layer,division, charset,dontask, fileMode, fileFrom, fileSig, nextText, fileDataForSign, fromDTA) {
1481
 
        var returnObject = new FireGPG_GPGReturn();
 
1485
        var returnObject = new FireGPG.GPGReturn();
1482
1486
 
1483
1487
        if (dontask == undefined)
1484
1488
            dontask = false;
1485
1489
 
 
1490
        var result;
1486
1491
 
1487
1492
        // We get the result
1488
1493
        if (nextText == undefined) {
1489
1494
            var result = this.FireGPGGPGAccess.verify(text, charset, fileMode, fileFrom, fileSig, fileDataForSign, fromDTA);
1490
 
 
1491
1495
            if ( charset && charset.toLowerCase() == "iso-8859-1")
1492
 
                result.sdOut = FireGPGMisc.EnigConvertToUnicode(result.sdOut, 'UTF-8');
 
1496
                result.sdOut = FireGPG.Misc.EnigConvertToUnicode(result.sdOut, 'UTF-8');
1493
1497
        }         else {
1494
 
            result = new FireGPG_GPGReturn();
 
1498
            result = new FireGPG.GPGReturn();
1495
1499
            result.sdOut = nextText;
1496
1500
 
1497
1501
        }
1502
1506
                // If check failled
1503
1507
                if(result.sdOut.indexOf("GOODSIG") == "-1") {
1504
1508
 
1505
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
1509
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
1506
1510
 
1507
1511
            if(result.sdOut.indexOf("REVKEYSIG") != -1) {
1508
1512
                returnObject.revoked = true;
1509
1513
            }
1510
1514
 
1511
1515
            if(result.sdOut.indexOf("BADSIG") != -1) {
1512
 
                returnObject.result = FireGPGResults.ERROR_BAD_SIGN;
 
1516
                returnObject.result = FireGPG.Const.Results.ERROR_BAD_SIGN;
1513
1517
 
1514
1518
                testIfMore = result.sdOut.substring(result.sdOut.indexOf("BADSIG") + "BADSIG".length,result.sdOut.length);
1515
1519
 
1520
1524
            }
1521
1525
 
1522
1526
            if(result.sdOut.indexOf("NO_PUBKEY") != -1) {
1523
 
                returnObject.result = FireGPGResults.ERROR_NO_KEY;
 
1527
                returnObject.result = FireGPG.Const.Results.ERROR_NO_KEY;
1524
1528
 
1525
1529
                testIfMore = result.sdOut.substring(result.sdOut.indexOf("NO_PUBKEY")  + "NO_PUBKEY".length,result.sdOut.length);
1526
1530
 
1536
1540
                        var prefs = Components.classes["@mozilla.org/preferences-service;1"].
1537
1541
                                       getService(Components.interfaces.nsIPrefService);
1538
1542
                    prefs = prefs.getBranch("extensions.firegpg.");
1539
 
                var disabledown  = false;
1540
 
                try {
1541
 
                    disabledown = prefs.getBoolPref("dont_ask_to_download_key");
1542
 
                } catch (e) { disabledown = false; }
1543
 
 
1544
 
                                if (!dontask && !disabledown && confirm(document.getElementById('firegpg-strings').getString('autoFeetch') + ' (' + idOfMissingKey + ')')) {
1545
 
                                        FireGPG.retriveKeyFromServer(idOfMissingKey);
 
1543
 
 
1544
                    var disabledown  = false;
 
1545
                    try {
 
1546
                        disabledown = prefs.getBoolPref("dont_ask_to_download_key");
 
1547
                    } catch (e) { disabledown = false; }
 
1548
 
 
1549
                    var dontaskdonw  = false;
 
1550
                    try {
 
1551
                        dontaskdonw = prefs.getBoolPref("download_key_widhout_asking");
 
1552
                    } catch (e) { dontaskdonw = false; }
 
1553
 
 
1554
                                if (!dontask && !disabledown && (dontaskdonw || confirm(document.getElementById('firegpg-strings').getString('autoFeetch') + ' (' + idOfMissingKey + ')'))) {
 
1555
                                        FireGPG.Core.retriveKeyFromServer(idOfMissingKey);
1546
1556
                                        return this.layerverify(text,layer,division,charset,true, fileMode, fileFrom, fileSig,nextText);
1547
1557
                                }
1548
1558
 
1555
1565
            }
1556
1566
 
1557
1567
 
 
1568
 
1558
1569
                        // If he work, we get informations of the Key
1559
1570
                        var infos = result.sdOut;
1560
1571
 
1561
 
            infos2 = infos.substring(0,infos.indexOf("SIG_ID") + 7);
 
1572
            var infos2 = infos.substring(0,infos.indexOf("SIG_ID") + 7);
1562
1573
 
1563
1574
                        infos2 = result.sdOut.replace(infos2, "");
1564
1575
 
1579
1590
 
1580
1591
            var i18n = document.getElementById("firegpg-strings");
1581
1592
 
1582
 
            returnObject.result = FireGPGResults.SUCCESS;
 
1593
            returnObject.result = FireGPG.Const.Results.SUCCESS;
1583
1594
 
1584
1595
            var infos2 = "";
1585
1596
            infos = infos.split(" ");
1587
1598
                infos2 = infos2 + infos[ii] + " ";
1588
1599
 
1589
1600
 
1590
 
            returnObject.signresulttext = infos2 + " (" + i18n.getString("signMadeThe") + " " + date.toLocaleString() + ")";
 
1601
            returnObject.signresulttext = infos2 + (returnObject.notTrusted ? i18n.getString('key_is_not_trusted') : "") + " (" + i18n.getString("signMadeThe") + " " + date.toLocaleString() + ")";
1591
1602
            returnObject.signresultuser = infos2 ;
1592
1603
            returnObject.signresultdate = date.toLocaleString();
1593
1604
 
 
1605
 
1594
1606
            testIfMore = result.sdOut.substring(result.sdOut.indexOf("GOODSIG") + "GOODSIG".length,result.sdOut.length);
1595
1607
 
1596
1608
            if (testIfMore.indexOf("GOODSIG") != -1 || testIfMore.indexOf("ERRSIG") != -1 || testIfMore.indexOf("BADSIG") != -1 || testIfMore.indexOf("REVKEYSIG") != -1) {
1607
1619
        Function: decrypt
1608
1620
        Function to decrypt a text.
1609
1621
 
1610
 
        Return a <FireGPG_GPGReturn> object.
 
1622
        Return a <FireGPG.GPGReturn> object.
1611
1623
 
1612
1624
        Parameters:
1613
1625
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
1620
1632
            api - _Optional_ True if it's a call form the api
1621
1633
    */
1622
1634
        decrypt: function(silent, text, password, binFileEncoded, fileMode, fileFrom, fileTo, api) { try {
1623
 
                var returnObject = new FireGPG_GPGReturn();
 
1635
                var returnObject = new FireGPG.GPGReturn();
1624
1636
 
1625
1637
        if (silent == undefined)
1626
1638
            silent = false;
1655
1667
                }
1656
1668
 
1657
1669
                if (fileFrom == null | fileFrom == '') {
1658
 
                    returnObject.result = FireGPGResults.CANCEL;
 
1670
                    returnObject.result = FireGPG.Const.Results.CANCEL;
1659
1671
                    return returnObject;
1660
1672
                }
1661
1673
 
1689
1701
                }
1690
1702
 
1691
1703
                if (fileTo == null | fileTo == '') {
1692
 
                    returnObject.result = FireGPGResults.CANCEL;
 
1704
                    returnObject.result = FireGPG.Const.Results.CANCEL;
1693
1705
                    return returnObject;
1694
1706
                }
1695
1707
 
1696
 
                FireGPGMisc.removeFile(fileTo);
 
1708
                FireGPG.Misc.removeFile(fileTo);
1697
1709
 
1698
1710
            }
1699
1711
        }
1700
1712
 
1701
1713
        // GPG verification
1702
 
        var gpgTest = FireGPG.selfTest(silent);
 
1714
        var gpgTest = FireGPG.Core.selfTest(silent);
1703
1715
 
1704
 
                if(gpgTest.result != FireGPGResults.SUCCESS) {
 
1716
                if(gpgTest.result != FireGPG.Const.Results.SUCCESS) {
1705
1717
            returnObject.result = gpgTest.result;
1706
1718
            return returnObject;
1707
1719
        }
1709
1721
 
1710
1722
        if ((text == undefined || text == null) && !fileMode) {
1711
1723
            var autoSetMode = true;
1712
 
            text = FireGPG_Selection.get();
 
1724
            text = FireGPG.Selection.get();
1713
1725
        }
1714
1726
 
1715
1727
        if (text == "" && !fileMode) {
1717
1729
                alert(i18n.getString("noData"));
1718
1730
 
1719
1731
            returnObject.messagetext = i18n.getString("noData");
1720
 
            returnObject.result = FireGPGResults.ERROR_NO_DATA;
 
1732
            returnObject.result = FireGPG.Const.Results.ERROR_NO_DATA;
1721
1733
                        return returnObject;
1722
1734
                }
1723
1735
 
1742
1754
                alert(i18n.getString("noGPGData"));
1743
1755
 
1744
1756
            returnObject.messagetext = i18n.getString("noGPGData");
1745
 
            returnObject.result = FireGPGResults.ERROR_NO_GPG_DATA;
 
1757
            returnObject.result = FireGPG.Const.Results.ERROR_NO_GPG_DATA;
1746
1758
            return returnObject;
1747
1759
                }
1748
1760
 
1750
1762
            text = text.substring(firstPosition,lastPosition + ("-----END PGP MESSAGE-----").length);
1751
1763
 
1752
1764
                // Needed for a decrypt
1753
 
                if (!FireGPG_isGpgAgentActivated() && (password == undefined || password == null)) {
1754
 
                password = FireGPGMisc.getsavedPassword();
 
1765
                if (!FireGPG.isGpgAgentActivated() && (password == undefined || password == null)) {
 
1766
                password = FireGPG.Misc.getsavedPassword();
1755
1767
                if (password == null)
1756
1768
                    password = "wrongPass";
1757
1769
        }
1758
1770
 
1759
 
                if(!FireGPG_isGpgAgentActivated() && password == null) {
1760
 
                        returnObject.result = FireGPGResults.CANCEL;
 
1771
                if(!FireGPG.isGpgAgentActivated() && password == null) {
 
1772
                        returnObject.result = FireGPG.Const.Results.CANCEL;
1761
1773
            return returnObject;
1762
1774
        }
1763
1775
 
1769
1781
        if(!api && result.sdOut.indexOf("DECRYPTION_OKAY") == -1 && (result.sdOut.indexOf("BAD_PASSPHRASE") != -1 || result.sdOut.indexOf("NEED_PASSPHRASE_SYM") != -1 || result.sdOut.indexOf("NEED_PASSPHRASE_PIN") != -1)) {
1770
1782
 
1771
1783
            if (result.sdOut.indexOf("NEED_PASSPHRASE_SYM") != -1)
1772
 
                password = FireGPGMisc.getPrivateKeyPassword(false, false,i18n.getString("symetricalPass") + ":", true);
 
1784
                password = FireGPG.Misc.getPrivateKeyPassword(false, false,i18n.getString("symetricalPass") + ":", true);
1773
1785
            else
1774
 
                password = FireGPGMisc.getPrivateKeyPassword();
 
1786
                password = FireGPG.Misc.getPrivateKeyPassword();
1775
1787
 
1776
1788
            if(password == null) {
1777
 
                returnObject.result = FireGPGResults.CANCEL;
 
1789
                returnObject.result = FireGPG.Const.Results.CANCEL;
1778
1790
                return returnObject;
1779
1791
            }
1780
1792
 
1791
1803
            if (!silent)
1792
1804
                alert(i18n.getString("decryptFailedPassword"));
1793
1805
 
1794
 
            FireGPGMisc.eraseSavedPassword();
 
1806
            FireGPG.Misc.eraseSavedPassword();
1795
1807
            returnObject.messagetext = i18n.getString("decryptFailedPassword");
1796
 
            returnObject.result = FireGPGResults.ERROR_PASSWORD;
 
1808
            returnObject.result = FireGPG.Const.Results.ERROR_PASSWORD;
1797
1809
            return returnObject;
1798
1810
                }
1799
1811
 
1803
1815
                alert(i18n.getString("decryptFailed") + "\n" + result.sdOut);
1804
1816
 
1805
1817
            returnObject.messagetext = i18n.getString("decryptFailed") + "\n" + result.sdOut;
1806
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
1807
 
            FireGPGMisc.eraseSavedPassword();
 
1818
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
 
1819
            FireGPG.Misc.eraseSavedPassword();
1808
1820
            return returnObject;
1809
1821
                }
1810
1822
        if (result.sdOut.indexOf("PLAINTEXT") != -1 && result.sdOut.indexOf("DECRYPTION_OKAY") == -1) { //Filemode produit un output en.. plaintext..
1822
1834
        //Il y avait une signature dans le truc //TODO: detect bad signs.
1823
1835
                if(result.sdOut.indexOf("GOODSIG") != -1) {
1824
1836
 
1825
 
            infos2 = result.sdOut.substring(0,result.sdOut.indexOf("SIG_ID") + 7);
 
1837
            var infos2 = result.sdOut.substring(0,result.sdOut.indexOf("SIG_ID") + 7);
1826
1838
 
1827
1839
                        infos2 = result.sdOut.replace(infos2, "");
1828
1840
 
1847
1859
            for (var ii = 1; ii < infos.length; ++ii)
1848
1860
                infos2 = infos2 + infos[ii] + " ";
1849
1861
 
1850
 
            returnObject.signresult = FireGPGResults.SUCCESS;
 
1862
            returnObject.signresult = FireGPG.Const.Results.SUCCESS;
1851
1863
            returnObject.signresulttext = infos2 + " (" + i18n.getString("signMadeThe") + " " + date.toLocaleString() + ")";
1852
1864
            returnObject.signresultuser = infos2;
1853
1865
            returnObject.signresultdate = date.toLocaleString();
1858
1870
 
1859
1871
        if (autoSetMode) {
1860
1872
            //We test is the selection in editable :
1861
 
            if(FireGPG_Selection.isEditable()) {
 
1873
            if(FireGPG.Selection.isEditable()) {
1862
1874
                //If yes, we edit this selection with the new text
1863
 
                FireGPG_Selection.set(result.output,returnObject.signresulttext);
 
1875
                FireGPG.Selection.set(result.output,returnObject.signresulttext);
1864
1876
            }  else {
1865
1877
                //Else, we show a windows with the result
1866
 
                FireGPGMisc.showText(result.output,undefined,undefined,undefined,returnObject.signresulttext);
 
1878
                FireGPG.Misc.showText(result.output,undefined,undefined,undefined,returnObject.signresulttext);
1867
1879
            }
1868
1880
        }
1869
1881
 
1873
1885
 
1874
1886
        returnObject.decrypted = result.output;
1875
1887
 
1876
 
        returnObject.result = FireGPGResults.SUCCESS;
 
1888
        returnObject.result = FireGPG.Const.Results.SUCCESS;
1877
1889
        return returnObject;
1878
1890
    } catch (e) { alert(e) }
1879
1891
        },
1891
1903
                //Find the right command for Gpg
1892
1904
                this.FireGPGGPGAccess.tryToFoundTheRightCommand();
1893
1905
 
1894
 
                useGPGAgent = this.FireGPGGPGAccess.runATest('--no-use-agent');
1895
 
                FireGPG_useGPGTrust = this.FireGPGGPGAccess.runATest('--trust-model always');
 
1906
                // ???
 
1907
        var useGPGAgent = this.FireGPGGPGAccess.runATest('--no-use-agent');
 
1908
 
 
1909
        FireGPG.useGPGTrust = this.FireGPGGPGAccess.runATest('--trust-model always');
1896
1910
 
1897
1911
                this.allreadyinit = true;
1898
1912
        },
1903
1917
        Function: selfTest
1904
1918
        This if are able to access to a GnuPG executable
1905
1919
 
1906
 
        Return a <FireGPG_GPGReturn> object.
 
1920
        Return a <FireGPG.GPGReturn> object.
1907
1921
 
1908
1922
        Parameters:
1909
1923
            slient - _Optional_, default to false. Set this to true to disable any alert for the user
1921
1935
                        if (!silent)
1922
1936
                alert(i18n.getString("selfTestFailled"));
1923
1937
 
1924
 
            var returnObject = new FireGPG_GPGReturn();
 
1938
            var returnObject = new FireGPG.GPGReturn();
1925
1939
            returnObject.messagetext = i18n.getString("selfTestFailled");
1926
 
            returnObject.result = FireGPGResults.ERROR_INIT_FAILLED;
 
1940
            returnObject.result = FireGPG.Const.Results.ERROR_INIT_FAILLED;
1927
1941
            return returnObject;
1928
1942
                }
1929
1943
 
1930
 
        var returnObject = new FireGPG_GPGReturn();
1931
 
        returnObject.result = FireGPGResults.SUCCESS;
 
1944
        var returnObject = new FireGPG.GPGReturn();
 
1945
        returnObject.result = FireGPG.Const.Results.SUCCESS;
1932
1946
        return returnObject;
1933
1947
        },
1934
1948
 
1942
1956
    */
1943
1957
    searchKeyInServer: function(search, silent) {
1944
1958
 
1945
 
                var returnObject = new FireGPG_GPGReturn();
 
1959
                var returnObject = new FireGPG.GPGReturn();
1946
1960
 
1947
1961
        if (silent == undefined)
1948
1962
            silent = false;
1961
1975
                    this.result == null;
1962
1976
                     // We get the result
1963
1977
                    try {
1964
 
                    this.result = this.FireGPGGPGAccess.searchKeyInServer(this.search,FireGPGMisc.getKeyServer());
 
1978
                    this.result = this.FireGPGGPGAccess.searchKeyInServer(this.search,FireGPG.Misc.getKeyServer());
1965
1979
                    } catch (e) { } //To be sure to close the wait_box
1966
1980
            }
1967
1981
          }
1982
1996
 
1983
1997
        wait_box.close();
1984
1998
 
1985
 
        result = backgroundTask.result;
 
1999
        var result = backgroundTask.result;
1986
2000
 
1987
2001
                // We get informations from GPG
1988
 
                result = FireGPGMisc.EnigConvertGpgToUnicode(result.sdOut);
 
2002
                result = FireGPG.Misc.EnigConvertGpgToUnicode(result.sdOut);
1989
2003
 
1990
2004
 
1991
2005
        returnObject.sdOut = result;
2033
2047
 
2034
2048
                    }
2035
2049
 
2036
 
                    var theKey = new FireGPG_GPGKey();
 
2050
                    var theKey = new FireGPG.GPGKey();
2037
2051
 
2038
2052
                    theKey.keyDate = keyDate;
2039
2053
                    theKey.keyExpi  = keyExpi;
2055
2069
 
2056
2070
 
2057
2071
                }
2058
 
                        } catch (e) { fireGPGDebug(e,'cgpg.searchKeyInServer',true);  }
 
2072
                        } catch (e) { FireGPG.debug(e,'cgpg.searchKeyInServer',true);  }
2059
2073
                }
2060
2074
 
2061
2075
        // Sorts keys
2062
 
        returnObject.keylist = returnObject.keylist.sort(FireGPG_Sortage);
 
2076
        returnObject.keylist = returnObject.keylist.sort(FireGPG.Sortage);
2063
2077
 
2064
2078
        for (var i = 0; i < returnObject.keylist.length; i++)
2065
 
            returnObject.keylist[i].subKeys = returnObject.keylist[i].subKeys.sort(FireGPG_Sortage);
 
2079
            returnObject.keylist[i].subKeys = returnObject.keylist[i].subKeys.sort(FireGPG.Sortage);
2066
2080
 
2067
 
        returnObject.result = FireGPGResults.SUCCESS;
 
2081
        returnObject.result = FireGPG.Const.Results.SUCCESS;
2068
2082
 
2069
2083
                return returnObject;
2070
2084
 
2074
2088
                alert(document.getElementById('firegpg-strings').
2075
2089
                getString('keyRecived'));
2076
2090
 
2077
 
            var returnObject = new FireGPG_GPGReturn();
 
2091
            var returnObject = new FireGPG.GPGReturn();
2078
2092
            returnObject.sdOut = result.sdOut;
2079
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2093
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2080
2094
            return returnObject;
2081
2095
 
2082
2096
        } else {
2085
2099
                alert(document.getElementById('firegpg-strings').
2086
2100
                getString('keyFetchError'));
2087
2101
 
2088
 
            var returnObject = new FireGPG_GPGReturn();
2089
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2102
            var returnObject = new FireGPG.GPGReturn();
 
2103
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2090
2104
            return returnObject;
2091
2105
        }*/
2092
2106
 
2108
2122
 
2109
2123
        this.initGPGACCESS();
2110
2124
 
2111
 
        keyId = FireGPGMisc.trim(keyId);
 
2125
        keyId = FireGPG.Misc.trim(keyId);
2112
2126
        keyId = keyId.replace(/\r/gi, "");
2113
2127
        keyId = keyId.replace(/\n/gi, "");
2114
2128
 
2123
2137
                    this.result == null;
2124
2138
                     // We get the result
2125
2139
                    try {
2126
 
                    this.result = this.FireGPGGPGAccess.retriveKeyFromServer(this.keyId,FireGPGMisc.getKeyServer());
 
2140
                    this.result = this.FireGPGGPGAccess.retriveKeyFromServer(this.keyId,FireGPG.Misc.getKeyServer());
2127
2141
                    } catch (e) { } //To be sure to close the wait_box
2128
2142
            }
2129
2143
          }
2144
2158
 
2145
2159
        wait_box.close();
2146
2160
 
2147
 
        result = backgroundTask.result;
 
2161
        var result = backgroundTask.result;
2148
2162
 
2149
2163
 
2150
2164
        if (result.sdOut.indexOf('IMPORT_OK') > 0) {
2151
2165
 
2152
 
            if (!silent)
2153
 
                alert(document.getElementById('firegpg-strings').
2154
 
                getString('keyRecived'));
2155
 
 
2156
 
            var returnObject = new FireGPG_GPGReturn();
 
2166
            if (!silent) {
 
2167
 
 
2168
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2169
                                       getService(Components.interfaces.nsIPrefService);
 
2170
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2171
 
 
2172
                var shutup  = false;
 
2173
                try {
 
2174
                    shutup = prefs.getBoolPref('hide_key_server_confirmation');
 
2175
                } catch (e) { shutup = false; }
 
2176
 
 
2177
                if (!shutup)
 
2178
                    alert(document.getElementById('firegpg-strings').
 
2179
                    getString('keyRecived'));
 
2180
 
 
2181
            }
 
2182
 
 
2183
            var returnObject = new FireGPG.GPGReturn();
2157
2184
            returnObject.sdOut = result.sdOut;
2158
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2185
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2159
2186
            return returnObject;
2160
2187
 
2161
2188
        } else {
2164
2191
                alert(document.getElementById('firegpg-strings').
2165
2192
                getString('keyFetchError') + '\n' + result.sdOut + '\n' + result.sdErr);
2166
2193
 
2167
 
            var returnObject = new FireGPG_GPGReturn();
2168
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2194
            var returnObject = new FireGPG.GPGReturn();
 
2195
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2169
2196
            return returnObject;
2170
2197
        }
2171
2198
 
2199
2226
                    this.result == null;
2200
2227
                     // We get the result
2201
2228
                    try {
2202
 
                    this.result = this.FireGPGGPGAccess.sendKeyToServer(this.keyId,FireGPGMisc.getKeyServer());
 
2229
                    this.result = this.FireGPGGPGAccess.sendKeyToServer(this.keyId,FireGPG.Misc.getKeyServer());
2203
2230
                    } catch (e) { } //To be sure to close the wait_box
2204
2231
            }
2205
2232
          }
2220
2247
 
2221
2248
        wait_box.close();
2222
2249
 
2223
 
        result = backgroundTask.result;
 
2250
        var result = backgroundTask.result;
2224
2251
 
2225
2252
        if (result.sdOut) {
2226
2253
 
2227
 
            if (!silent)
2228
 
                alert(result.sdOut);
2229
 
 
2230
 
            var returnObject = new FireGPG_GPGReturn();
 
2254
            if (!silent) {
 
2255
 
 
2256
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2257
                                       getService(Components.interfaces.nsIPrefService);
 
2258
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2259
 
 
2260
                var shutup  = false;
 
2261
                try {
 
2262
                    shutup = prefs.getBoolPref('hide_key_server_confirmation');
 
2263
                } catch (e) { shutup = false; }
 
2264
 
 
2265
                if (!shutup)
 
2266
                    alert(result.sdOut);
 
2267
            }
 
2268
 
 
2269
            var returnObject = new FireGPG.GPGReturn();
2231
2270
            returnObject.sdOut = result.sdOut;
2232
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2271
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2233
2272
            return returnObject;
2234
2273
 
2235
2274
        } else {
2238
2277
                alert(document.getElementById('firegpg-strings').getString('unknow-error'));
2239
2278
 
2240
2279
 
2241
 
            var returnObject = new FireGPG_GPGReturn();
2242
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2280
            var returnObject = new FireGPG.GPGReturn();
 
2281
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2243
2282
            return returnObject;
2244
2283
        }
2245
2284
 
2271
2310
                    this.result == null;
2272
2311
                     // We get the result
2273
2312
                    try {
2274
 
                    this.result = this.FireGPGGPGAccess.refrechFromServer(FireGPGMisc.getKeyServer());
 
2313
                    this.result = this.FireGPGGPGAccess.refrechFromServer(FireGPG.Misc.getKeyServer());
2275
2314
                    } catch (e) { } //To be sure to close the wait_box
2276
2315
            }
2277
2316
          }
2291
2330
 
2292
2331
        wait_box.close();
2293
2332
 
2294
 
        result = backgroundTask.result;
 
2333
        var result = backgroundTask.result;
2295
2334
 
2296
2335
        if (result.sdOut) {
2297
2336
 
2298
 
            if(!silent)
2299
 
                alert(document.getElementById('firegpg-strings').getString('keySync'));
2300
 
 
2301
 
            var returnObject = new FireGPG_GPGReturn();
 
2337
            if(!silent) {
 
2338
 
 
2339
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2340
                                       getService(Components.interfaces.nsIPrefService);
 
2341
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2342
 
 
2343
                var shutup  = false;
 
2344
                try {
 
2345
                    shutup = prefs.getBoolPref('hide_key_server_confirmation');
 
2346
                } catch (e) { shutup = false; }
 
2347
 
 
2348
                if (!shutup)
 
2349
                    alert(document.getElementById('firegpg-strings').getString('keySync'));
 
2350
            }
 
2351
 
 
2352
            var returnObject = new FireGPG.GPGReturn();
2302
2353
            returnObject.sdOut = result.sdOut;
2303
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2354
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2304
2355
            return returnObject;
2305
2356
 
2306
2357
        } else {
2307
 
            var returnObject = new FireGPG_GPGReturn();
2308
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2358
            var returnObject = new FireGPG.GPGReturn();
 
2359
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2309
2360
            return returnObject;
2310
2361
        }
2311
2362
 
2336
2387
 
2337
2388
        if (result.sdOut) {
2338
2389
 
2339
 
            if(!silent)
2340
 
                alert(document.getElementById('firegpg-strings').getString('trustChanged'));
2341
 
 
2342
 
            var returnObject = new FireGPG_GPGReturn();
 
2390
            if(!silent) {
 
2391
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2392
                                       getService(Components.interfaces.nsIPrefService);
 
2393
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2394
 
 
2395
                var shutup  = false;
 
2396
                try {
 
2397
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2398
                } catch (e) { shutup = false; }
 
2399
 
 
2400
                if (!shutup)
 
2401
                    alert(document.getElementById('firegpg-strings').getString('trustChanged'));
 
2402
            }
 
2403
 
 
2404
            var returnObject = new FireGPG.GPGReturn();
2343
2405
            returnObject.sdOut = result.sdOut;
2344
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2406
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2345
2407
            return returnObject;
2346
2408
 
2347
2409
        } else {
2351
2413
 
2352
2414
 
2353
2415
 
2354
 
            var returnObject = new FireGPG_GPGReturn();
2355
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2416
            var returnObject = new FireGPG.GPGReturn();
 
2417
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2356
2418
            return returnObject;
2357
2419
        }
2358
2420
 
2381
2443
 
2382
2444
        if (oldpass == undefined) {
2383
2445
 
2384
 
            oldpass = FireGPGMisc.getPrivateKeyPassword(false, false, i18n.getString("oldPassword"), true);
 
2446
            oldpass = FireGPG.Misc.getPrivateKeyPassword(false, false, i18n.getString("oldPassword"), true);
2385
2447
 
2386
2448
            if(oldpass == null) {
2387
 
                var returnObject = new FireGPG_GPGReturn();
2388
 
                returnObject.result = FireGPGResults.CANCEL;
 
2449
                var returnObject = new FireGPG.GPGReturn();
 
2450
                returnObject.result = FireGPG.Const.Results.CANCEL;
2389
2451
                return returnObject;
2390
2452
            }
2391
2453
 
2393
2455
 
2394
2456
        if (newpass == undefined) {
2395
2457
 
2396
 
            newpass = FireGPGMisc.getPrivateKeyPassword(false, false, i18n.getString("newPassword"), true);
2397
 
            newpass2 = FireGPGMisc.getPrivateKeyPassword(false, false, i18n.getString("newPassword2"), false);
 
2458
            newpass = FireGPG.Misc.getPrivateKeyPassword(false, false, i18n.getString("newPassword"), true);
 
2459
            newpass2 = FireGPG.Misc.getPrivateKeyPassword(false, false, i18n.getString("newPassword2"), false);
2398
2460
 
2399
2461
            if(newpass == null) {
2400
 
                var returnObject = new FireGPG_GPGReturn();
2401
 
                returnObject.result = FireGPGResults.CANCEL;
 
2462
                var returnObject = new FireGPG.GPGReturn();
 
2463
                returnObject.result = FireGPG.Const.Results.CANCEL;
2402
2464
                return returnObject;
2403
2465
            }
2404
2466
 
2407
2469
                 if (!silent)
2408
2470
                    alert(i18n.getString("changeFailledPasswordDiff"));
2409
2471
 
2410
 
                var returnObject = new FireGPG_GPGReturn();
2411
 
                returnObject.result = FireGPGResults.CANCEL;
 
2472
                var returnObject = new FireGPG.GPGReturn();
 
2473
                returnObject.result = FireGPG.Const.Results.CANCEL;
2412
2474
                return returnObject;
2413
2475
            }
2414
2476
        }
2424
2486
 
2425
2487
            returnObject.messagetext = i18n.getString("changeFailledPassword");
2426
2488
 
2427
 
            FireGPGMisc.eraseSavedPassword();
 
2489
            FireGPG.Misc.eraseSavedPassword();
2428
2490
 
2429
 
            returnObject.result = FireGPGResults.ERROR_PASSWORD;
 
2491
            returnObject.result = FireGPG.Const.Results.ERROR_PASSWORD;
2430
2492
            return returnObject;
2431
2493
                }
2432
2494
 
2433
2495
        //On assume que c'est ok
2434
2496
 
2435
 
        if(!silent)
2436
 
            alert(document.getElementById('firegpg-strings').getString('passChanged'));
2437
 
 
2438
 
        var returnObject = new FireGPG_GPGReturn();
 
2497
        if(!silent)  {
 
2498
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2499
                                       getService(Components.interfaces.nsIPrefService);
 
2500
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2501
 
 
2502
                var shutup  = false;
 
2503
                try {
 
2504
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2505
                } catch (e) { shutup = false; }
 
2506
 
 
2507
                if (!shutup)
 
2508
                 alert(document.getElementById('firegpg-strings').getString('passChanged'));
 
2509
        }
 
2510
 
 
2511
        var returnObject = new FireGPG.GPGReturn();
2439
2512
        returnObject.sdOut = result.sdOut;
2440
 
        returnObject.result = FireGPGResults.SUCCESS;
 
2513
        returnObject.result = FireGPG.Const.Results.SUCCESS;
2441
2514
        return returnObject;
2442
2515
 
2443
2516
 
2474
2547
            if(!silent)
2475
2548
                alert(i18n.getString("need-name"));
2476
2549
 
2477
 
            var returnObject = new FireGPG_GPGReturn();
2478
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2550
            var returnObject = new FireGPG.GPGReturn();
 
2551
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2479
2552
            return returnObject;
2480
2553
        }
2481
2554
 
2482
2555
        if (email == "") {
2483
2556
            if(!silent)
2484
2557
                alert(i18n.getString("need-email"));
2485
 
            var returnObject = new FireGPG_GPGReturn();
2486
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2558
            var returnObject = new FireGPG.GPGReturn();
 
2559
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2487
2560
            return returnObject;
2488
2561
        }
2489
2562
 
2490
2563
        if (password1 == "") {
2491
2564
            if(!silent)
2492
2565
                alert(i18n.getString("need-password"));
2493
 
            var returnObject = new FireGPG_GPGReturn();
2494
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2566
            var returnObject = new FireGPG.GPGReturn();
 
2567
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2495
2568
            return returnObject;
2496
2569
        }
2497
2570
 
2498
2571
        if (password1 != password2) {
2499
2572
            if(!silent)
2500
2573
                alert(i18n.getString("changeFailledPasswordDiff"));
2501
 
            var returnObject = new FireGPG_GPGReturn();
2502
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2574
            var returnObject = new FireGPG.GPGReturn();
 
2575
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2503
2576
            return returnObject;
2504
2577
        }
2505
2578
 
2508
2581
            if (keyexpirevalue <= 0) {
2509
2582
                if(!silent)
2510
2583
                    alert(i18n.getString("need-expire-date"));
2511
 
                var returnObject = new FireGPG_GPGReturn();
2512
 
                returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2584
                var returnObject = new FireGPG.GPGReturn();
 
2585
                returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2513
2586
                return returnObject;
2514
2587
 
2515
2588
            }
2520
2593
 
2521
2594
        if (result.sdOut.indexOf("KEY_CREATED") != -1) {
2522
2595
 
2523
 
            if(!silent)
2524
 
                alert(document.getElementById('firegpg-strings').getString('keygenerated'));
2525
 
 
2526
 
            var returnObject = new FireGPG_GPGReturn();
 
2596
            if(!silent) {
 
2597
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2598
                                       getService(Components.interfaces.nsIPrefService);
 
2599
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2600
 
 
2601
                var shutup  = false;
 
2602
                try {
 
2603
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2604
                } catch (e) { shutup = false; }
 
2605
 
 
2606
                if (!shutup)
 
2607
                    alert(document.getElementById('firegpg-strings').getString('keygenerated'));
 
2608
            }
 
2609
 
 
2610
            var returnObject = new FireGPG.GPGReturn();
2527
2611
            returnObject.sdOut = result.sdOut;
2528
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2612
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2529
2613
            return returnObject;
2530
2614
 
2531
2615
        } else {
2533
2617
            if(!silent)
2534
2618
                alert(document.getElementById('firegpg-strings').getString('unknow-error'));
2535
2619
 
2536
 
            var returnObject = new FireGPG_GPGReturn();
2537
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2620
            var returnObject = new FireGPG.GPGReturn();
 
2621
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2538
2622
            return returnObject;
2539
2623
        }
2540
2624
 
2562
2646
                var result = this.FireGPGGPGAccess.deleteKey(key);
2563
2647
 
2564
2648
        //Assume it's worked (no error message)
2565
 
        if(!silent)
2566
 
            alert(document.getElementById('firegpg-strings').getString('key-deleted'));
2567
 
 
2568
 
        var returnObject = new FireGPG_GPGReturn();
 
2649
        if(!silent) {
 
2650
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2651
                                       getService(Components.interfaces.nsIPrefService);
 
2652
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2653
 
 
2654
                var shutup  = false;
 
2655
                try {
 
2656
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2657
                } catch (e) { shutup = false; }
 
2658
 
 
2659
                if (!shutup)
 
2660
                    alert(document.getElementById('firegpg-strings').getString('key-deleted'));
 
2661
        }
 
2662
 
 
2663
        var returnObject = new FireGPG.GPGReturn();
2569
2664
        returnObject.sdOut = result.sdOut;
2570
 
        returnObject.result = FireGPGResults.SUCCESS;
 
2665
        returnObject.result = FireGPG.Const.Results.SUCCESS;
2571
2666
        return returnObject;
2572
2667
 
2573
2668
        },
2590
2685
        this.initGPGACCESS();
2591
2686
 
2592
2687
        if (password == undefined || password == null) {
2593
 
            password = FireGPGMisc.getPrivateKeyPassword(false);
 
2688
            password = FireGPG.Misc.getPrivateKeyPassword(false);
2594
2689
        }
2595
2690
 
2596
2691
                if(password == null) {
2597
 
                        returnObject.result = FireGPGResults.CANCEL;
 
2692
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2598
2693
            return returnObject;
2599
2694
        }
2600
2695
 
2603
2698
 
2604
2699
        if (result.sdOut.indexOf("GOOD_PASSPHRASE") != -1) {
2605
2700
 
2606
 
            if(!silent)
2607
 
                alert(document.getElementById('firegpg-strings').getString('keyrevoked'));
2608
 
 
2609
 
            var returnObject = new FireGPG_GPGReturn();
 
2701
            if(!silent)  {
 
2702
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2703
                                       getService(Components.interfaces.nsIPrefService);
 
2704
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2705
 
 
2706
                var shutup  = false;
 
2707
                try {
 
2708
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2709
                } catch (e) { shutup = false; }
 
2710
 
 
2711
                if (!shutup)
 
2712
                    alert(document.getElementById('firegpg-strings').getString('keyrevoked'));
 
2713
            }
 
2714
 
 
2715
            var returnObject = new FireGPG.GPGReturn();
2610
2716
            returnObject.sdOut = result.sdOut;
2611
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2717
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2612
2718
            return returnObject;
2613
2719
 
2614
2720
        } else {
2616
2722
            if(!silent)
2617
2723
                alert(document.getElementById('firegpg-strings').getString('keynotrevokedpassword'));
2618
2724
 
2619
 
            FireGPGMisc.eraseSavedPassword();
 
2725
            FireGPG.Misc.eraseSavedPassword();
2620
2726
 
2621
 
            var returnObject = new FireGPG_GPGReturn();
2622
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2727
            var returnObject = new FireGPG.GPGReturn();
 
2728
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2623
2729
            return returnObject;
2624
2730
        }
2625
2731
 
2654
2760
            if (!silent)
2655
2761
                alert(document.getElementById('firegpg-strings').getString('nameTooShort'));
2656
2762
 
2657
 
                        returnObject.result = FireGPGResults.CANCEL;
 
2763
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2658
2764
            return returnObject;
2659
2765
        }
2660
2766
 
2669
2775
            if (!silent)
2670
2776
                alert(document.getElementById('firegpg-strings').getString('wrongEmail'));
2671
2777
 
2672
 
                        returnObject.result = FireGPGResults.CANCEL;
 
2778
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2673
2779
            return returnObject;
2674
2780
        }
2675
2781
 
2681
2787
         this.initGPGACCESS();
2682
2788
 
2683
2789
        if (password == undefined || password == null) {
2684
 
            password = FireGPGMisc.getPrivateKeyPassword(false);
 
2790
            password = FireGPG.Misc.getPrivateKeyPassword(false);
2685
2791
        }
2686
2792
 
2687
2793
                if(password == null) {
2688
 
                        returnObject.result = FireGPGResults.CANCEL;
 
2794
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2689
2795
            return returnObject;
2690
2796
        }
2691
2797
 
2693
2799
 
2694
2800
        if (result.sdOut.indexOf("GOOD_PASSPHRASE") != -1) {
2695
2801
 
2696
 
            if(!silent)
2697
 
                alert(document.getElementById('firegpg-strings').getString('uidadded'));
2698
 
 
2699
 
            var returnObject = new FireGPG_GPGReturn();
 
2802
            if(!silent)  {
 
2803
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2804
                                       getService(Components.interfaces.nsIPrefService);
 
2805
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2806
 
 
2807
                var shutup  = false;
 
2808
                try {
 
2809
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2810
                } catch (e) { shutup = false; }
 
2811
 
 
2812
                if (!shutup)
 
2813
                    alert(document.getElementById('firegpg-strings').getString('uidadded'));
 
2814
            }
 
2815
 
 
2816
            var returnObject = new FireGPG.GPGReturn();
2700
2817
            returnObject.sdOut = result.sdOut;
2701
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2818
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2702
2819
            return returnObject;
2703
2820
 
2704
2821
        } else {
2706
2823
            if(!silent)
2707
2824
                alert(document.getElementById('firegpg-strings').getString('uidnotadded'));
2708
2825
 
2709
 
            FireGPGMisc.eraseSavedPassword();
 
2826
            FireGPG.Misc.eraseSavedPassword();
2710
2827
 
2711
 
            var returnObject = new FireGPG_GPGReturn();
2712
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2828
            var returnObject = new FireGPG.GPGReturn();
 
2829
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2713
2830
            return returnObject;
2714
2831
        }
2715
2832
    },
2732
2849
        this.initGPGACCESS();
2733
2850
 
2734
2851
        if (password == undefined || password == null) {
2735
 
            password = FireGPGMisc.getPrivateKeyPassword(false);
 
2852
            password = FireGPG.Misc.getPrivateKeyPassword(false);
2736
2853
        }
2737
2854
 
2738
2855
                if(password == null) {
2739
 
                        returnObject.result = FireGPGResults.CANCEL;
 
2856
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2740
2857
            return returnObject;
2741
2858
        }
2742
2859
 
2745
2862
 
2746
2863
        if (result.sdOut.indexOf("GOOD_PASSPHRASE") != -1) {
2747
2864
 
2748
 
            if(!silent)
2749
 
                alert(document.getElementById('firegpg-strings').getString('uidrevoked'));
2750
 
 
2751
 
            var returnObject = new FireGPG_GPGReturn();
 
2865
            if(!silent) {
 
2866
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2867
                                       getService(Components.interfaces.nsIPrefService);
 
2868
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2869
 
 
2870
                var shutup  = false;
 
2871
                try {
 
2872
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2873
                } catch (e) { shutup = false; }
 
2874
 
 
2875
                if (!shutup)
 
2876
                    alert(document.getElementById('firegpg-strings').getString('uidrevoked'));
 
2877
            }
 
2878
 
 
2879
            var returnObject = new FireGPG.GPGReturn();
2752
2880
            returnObject.sdOut = result.sdOut;
2753
 
            returnObject.result = FireGPGResults.SUCCESS;
 
2881
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2754
2882
            return returnObject;
2755
2883
 
2756
2884
        } else {
2758
2886
            if(!silent)
2759
2887
                alert(document.getElementById('firegpg-strings').getString('uidnotrevokedpassword'));
2760
2888
 
2761
 
            FireGPGMisc.eraseSavedPassword();
 
2889
            FireGPG.Misc.eraseSavedPassword();
2762
2890
 
2763
 
            var returnObject = new FireGPG_GPGReturn();
2764
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2891
            var returnObject = new FireGPG.GPGReturn();
 
2892
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2765
2893
            return returnObject;
2766
2894
        }
2767
2895
 
2790
2918
                var result = this.FireGPGGPGAccess.delUid(key, uid);
2791
2919
 
2792
2920
        //Assume it's worked
2793
 
        if(!silent)
2794
 
            alert(document.getElementById('firegpg-strings').getString('uiddeleted'));
2795
 
 
2796
 
        var returnObject = new FireGPG_GPGReturn();
 
2921
        if(!silent)  {
 
2922
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
2923
                                       getService(Components.interfaces.nsIPrefService);
 
2924
                    prefs = prefs.getBranch('extensions.firegpg.');
 
2925
 
 
2926
                var shutup  = false;
 
2927
                try {
 
2928
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
2929
                } catch (e) { shutup = false; }
 
2930
 
 
2931
                if (!shutup)
 
2932
                    alert(document.getElementById('firegpg-strings').getString('uiddeleted'));
 
2933
        }
 
2934
 
 
2935
        var returnObject = new FireGPG.GPGReturn();
2797
2936
        returnObject.sdOut = result.sdOut;
2798
 
        returnObject.result = FireGPGResults.SUCCESS;
 
2937
        returnObject.result = FireGPG.Const.Results.SUCCESS;
2799
2938
        return returnObject;
2800
2939
 
2801
2940
 
2823
2962
 
2824
2963
        // Needed for a sign
2825
2964
                if (keyForSign == undefined || keyForSign == null) {
2826
 
            keyForSign = FireGPGMisc.getSelfKey();
 
2965
            keyForSign = FireGPG.Misc.getSelfKey();
2827
2966
        }
2828
2967
 
2829
2968
        if(keyForSign == null) {
2830
 
            returnObject.result = FireGPGResults.CANCEL;
 
2969
            returnObject.result = FireGPG.Const.Results.CANCEL;
2831
2970
            return returnObject;
2832
2971
        }
2833
2972
 
2834
2973
                if (password == undefined || password == null) {
2835
 
            password = FireGPGMisc.getPrivateKeyPassword();
 
2974
            password = FireGPG.Misc.getPrivateKeyPassword();
2836
2975
        }
2837
2976
 
2838
2977
                if(password == null) {
2839
 
                        returnObject.result = FireGPGResults.CANCEL;
 
2978
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2840
2979
            return returnObject;
2841
2980
        }
2842
2981
 
2850
2989
            if(!silent)
2851
2990
                alert(document.getElementById('firegpg-strings').getString('erroralreadysigned'));
2852
2991
 
2853
 
            var returnObject = new FireGPG_GPGReturn();
2854
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
2992
            var returnObject = new FireGPG.GPGReturn();
 
2993
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2855
2994
            return returnObject;
2856
2995
 
2857
2996
 
2858
2997
        }
2859
2998
        else if (result.sdOut.indexOf("GOOD_PASSPHRASE") != -1) {
2860
2999
 
2861
 
            if(!silent)
2862
 
                alert(document.getElementById('firegpg-strings').getString('okkeysigned'));
2863
 
 
2864
 
            var returnObject = new FireGPG_GPGReturn();
 
3000
            if(!silent)  {
 
3001
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].
 
3002
                                       getService(Components.interfaces.nsIPrefService);
 
3003
                    prefs = prefs.getBranch('extensions.firegpg.');
 
3004
 
 
3005
                var shutup  = false;
 
3006
                try {
 
3007
                    shutup = prefs.getBoolPref('hide_key_operation_confirmation');
 
3008
                } catch (e) { shutup = false; }
 
3009
 
 
3010
                if (!shutup)
 
3011
                    alert(document.getElementById('firegpg-strings').getString('okkeysigned'));
 
3012
            }
 
3013
 
 
3014
            var returnObject = new FireGPG.GPGReturn();
2865
3015
            returnObject.sdOut = result.sdOut;
2866
 
            returnObject.result = FireGPGResults.SUCCESS;
 
3016
            returnObject.result = FireGPG.Const.Results.SUCCESS;
2867
3017
            return returnObject;
2868
3018
 
2869
3019
        } else {
2871
3021
            if(!silent)
2872
3022
                alert(document.getElementById('firegpg-strings').getString('errorkeynosignedpassword'));
2873
3023
 
2874
 
            FireGPGMisc.eraseSavedPassword();
 
3024
            FireGPG.Misc.eraseSavedPassword();
2875
3025
 
2876
 
            var returnObject = new FireGPG_GPGReturn();
2877
 
            returnObject.result = FireGPGResults.ERROR_UNKNOW;
 
3026
            var returnObject = new FireGPG.GPGReturn();
 
3027
            returnObject.result = FireGPG.Const.Results.ERROR_UNKNOW;
2878
3028
            return returnObject;
2879
3029
        }
2880
3030
 
2897
3047
 
2898
3048
        this.initGPGACCESS();
2899
3049
 
2900
 
        var returnObject = new FireGPG_GPGReturn();
 
3050
        var returnObject = new FireGPG.GPGReturn();
2901
3051
 
2902
3052
        //This values must be given ...
2903
3053
        if(hash == null || hash == undefined) {
2904
 
                        returnObject.result = FireGPGResults.CANCEL;
 
3054
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2905
3055
            return returnObject;
2906
3056
        }
2907
3057
 
2908
3058
        if(file == null || file == undefined) {
2909
 
                        returnObject.result = FireGPGResults.CANCEL;
 
3059
                        returnObject.result = FireGPG.Const.Results.CANCEL;
2910
3060
            return returnObject;
2911
3061
        }
2912
3062
 
2935
3085
        while (backgroundTask.result == null)
2936
3086
          thread.processNextEvent(true);
2937
3087
 
2938
 
        result = backgroundTask.result;
 
3088
        var result = backgroundTask.result;
2939
3089
 
2940
3090
        tmpHash = result.sdOut;
2941
3091
        tmpHash = tmpHash.substring(tmpHash.lastIndexOf(':') + 1, tmpHash.length);
2945
3095
        if (!silent)
2946
3096
            alert(tmpHash);
2947
3097
 
2948
 
        returnObject.result = FireGPGResults.SUCCESS;
 
3098
        returnObject.result = FireGPG.Const.Results.SUCCESS;
2949
3099
        returnObject.sdOut = result.sdOut;
2950
3100
        returnObject.output = tmpHash;
2951
3101
 
2952
3102
        return returnObject;
2953
3103
 
 
3104
    },
 
3105
 
 
3106
    /*
 
3107
    Function: loadFireGPGAccess
 
3108
 
 
3109
    This function will determing and 'build' the class to access gpg.
 
3110
 
 
3111
    She test if the xpcom is usable, update information about the status, and select the rights function to access to gnupg as the current situtation.
 
3112
 
 
3113
    She set  the FireGPGGPGAccess class.
 
3114
 
 
3115
    */
 
3116
    loadFireGPGAccess: function() {
 
3117
 
 
3118
        if (FireGPG.loadXpcom()) {
 
3119
 
 
3120
            if (FireGPG.GPGAccess.isUnix()) {
 
3121
 
 
3122
                FireGPG.GPGAccess.tryToFoundTheRightCommand = FireGPG.GPGAccess.UnixXpcom.tryToFoundTheRightCommand;
 
3123
 
 
3124
            } else {
 
3125
 
 
3126
                FireGPG.GPGAccess.tryToFoundTheRightCommand = FireGPG.GPGAccess.WindowsXpcom.tryToFoundTheRightCommand;
 
3127
 
 
3128
            }
 
3129
 
 
3130
            this.FireGPGGPGAccess = FireGPG.GPGAccess;
 
3131
 
 
3132
        } else {
 
3133
 
 
3134
            var i18n = document.getElementById("firegpg-strings");
 
3135
            alert(i18n.getString('noipc2'));
 
3136
 
 
3137
            this.FireGPGGPGAccess = FireGPG.GPGAccess;
 
3138
        }
 
3139
 
2954
3140
    }
2955
3141
 
2956
3142
}
2957
3143
 
2958
3144
 
2959
3145
 
2960
 
var FireGPG_okWait; // ???
 
3146
FireGPG.okWait = null; // ???
2961
3147
 
2962
3148
// We load the good class for the OS
2963
 
FireGPG.FireGPGGPGAccess = Witch_FireGPGGPGAccess();
2964
 
FireGPG.FireGPGGPGAccess.parent = FireGPG;
 
3149
//FireGPG.Core.FireGPGGPGAccess = Witch_FireGPGGPGAccess();
 
3150
FireGPG.Core.loadFireGPGAccess()
 
3151
FireGPG.Core.FireGPGGPGAccess.parent = FireGPG;
2965
3152
 
2966
3153
//Test if we have to show the 'what is new ?'
2967
3154
//We wait 3 sec.
2968
 
setTimeout("FireGPGMisc.testIfSomethingsIsNew()",3000);
 
3155
setTimeout("FireGPG.Misc.testIfSomethingsIsNew()",3000);