]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/baseui.js
Merge.
[irc/quakenet/qwebirc.git] / js / ui / baseui.js
index 52d353857775e6f50f5c4de52a735fa2d3c03c8d..5a502b359868ecf9e3ee5fa6e3e8fe27438e83f3 100644 (file)
@@ -197,12 +197,42 @@ qwebirc.ui.BaseUI = new Class({
       tricked into getting themselves glined
     */
   loginBox: function(callback, initialNickname, initialChannels, autoConnect, autoNick) {
-    qwebirc.ui.GenericLoginBox(this.parentElement, callback, initialNickname, initialChannels, autoConnect, autoNick, this.options.networkName);
+    this.postInitialize();
+
+    this.addCustomWindow("Connection details", qwebirc.ui.ConnectPane, "connectpane", {
+      initialNickname: initialNickname, initialChannels: initialChannels, autoConnect: autoConnect, networkName: this.options.networkName, callback: callback, autoNick: autoNick
+    }, qwebirc.ui.WINDOW_CONNECT);
   },
   focusChange: function(newValue) {
     var window_ = this.getActiveWindow();
     if($defined(window_))
       window_.focusChange(newValue);
+  },
+  signedOn: function() {
+    this.poller = new qwebirc.xdomain.Poller(this.oobMessage.bind(this));
+  },
+  oobMessage: function(message) {
+    var c = message.splitMax(" ", 2);
+    if(c.length != 2)
+      return;
+
+    var command = c[0];
+    if(command != "CMD")
+      return;
+
+    var d = c[1].splitMax(" ", 2);
+    if(d.length != 2)
+      return;
+
+    var command = d[0];
+    var args = d[1];
+    if(command == "SAY") {
+      var w = this.getActiveIRCWindow();
+      if($defined(w) && (w.type == qwebirc.ui.WINDOW_CHANNEL || w.type == qwebirc.ui.WINDOW_QUERY)) {
+        w.client.exec("/SAY " + args);
+        return;
+      }
+    }
   }
 });
 
@@ -283,7 +313,7 @@ qwebirc.ui.StandardUI = new Class({
   newCustomWindow: function(name, select, type) {
     if(!type)
       type = qwebirc.ui.WINDOW_CUSTOM;
-      
+
     var w = this.newWindow(qwebirc.ui.CUSTOM_CLIENT, type, name);
     w.addEvent("close", function(w) {
       delete this.windows[qwebirc.ui.CUSTOM_CLIENT][w.identifier];
@@ -294,7 +324,7 @@ qwebirc.ui.StandardUI = new Class({
 
     return w;
   },
-  addCustomWindow: function(windowName, class_, cssClass, options) {
+  addCustomWindow: function(windowName, class_, cssClass, options, type) {
     if(!$defined(options))
       options = {};
       
@@ -303,7 +333,7 @@ qwebirc.ui.StandardUI = new Class({
       return;
     }
     
-    var d = this.newCustomWindow(windowName, true);
+    var d = this.newCustomWindow(windowName, true, type);
     this.customWindows[windowName] = d;
     
     d.addEvent("close", function() {
@@ -422,24 +452,8 @@ qwebirc.ui.NotificationUI = new Class({
   }
 });
 
-qwebirc.ui.NewLoginUI = new Class({
-  Extends: qwebirc.ui.NotificationUI,
-  loginBox: function(callbackfn, initialNickname, initialChannels, autoConnect, autoNick) {
-    this.postInitialize();
-
-    /* I'd prefer something shorter and snappier! */
-    var w = this.newCustomWindow("Connection details", true, qwebirc.ui.WINDOW_CONNECT);
-    var callback = function(args) {
-      w.close();
-      callbackfn(args);
-    };
-    
-    qwebirc.ui.GenericLoginBox(w.lines, callback, initialNickname, initialChannels, autoConnect, autoNick, this.options.networkName);
-  }
-});
-
 qwebirc.ui.QuakeNetUI = new Class({
-  Extends: qwebirc.ui.NewLoginUI,
+  Extends: qwebirc.ui.NotificationUI,
   urlDispatcher: function(name, window) {
     if(name == "qwhois") {
       return ["span", function(auth) {