Skip to content

Commit

Permalink
Compatibility with FF 1.5
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.getfiregpg.org/firegpg@114 1e1cc2a3-b62a-0410-bc93-fb3b3b0a0737
  • Loading branch information
theglu committed Mar 7, 2007
1 parent 6c4793a commit eaaeaad
Show file tree
Hide file tree
Showing 7 changed files with 349 additions and 19 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
2007-03-07 Maximilien Cuony
* Compatibility with FF 1.5


2007-03-06 Maximilien Cuony
* Implement a test for detect presence of GPG
* selectPublicKey implemented in cgpg
Expand Down
4 changes: 2 additions & 2 deletions content/cgpg.js
Expand Up @@ -317,7 +317,7 @@ var GPG = {
/*
* Function to import a public key.
*/
import: function() {
kimport: function() {

// For i18n
var i18n = document.getElementById("firegpg-strings");
Expand All @@ -343,7 +343,7 @@ var GPG = {
text = text.substring(firstPosition,lastPosition + ("-----END PGP PUBLIC KEY BLOCK-----").length);

// We get the result
var result = this.GPGAccess.import(text);
var result = this.GPGAccess.kimport(text);



Expand Down
43 changes: 34 additions & 9 deletions content/cgpglin.js
Expand Up @@ -41,7 +41,7 @@ const comment = "http://firegpg.tuxfamily.org";
* Class to access to GPG on GNU/Linux.
*/
var GPGLin = {
var: parent,
//var: parent,

/*
* Function to sign a text.
Expand All @@ -63,7 +63,7 @@ var GPGLin = {
putIntoFile(tmpRun,running);

runCommand(tmpRun,
"gpg " + tmpStdOut +
'' + this.getGPGCommand() + '' + " " + tmpStdOut +
" --quiet --no-tty --no-verbose --status-fd 1 --armor --batch" +
" --default-key " + keyID +
" --output " + tmpOutput +
Expand Down Expand Up @@ -104,7 +104,7 @@ var GPGLin = {
putIntoFile(tmpRun,running);

runCommand(tmpRun,
"gpg " + tmpStdOut +
'' + this.getGPGCommand() + '' + " " + tmpStdOut +
" --quiet --no-tty --no-verbose --status-fd 1 --armor" +
" --verify " + tmpInput);

Expand Down Expand Up @@ -138,7 +138,7 @@ var GPGLin = {
putIntoFile(tmpRun,running);

runCommand(tmpRun,
"gpg " + tmpStdOut +
'' + this.getGPGCommand() + '' + " " + tmpStdOut +
" --quiet --no-tty --no-verbose --status-fd 1 --armor --with-colons " + mode);

// We get the result
Expand Down Expand Up @@ -173,7 +173,7 @@ var GPGLin = {
putIntoFile(tmpRun,running);

runCommand(tmpRun,
"gpg " + tmpStdOut +
'' + this.getGPGCommand() + '' + " " + tmpStdOut +
" --quiet --no-tty --no-verbose --status-fd 1 --armor --batch" +
" -r " + keyID +
" --comment " + comment +
Expand Down Expand Up @@ -219,7 +219,7 @@ var GPGLin = {
putIntoFile(tmpRun,running);

runCommand(tmpRun,
"gpg " + tmpStdOut +
'' + this.getGPGCommand() + '' + " " + tmpStdOut +
" --quiet --no-tty --no-verbose --status-fd 1 --armor --batch" +
" --passphrase " + password +
" --output " + tmpOutput +
Expand Down Expand Up @@ -255,7 +255,7 @@ var GPGLin = {
putIntoFile(tmpRun,running);

runCommand(tmpRun,
"gpg " + tmpStdOut +
"" + this.getGPGCommand() + "" + " " + tmpStdOut +
" --quiet --no-tty --no-verbose --status-fd 1 --armor" +
" --version");

Expand All @@ -274,7 +274,7 @@ var GPGLin = {
},

// Import a key
import: function(text) {
kimport: function(text) {
var tmpInput = getTmpFile(); // Key
var tmpStdOut = getTmpFile(); // Output from gpg
var tmpRun = getTmpFileRunning();
Expand All @@ -287,7 +287,7 @@ var GPGLin = {
putIntoFile(tmpRun,running);

runCommand(tmpRun,
"gpg " + tmpStdOut +
'"' + this.getGPGCommand() + '"' + " " + tmpStdOut +
" --quiet --no-tty --no-verbose --status-fd 1 --armor" +
" --import " + tmpInput);

Expand All @@ -301,6 +301,31 @@ var GPGLin = {

// We return result
return result;
},

//Return the GPG's command to use
getGPGCommand: function () {

var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefService);
prefs = prefs.getBranch("extensions.firegpg.");

try {
var force = prefs.getBoolPref("specify_gpg_path");
}
catch (e) {
var force = false;
}

if (force == true)
return prefs.getCharPref("gpg_path");
else
{
prefs.setCharPref("gpg_path","gpg");
return "gpg";
}


}
};

Expand Down

0 comments on commit eaaeaad

Please sign in to comment.