home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Copy / Alcohol120_trial_1.9.8.7612.exe / $TEMP / free-downloads.xpi / components / ConduitToolbar.js < prev    next >
Text File  |  2009-01-15  |  3KB  |  87 lines

  1. const Cc = Components.classes;
  2. const Ci = Components.interfaces;
  3. const CONDUIT_TOOLBAR_COMPONENT_ID = Components.ID("{ecdee021-0d17-467f-a1ff-c7a115230949}");
  4.  
  5. function loadJSFile(strFileName, bIsFromLibrary)
  6. {
  7.     var oFile;
  8.     if(bIsFromLibrary)
  9.     {
  10.         oFile = __LOCATION__.clone().parent.parent;
  11.         oFile.append("lib");
  12.         oFile.append(strFileName);
  13.     }
  14.     else
  15.     {
  16.         oFile = __LOCATION__.clone().parent;
  17.         oFile.append(strFileName);
  18.     }
  19.     
  20.     var oFilePath = Cc["@mozilla.org/network/protocol;1?name=file"].getService(Ci.nsIFileProtocolHandler).getURLSpecFromFile(oFile);
  21.     Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader).loadSubScript(oFilePath);
  22. }
  23.  
  24. loadJSFile("xpcom.js", true);
  25.  
  26. //main component
  27. function ConduitToolbar() {
  28.     this.wrappedJSObject = this;
  29.     this.chat = ChatXPCOM;
  30.     this.truste = TrusteXPCOM;
  31.     
  32.     this.QueryInterface = function (uuid) {
  33.         if (uuid.equals(Components.interfaces.nsIConduitToolbar_CT1098640) ||
  34.             uuid.equals(Components.interfaces.nsISupports)) {
  35.             return this;
  36.         }
  37.  
  38.         Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
  39.         return null;
  40.     };
  41.     
  42.     this.init = function(strOriginalCTID, strCurrentCTID)
  43.     {
  44.         
  45.     };
  46. }
  47.  
  48. var ConduitToolbarModule = {
  49.     registerSelf: function (compMgr, fileSpec, location, type) {
  50.         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
  51.         compMgr.registerFactoryLocation(CONDUIT_TOOLBAR_COMPONENT_ID,
  52.                                         "Conduit toolbar object",
  53.                                         "@conduit.com/toolbar;1=CT1098640",
  54.                                         fileSpec,
  55.                                         location,
  56.                                         type);
  57.     },
  58.     
  59.     unregisterSelf: function(aCompMgr, aLocation, aLoaderStr){
  60.         
  61.     },
  62.  
  63.     getClassObject: function (compMgr, cid, iid) {
  64.         if (!cid.equals(CONDUIT_TOOLBAR_COMPONENT_ID))
  65.             throw Components.results.NS_ERROR_NO_INTERFACE;
  66.         if (!iid.equals(Components.interfaces.nsIFactory))
  67.             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  68.  
  69.         return ConduitToolbarFactory;
  70.     },
  71.  
  72.     canUnload: function(compMgr) {
  73.         return true;
  74.     }
  75. };
  76.  
  77. var ConduitToolbarFactory = {
  78.     createInstance: function (outer, iid) {
  79.         if (outer != null)
  80.             throw Components.results.NS_ERROR_NO_AGGREGATION;
  81.         return new ConduitToolbar().QueryInterface(iid);
  82.     }
  83. };
  84.  
  85. function NSGetModule(compMgr, fileSpec) {
  86.     return ConduitToolbarModule;
  87. }