]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - js/ui/baseuiwindow.js
Merge.
[irc/quakenet/qwebirc.git] / js / ui / baseuiwindow.js
index 6179b3515ccff0f4452f70be31eaa8189725571d..1466907324b93502f1e128f944074bb68e8b99ac 100644 (file)
@@ -21,7 +21,7 @@ qwebirc.ui.Window = new Class({
     this.commandhistory = this.parentObject.commandhistory;
     this.scrolleddown = true;
     this.scrollpos = null;
-    this.lastNickHash = {};
+    this.lastNickHash = new QHash();
     this.lastSelected = null;
     this.subWindow = null;
     this.closed = false;
@@ -98,8 +98,10 @@ qwebirc.ui.Window = new Class({
   addLine: function(type, line, colour, element) {
     var hilight = qwebirc.ui.HILIGHT_NONE;
     var lhilight = false;
-    
+
     if(type) {
+      var selectMe = function() { this.parentObject.selectWindow(this); }.bind(this);
+      var message = $defined(line) ? line["m"] : null;
       hilight = qwebirc.ui.HILIGHT_ACTIVITY;
       
       if(type.match(/(NOTICE|ACTION|MSG)$/)) {
@@ -108,15 +110,13 @@ qwebirc.ui.Window = new Class({
             hilight = qwebirc.ui.HILIGHT_ACTIVITY;
           } else {
             hilight = qwebirc.ui.HILIGHT_US;
-            this.parentObject.beep();
-            this.parentObject.flash();
+            this.parentObject.notify("Private message from " + this.name, message, selectMe);
           }
         }
-        if(!type.match(/^OUR/) && this.client.hilightController.match(line["m"])) {
+        if(!type.match(/^OUR/) && this.client.hilightController.match(message)) {
           lhilight = true;
           hilight = qwebirc.ui.HILIGHT_US;
-          this.parentObject.beep();
-          this.parentObject.flash();
+          this.parentObject.notify("Hilighted in " + this.name, message, selectMe);
         } else if(hilight != qwebirc.ui.HILIGHT_US) {
           hilight = qwebirc.ui.HILIGHT_SPEECH;
         }
@@ -204,26 +204,27 @@ qwebirc.ui.Window = new Class({
     }
   },
   updateNickList: function(nicks) {
-    var nickHash = {}, present = {};
+    var nickHash = new QHash(), present = new QSet();
     var added = [];
     var lnh = this.lastNickHash;
     
     for(var i=0;i<nicks.length;i++)
-      present[nicks[i]] = 1;
-    
-    for(var k in lnh)
-      if(!present[k])
-        this.nickListRemove(k, lnh[k]);
-        
+      present.add(nicks[i]);
+
+    lnh.each(function(k, v) {
+      if(!present.contains(k))
+        this.nickListRemove(k, v);
+    }, this);
+
     for(var i=0;i<nicks.length;i++) {
       var n = nicks[i];
-      var l = lnh[n];
+      var l = lnh.get(n);
       if(!l) {
         l = this.nickListAdd(n, i);
         if(!l)
           l = 1;
       }
-      nickHash[n] = l;
+      nickHash.put(n, l);
     }
     
     this.lastNickHash = nickHash;