home *** CD-ROM | disk | FTP | other *** search
- // Gmail Manager
- // By Todd Long <longfocus@gmail.com>
- // http://www.longfocus.com/firefox/gmanager/
-
- const GM_CC = Components.classes;
- const GM_CI = Components.interfaces;
-
- function gmService() {}
- gmService.prototype = {
- _type: null,
- _email: null,
- _password: null,
- _remember: null,
- _alias: null,
- _node: null,
- _prefs: null,
-
- get type() { return this._type; },
- get email() { return this._email; },
- get password() { return this._password; },
- get remember() { return this._remember; },
- get alias() { return this._alias; },
- get prefs() { return this._prefs; },
-
- set type(aType) { this._type = aType; },
- set email(aEmail) { this._email = aEmail; },
- set password(aPassword) { this._password = aPassword; },
- set remember(aRemember) { this._remember = aRemember; },
- set alias(aAlias) { this._alias = aAlias; },
- set prefs(aPrefs) { this._prefs = aPrefs; },
-
- getValue: function(aId)
- {
- return this._prefs[aId].value;
- },
-
- getBoolValue: function(aId)
- {
- return (this.getValue(aId) == "true" ? true : false);
- },
-
- getIntValue: function(aId)
- {
- return parseInt(this.getValue(aId));
- },
-
- QueryInterface: function(iid)
- {
- if (!iid.equals(GM_CI.gmIService) &&
- !iid.equals(GM_CI.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
- return this;
- }
- }
-
- var myModule = {
- firstTime: true,
-
- myCID: Components.ID("{4ed92670-fbb4-11da-974d-0800200c9a66}"),
- myDesc: "Mail account service",
- myProgID: "@longfocus.com/gmanager/service;1",
- myFactory: {
- createInstance: function (outer, iid) {
- if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
-
- return (new gmService()).QueryInterface(iid);
- }
- },
-
- registerSelf: function (compMgr, fileSpec, location, type)
- {
- if (this.firstTime) {
- this.firstTime = false;
- throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
- }
-
- compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
- compMgr.registerFactoryLocation(this.myCID, this.myDesc, this.myProgID, fileSpec, location, type);
- },
-
- getClassObject: function (compMgr, cid, iid)
- {
- if (!cid.equals(this.myCID))
- throw Components.results.NS_ERROR_NO_INTERFACE;
-
- if (!iid.equals(Components.interfaces.nsIFactory))
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
-
- return this.myFactory;
- },
-
- canUnload: function(compMgr) { return true; }
- };
-
- function NSGetModule(compMgr, fileSpec) { return myModule; }