| misc.js | |
| Constants | |
| FireGPG. | The current version of FireGPG |
| FireGPG. | The current verion of FireGPG without dots |
| FireGPG. | The status of the FireGPG’s code. |
| FireGPG. | The current subversion’s revision number, for this file ! |
| Functions | |
| FireGPG. | Check if debuggin is enabled and if yes show up messages in console |
| Constants | |
| Id for components. | |
| Tempory files | |
| Write modes for files. | |
| Variables | |
| savedPassword | The password of the private key, saved for later actions. |
| oldKeyID | The previous key selected. |
| updateAvailable | True if an update of FireGPG is available |
| Functions | |
| choosePublicKey | Show a dialog (list.xul) to choose a list of public keys (array). |
| choosePrivateKey | Show a dialog (list.xul) to choose a private key. |
| showText | Show ‘text’ in a dialog (the editor) |
| showEditor | Open the editor (the showtext.xul dialog) |
| getPassword | Show the generic dialog to get a password. |
| savePassword | |
| getSavedPassword | |
| getPrivateKeyPassword | This uses getPassword:function () to get a password for a private key. |
| getsavedPassword | Return the saved password |
| eraseSavedPassword | This erase the saved password :function (it’s for exemple when a sign failled) |
| getSelfKey | who return a private key for the user :function (the default or the one selected in the list) null is returned if no key is selected. |
| getTmpDir | Get the path of a tmp file. |
| getTmpFile | Get an unique temporary file name. |
| removeFile | Delete a file. |
| fileExist | Return true if a file exist |
| putIntoFile | Save data to a file. |
| getFromFile | Get the content of a file |
| putIntoBinFile | Save data to a file, in binary mode. |
| getBinContent | Get the content of a binary file |
| getContent | Get the content of a resource form anywhere (like chrome://) |
| getContentXtttp | Get the content of a web resource by using a xmlhttprequest. |
| testIfSomethingsIsNew | Test if user update FireGPG or if he have to update, and show the What is new page send a ping or propose to update FireGPG if relevant. |
| showUpdateDialog | Show the update dialog to let user update FireGPG |
| htmlEncode | Encode special chars (&, <, > et “) to they html values. |
| gmailWrapping | This fuction approximates gmail’s line-wrapping rules, so that a message can be wrapped before it’s signed, instead of after, which would break the signature. |
| wrap | This function wraps a single line of text into multiple lines, each no longer than limit, unless a single word is too long. |
| genreate_api_key | Generate and random string between 64 and 128 charactes, probably unique. |
| trim | Remove extra space at the end and the begging of the string. |
| TrimAndWash | Remove extra space at the end and the begging of the string, and remove \n |
| EnigConvertGpgToUnicode | Convert the gpg --with-collums text (who are strangly encoded) into a uniform Unicode string. |
| EnigConvertToUnicode | Convert the text, in the specified chaset, into an Unicode string. |
| EnigConvertFromUnicode | Convert the text, in unicode, into an string in the specified chaset. |
| CreateTreeItemKey | Return a Treeitem for the key in parameter |
| CreateTreeItemKey2 | Return a Treeitem for the key in parameter |
| setSkinForKey | Set the correct class of a key, using his status (private, revoked) |
| CreateTreeItemKey3 | Return a Treeitem for the key in parameter |
| setSkinForKey2 | Set class for a node with the key attribute |
| getKeyServer | Return the current key server |
| showSearchBox | Show the dialog box to search key |
| convertCRLFToStandarts | Convert CR to CRLF, LF to CRLF and keep CRLF |
| dumper | This function was inspired by the print_r function of PHP. |
| dump2 | Show an array or an object in a console |
| UTF8 | Class to handle UTF8 tests. |
| Functions | |
| encode | Encode a text to utf8 |
| decode | Decode a utf8 text |
| Base64 | Class to handle base64 encoding http://www.webtoolkit.info/ |
| Variables | |
| _keyStr | Valid base64 chars |
| Functions | |
| encode | Encode to base6 |
| decode | Decode a base64 string |
| _utf8_encode | Encode a string to utf8 |
| _utf8_decode | Decode string from utf8 |
| pgpencode | Useless function who do nothing |
| getFileExtention | Return the extention of a file |
showText:function ( text, description, title, doShowButtons, validSign )
Show ‘text’ in a dialog (the editor)
| text | The text to show display |
| description | Optional. The message to show. If not set, use the default. |
| title | Optional. The title of the window. If not set, use the default. |
| doShowButtons | Optional. If we have to show buttons to encrypt and so. Default to false. |
| validSign | Optional. The message for the validSign field. |
getPassword:function ( question, save_password, domain, nosavecheckbox )
Show the generic dialog to get a password.
An object is returned : {password: “password”, save_password: true/false}$
null is returned if cancel button is clicked.
| question | The text to show for the prompt. |
| save_password | Optional. The default value for the save password checkbox. If not set, value set in the options by the user is used. |
| domain | Optional. Say the password is asked form this page and disable the savepassword checkbox. |
| nosavecheckbox | Optional. Disable the save password feature |
getPrivateKeyPassword:function ( useSavedPassword / * default = true */, domain / * default = false*/, message / * default = false*/, nosavecheckbox )
This uses getPassword:function () to get a password for a private key.
It’s the user request for it, it’s save the password for later.
If useSavedPassword = false, the password is asked each time, even if it’s already saved in the global variable savedPassword.
null is returned on error.
| useSavedPassword | Optional. Set this to false to disable the use of a saved password |
| domain | Optional. The domain to pass to getPassword. |
| message | Optional. The message to ask the user. |
| nosavecheckbox | Optional. Disable the save password feature |
getTmpFile:function ( permission /* optional * /, suffix_file )
Get an unique temporary file name. The path + filename is returned.
| permission | Optional. The permission of the file. See Write modes for files |
| suffix_file | Optional. A suffix to add to the default file name. |
Class to handle UTF8 tests. http://snippets.dzone.com/posts/show/5294
Class to handle base64 encoding http://www.webtoolkit.info/
| Variables | |
| _keyStr | Valid base64 chars |
| Functions | |
| encode | Encode to base6 |
| decode | Decode a base64 string |
| _utf8_encode | Encode a string to utf8 |
| _utf8_decode | Decode string from utf8 |
| pgpencode | Useless function who do nothing |
| getFileExtention | Return the extention of a file |
Check if debuggin is enabled and if yes show up messages in console
FireGPG.debug = function( message, debugCode, fatal )
Show a dialog (list.xul) to choose a list of public keys (array).
choosePublicKey: function( preSelect )
Show a dialog (list.xul) to choose a private key.
choosePrivateKey:function ( preSelect )
Show ‘text’ in a dialog (the editor)
showText:function ( text, description, title, doShowButtons, validSign )
Open the editor (the showtext.xul dialog)
showEditor:function ()
Show the generic dialog to get a password.
getPassword:function ( question, save_password, domain, nosavecheckbox )
savePassword:function ( password )
getSavedPassword:function ()
This uses getPassword:function () to get a password for a private key.
getPrivateKeyPassword:function ( useSavedPassword / * default = true */, domain / * default = false*/, message / * default = false*/, nosavecheckbox )
Return the saved password
getsavedPassword:function ()
This erase the saved password :function (it’s for exemple when a sign failled)
eraseSavedPassword:function ()
who return a private key for the user :function (the default or the one selected in the list) null is returned if no key is selected.
getSelfKey:function ( autoSelectPrivate )
Get the path of a tmp file.
getTmpDir:function ()
Get an unique temporary file name.
getTmpFile:function ( permission /* optional * /, suffix_file )
Delete a file.
removeFile:function ( path )
Return true if a file exist
fileExist:function ( path )
Save data to a file.
putIntoFile:function ( filename, data )
Get the content of a file
getFromFile:function ( filename, charset )
Save data to a file, in binary mode.
putIntoBinFile:function ( filename, data )
Get the content of a binary file
getBinContent:function ( aURL, maxData )
Get the content of a resource form anywhere (like chrome://)
getContent:function ( aURL )
Test if user update FireGPG or if he have to update, and show the What is new page send a ping or propose to update FireGPG if relevant.
testIfSomethingsIsNew:function ()
Show the update dialog to let user update FireGPG
showUpdateDialog:function ()
Encode special chars (&, <, > et “) to they html values.
htmlEncode:function ( s )
This fuction approximates gmail’s line-wrapping rules, so that a message can be wrapped before it’s signed, instead of after, which would break the signature.
gmailWrapping:function ( text )
This function wraps a single line of text into multiple lines, each no longer than limit, unless a single word is too long.
wrap:function ( text, limit )
Generate and random string between 64 and 128 charactes, probably unique.
genreate_api_key:function ()
Remove extra space at the end and the begging of the string.
trim :function ( str )
Remove extra space at the end and the begging of the string, and remove \n
TrimAndWash:function ( str )
Convert the gpg --with-collums text (who are strangly encoded) into a uniform Unicode string.
EnigConvertGpgToUnicode:function ( text )
Convert the text, in the specified chaset, into an Unicode string.
EnigConvertToUnicode:function ( text, charset )
Convert the text, in unicode, into an string in the specified chaset.
EnigConvertFromUnicode:function ( text, charset )
Return a Treeitem for the key in parameter
CreateTreeItemKey:function ( key, document, forceId )
Return a Treeitem for the key in parameter
CreateTreeItemKey2:function ( key, document, forceId, privateKey, subkey )
Set the correct class of a key, using his status (private, revoked)
setSkinForKey:function ( key, child, privateKey )
Return a Treeitem for the key in parameter
CreateTreeItemKey3:function ( key, document, mainKey, sign, havePrivate )
Set class for a node with the key attribute
setSkinForKey2:function ( key, child, mainKey, sign, havePrivate )
Return the current key server
getKeyServer:function ()
Show the dialog box to search key
showSearchBox:function ( autoSearch )
Convert CR to CRLF, LF to CRLF and keep CRLF
convertCRLFToStandarts:function ( text )
This function was inspired by the print_r function of PHP.
dumper:function ( arr, level )
Show an array or an object in a console
dump2:function ( o )
Encode a text to utf8
encode: function( s )
Decode a utf8 text
decode: function( s )
Valid base64 chars
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
Encode to base6
encode: function ( input, bMode )
Decode a base64 string
decode : function ( input, bMode )
Encode a string to utf8
_utf8_encode:function ( string )
Decode string from utf8
_utf8_decode :function ( utftext )
Useless function who do nothing
pgpencode: function( texte )
Return the extention of a file
getFileExtention:function ( filename )