home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 December / PCWorld_2005-12_cd.bin / komunikace / netscape / nsb-install-8-0.exe / components / nsJSAimChatRendezvous.js < prev    next >
Text File  |  2005-09-26  |  5KB  |  144 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.     OnBuddyIconProposalReceived : function (screenname, proposal)
  13.     {
  14.  
  15.      inviteArgsObj = {
  16.          inviteProposalScreenName: screenname, 
  17.          inviteProposalObj: proposal,
  18.          invitedScreenNames: '',
  19.          inviteToExistingWindow: false,
  20.          inviteMode: 'incomingchat'
  21.      }
  22.     
  23.      //var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  24.  
  25.      //var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  26.      var windowManagerInterface = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
  27.      var topWindow = windowManagerInterface.getMostRecentWindow(null);
  28.  
  29.      //topWindow.focus();
  30.      topWindow.openDialog('chrome://aim/content/IMBuddyIconKnockKnock.xul','','modal=yes,titlebar,chrome,dialog=yes, centerscreen',inviteArgsObj);
  31.     
  32.     },
  33.  
  34.     OnProposalReceived : function (screenname, proposal)
  35.     {
  36.  
  37.      dump ("got a proposal from " + screenname + "\n");
  38.  
  39.      inviteArgsObj = {
  40.          inviteProposalScreenName: screenname, 
  41.          inviteProposalObj: proposal,
  42.          invitedScreenNames: '',
  43.          inviteToExistingWindow: false,
  44.          inviteMode: 'incomingchat'
  45.      }
  46.     
  47.      //var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  48.  
  49.      //var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  50.  
  51.      var windowManagerInterface = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
  52.      var topWindow = windowManagerInterface.getMostRecentWindow(null);
  53.  
  54.      //topWindow.focus();
  55.      topWindow.openDialog('chrome://aim/content/chatInviteBuddy.xul','_blank','chrome,all,dialog=no',inviteArgsObj); 
  56.     
  57.     },
  58.  
  59.     ChatInvite : function (roomname, language, screennamelist, msg)
  60.     {
  61.     // XXX hardcoding en for now, we have no way of
  62.     // determining what this might be from the URL 
  63.         inviteArgsObj = {
  64.       invitedScreenNames: screennamelist, 
  65.          inviteToExistingRoom: roomname,
  66.          inviteLanguage: "en",
  67.             inviteToExistingWindow: false,
  68.          inviteMode: 'outgoingchat',
  69.             invitationmsg: msg
  70.   }
  71.     
  72.         //var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  73.  
  74.         //var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  75.  
  76.     var windowManagerInterface = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
  77.         var topWindow = windowManagerInterface.getMostRecentWindow(null);
  78.         topWindow.openDialog('chrome://aim/content/chatInviteBuddy.xul','_blank','chrome,all,dialog=no',inviteArgsObj); 
  79.     },
  80.     
  81.     GoChat : function (roomname, exchange, instance)
  82.     {
  83.                 var language = "en";
  84.         chatContentArgsObj = {
  85.                  chatRoomName : roomname,
  86.                  chatLanguage : language,
  87.             incomingChat : false,
  88.             instance : instance,
  89.             exchange : exchange,
  90.             fromurl : true
  91.              }
  92.     
  93.         //var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
  94.  
  95.         //var    windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
  96.  
  97.         var windowManagerInterface = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
  98.     var topWindow = windowManagerInterface.getMostRecentWindow(null);
  99.  
  100.         topWindow.openDialog('chrome://aim/content/chatContent.xul','','chrome,all,dialog=no',chatContentArgsObj); 
  101.     }
  102.  
  103. }
  104.  
  105. var module = {
  106.     registerSelf: function (compMgr, fileSpec, location, type) {
  107.         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentManagerObsolete);
  108.         compMgr.registerComponentWithType(this.myCID,
  109.             "nsJSAimChatRendezvous",
  110.                 "@netscape.com/js/aim/chatrendezvous;1",
  111.                 fileSpec, location, true, true, type);
  112.     },
  113.  
  114.     getClassObject: function (compMgr, cid, iid) {
  115.         if (!cid.equals(this.myCID))
  116.             throw Components.results.NS_ERROR_NO_INTERFACE;
  117.         
  118.         if (!iid.equals(Components.interfaces.nsIFactory))
  119.             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  120.  
  121.         return this.myFactory;
  122.     },
  123.  
  124.     canUnload: function () {
  125.     },
  126.     
  127.     myCID: Components.ID("{38E07345-2DC7-11d4-BA1A-0010833594E9}"),
  128.     
  129.     myFactory: {
  130.         createInstance: function (outer, iid) {
  131.             if (outer != null)
  132.                 throw Components.results.NS_ERROR_NO_AGGREGATION;
  133.             
  134.             if (!(iid.equals(Components.interfaces.nsIAimChatRendezvousCallback) || iid.equals(Components.interfaces.nsISupports))) {
  135.                 throw Components.results.NS_ERROR_INVALID_ARG;
  136.             }
  137.  
  138.             return new nsJSAimChatRendezvous();
  139.         }
  140.     }
  141. };
  142.  
  143. function NSGetModule(compMgr, fileSpec) { return module; }
  144.