2
* The contents of this file are subject to the Mozilla Public
3
* License Version 1.1 (the "MPL"); you may not use this file
4
* except in compliance with the MPL. You may obtain a copy of
5
* the MPL at http://www.mozilla.org/MPL/
7
* Software distributed under the MPL is distributed on an "AS
8
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
* implied. See the MPL for the specific language governing
10
* rights and limitations under the MPL.
12
* The Original Code is Enigmail.
14
* The Initial Developer of this code is Patrick Brunschwig.
15
* Portions created by Patrick Brunschwig <patrick.brunschwig@gmx.net> are
16
* Copyright (C) 2003 Patrick Brunschwig. All Rights Reserved.
20
* Alternatively, the contents of this file may be used under the
21
* terms of the GNU General Public License (the "GPL"), in which case
22
* the provisions of the GPL are applicable instead of
23
* those above. If you wish to allow use of your version of this
24
* file only under the terms of the GPL and not to allow
25
* others to use your version of this file under the MPL, indicate
26
* your decision by deleting the provisions above and replace them
27
* with the notice and other provisions required by the GPL.
28
* If you do not delete the provisions above, a recipient
29
* may use your version of this file under either the MPL or the
34
// components defined in this file
35
const ENIGMAIL_PREFS_EXTENSION_SERVICE_CONTRACTID =
36
"@mozilla.org/accountmanager/extension;1?name=enigprefs";
37
const ENIGMAIL_PREFS_EXTENSION_SERVICE_CID =
38
Components.ID("{847b3ab0-7ab1-11d4-8f02-006008948af5}");
40
// interafces used in this file
41
const nsIMsgAccountManagerExtension = Components.interfaces.nsIMsgAccountManagerExtension;
42
const nsICategoryManager = Components.interfaces.nsICategoryManager;
43
const nsISupports = Components.interfaces.nsISupports;
45
function EnigmailPrefService()
48
EnigmailPrefService.prototype.name = "enigprefs";
49
EnigmailPrefService.prototype.chromePackageName = "enigmail"
50
EnigmailPrefService.prototype.showPanel =
53
// show Enigmail panel for POP3, IMAP and NNTP account types
54
switch (server.type) {
63
// factory for command line handler service (EnigmailPrefService)
64
var EnigmailPrefFactory = new Object();
66
EnigmailPrefFactory.createInstance =
67
function (outer, iid) {
69
throw Components.results.NS_ERROR_NO_AGGREGATION;
71
if (!iid.equals(nsIMsgAccountManagerExtension) && !iid.equals(nsISupports))
72
throw Components.results.NS_ERROR_INVALID_ARG;
74
return new EnigmailPrefService();
78
var EnigmailPrefsModule = new Object();
80
EnigmailPrefsModule.registerSelf =
81
function (compMgr, fileSpec, location, type)
83
dump("Registering Enigmail account manager extension.\n");
85
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
86
compMgr.registerFactoryLocation(ENIGMAIL_PREFS_EXTENSION_SERVICE_CID,
87
"Enigmail Account Manager Extension Service",
88
ENIGMAIL_PREFS_EXTENSION_SERVICE_CONTRACTID,
92
catman = Components.classes["@mozilla.org/categorymanager;1"].getService(nsICategoryManager);
93
catman.addCategoryEntry("mailnews-accountmanager-extensions",
94
"Enigmail account manager extension",
95
ENIGMAIL_PREFS_EXTENSION_SERVICE_CONTRACTID, true, true);
96
dump("Enigmail account manager extension registered.\n");
99
EnigmailPrefsModule.unregisterSelf =
100
function(compMgr, fileSpec, location)
102
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
103
compMgr.unregisterFactoryLocation(ENIGMAIL_PREFS_EXTENSION_SERVICE_CID, fileSpec);
104
catman = Components.classes["@mozilla.org/categorymanager;1"].getService(nsICategoryManager);
105
catman.deleteCategoryEntry("mailnews-accountmanager-extensions",
106
ENIGMAIL_PREFS_EXTENSION_SERVICE_CONTRACTID, true);
109
EnigmailPrefsModule.getClassObject =
110
function (compMgr, cid, iid) {
111
if (cid.equals(ENIGMAIL_PREFS_EXTENSION_SERVICE_CID))
112
return EnigmailPrefFactory;
115
if (!iid.equals(Components.interfaces.nsIFactory))
116
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
118
throw Components.results.NS_ERROR_NO_INTERFACE;
121
EnigmailPrefsModule.canUnload =
128
function NSGetModule(compMgr, fileSpec) {
129
return EnigmailPrefsModule;