home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December / PCWorld_2005-12_cd.bin / komunikace / netscape / nsb-install-8-0.exe / components / nsJSAimFileXferRendezvous.js < prev    next >
Text File  |  2005-09-26  |  2KB  |  73 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*
  3.  */
  4.  
  5. function nsJSAimFileXferRendezvous() {
  6.     // dump("creating new nsJSAimFileXferRendezvous\n");
  7. }
  8.  
  9. nsJSAimFileXferRendezvous.prototype = {
  10.     // we just implement one function!
  11.     OnProposalReceived : function (screenname, proposal)
  12.     {
  13.  
  14.      inviteArgsObj = {
  15.          inviteProposalScreenName: screenname, 
  16.          inviteProposalObj: proposal,
  17.          inviteMode: 'incomingfile'
  18.      }
  19.     
  20.      //var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  21.  
  22.      //var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  23.  
  24.      var windowManagerInterface = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
  25.      var topWindow = windowManagerInterface.getMostRecentWindow(null);
  26.  
  27.      
  28.      //topWindow.focus();
  29.      topWindow.openDialog('chrome://aim/content/incomingFile.xul','_blank','chrome,all,dialog=no',inviteArgsObj); 
  30.     
  31.     }
  32. }
  33.  
  34. var module = {
  35.     registerSelf: function (compMgr, fileSpec, location, type) {
  36.         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
  37.         compMgr.registerComponentWithType(this.myCID,
  38.             "nsJSAimFileXferRendezvous",
  39.                 "@netscape.com/js/aim/filexferrendezvous;1",
  40.                 fileSpec, location, true, true, type);
  41.     },
  42.  
  43.     getClassObject: function (compMgr, cid, iid) {
  44.         if (!cid.equals(this.myCID))
  45.             throw Components.results.NS_ERROR_NO_INTERFACE;
  46.         
  47.         if (!iid.equals(Components.interfaces.nsIFactory))
  48.             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  49.  
  50.         return this.myFactory;
  51.     },
  52.  
  53.     canUnload: function () {
  54.     },
  55.     
  56.     myCID: Components.ID("{98763432-2DC7-11d4-BA1A-0010833594E9}"),
  57.     
  58.     myFactory: {
  59.         createInstance: function (outer, iid) {
  60.             if (outer != null)
  61.                 throw Components.results.NS_ERROR_NO_AGGREGATION;
  62.             
  63.             if (!(iid.equals(Components.interfaces.nsIAimFileXferRendezvousCallback) || iid.equals(Components.interfaces.nsISupports))) {
  64.                 throw Components.results.NS_ERROR_INVALID_ARG;
  65.             }
  66.  
  67.             return new nsJSAimFileXferRendezvous();
  68.         }
  69.     }
  70. };
  71.  
  72. function NSGetModule(compMgr, fileSpec) { return module; }
  73.