home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / nim.xpi / bin / components / nsJSAimChatRendezvous.js < prev    next >
Text File  |  2001-04-16  |  4KB  |  119 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.     ChatInvite : function (roomname, screennamelist, msg)
  38.     {
  39.                 // XXX hardcoding en for now, we have no way of
  40.                 // determining what this might be from the URL 
  41.         inviteArgsObj = {
  42.                  invitedScreenNames: screennamelist, 
  43.                  inviteToExistingRoom: roomname,
  44.                  inviteLanguage: "en",
  45.             inviteToExistingWindow: false,
  46.                  inviteMode: 'outgoingchat',
  47.             invitationmsg: msg
  48.              }
  49.     
  50.         var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  51.  
  52.         var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  53.  
  54.         var topWindow = windowManagerInterface.getMostRecentWindow(null);
  55.         topWindow.openDialog('chrome://aim/content/chatInviteBuddy.xul','_blank','chrome,all,dialog=no',inviteArgsObj); 
  56.     },
  57.     
  58.     GoChat : function (roomname, exchange, instance)
  59.     {
  60.                 var language = "en";
  61.         chatContentArgsObj = {
  62.                  chatRoomName : roomname,
  63.                  chatLanguage : language,
  64.             incomingChat : false,
  65.             instance : instance,
  66.             exchange : exchange,
  67.             fromurl : true
  68.              }
  69.     
  70.         var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  71.  
  72.         var    windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  73.  
  74.         var topWindow = windowManagerInterface.getMostRecentWindow(null);
  75.  
  76.         topWindow.openDialog('chrome://aim/content/chatContent.xul','','chrome,all,dialog=no',chatContentArgsObj); 
  77.     }
  78.  
  79. }
  80.  
  81. var module = {
  82.     registerSelf: function (compMgr, fileSpec, location, type) {
  83.         compMgr.registerComponentWithType(this.myCID,
  84.             "nsJSAimChatRendezvous",
  85.                 "@netscape.com/js/aim/chatrendezvous;1",
  86.                 fileSpec, location, true, true, type);
  87.     },
  88.  
  89.     getClassObject: function (compMgr, cid, iid) {
  90.         if (!cid.equals(this.myCID))
  91.             throw Components.results.NS_ERROR_NO_INTERFACE;
  92.         
  93.         if (!iid.equals(Components.interfaces.nsIFactory))
  94.             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  95.  
  96.         return this.myFactory;
  97.     },
  98.  
  99.     canUnload: function () {
  100.     },
  101.     
  102.     myCID: Components.ID("{38E07345-2DC7-11d4-BA1A-0010833594E9}"),
  103.     
  104.     myFactory: {
  105.         createInstance: function (outer, iid) {
  106.             if (outer != null)
  107.                 throw Components.results.NS_ERROR_NO_AGGREGATION;
  108.             
  109.             if (!(iid.equals(Components.interfaces.nsIAimChatRendezvousCallback) || iid.equals(Components.interfaces.nsISupports))) {
  110.                 throw Components.results.NS_ERROR_INVALID_ARG;
  111.             }
  112.  
  113.             return new nsJSAimChatRendezvous();
  114.         }
  115.     }
  116. };
  117.  
  118. function NSGetModule(compMgr, fileSpec) { return module; }
  119.