home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / Chip_2001-05_cd2.bin / ChipCD / browsery / netscape601_eng / nim.xpi / bin / components / nsJSAimChatRendezvous.js < prev    next >
Encoding:
JavaScript  |  2000-09-13  |  2.5 KB  |  78 lines

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