]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Add 'cannot send to chan' numeric and refactor.
authorChris Porter <redacted>
Sun, 19 Oct 2008 01:51:59 +0000 (02:51 +0100)
committerChris Porter <redacted>
Sun, 19 Oct 2008 01:51:59 +0000 (02:51 +0100)
js/irc/baseircclient.js
js/irc/ircclient.js
js/irc/numerics.js
js/ui/theme.js

index f61c4f9ef0421957a7d76a2757d15d5494064b44..26dfee5dc63638b1208b819a32753098899dd6a0 100644 (file)
@@ -28,6 +28,8 @@ qwebirc.irc.BaseIRCClient = new Class({
     this.send = this.connection.send.bind(this.connection);
     this.connect = this.connection.connect.bind(this.connection);
     this.disconnect = this.connection.disconnect.bind(this.connection);
+    
+    this.setupGenericErrors();
   },
   dispatch: function(data) {
     var message = data[0];
@@ -371,10 +373,16 @@ qwebirc.irc.BaseIRCClient = new Class({
     
     return this.whois(nick, "end", {});
   },
-  irc_ERR_NOSUCHNICK: function(prefix, params) {
-    var nick = params[1];
+  irc_generic_error: function(prefix, params) {
+    var target = params[1];
+    var message = params.indexFromEnd(-1);
     
-    return this.whois(nick, "nosuchnick", {});
+    this.genericerror(target, message);
+    return true;
+  },
+  setupGenericErrors: function() {
+    this.irc_ERR_NOSUCHNICK = this.irc_ERR_CANNOTSENDTOCHAN = this.irc_generic_error;
+    return true;
   },
   irc_RPL_AWAY: function(prefix, params) {
     var nick = params[1];
index ce8400029d6fc90634c60b2e2efa07ff095827c6..b659450f4df64df72a6d248fc299737b0881f354 100644 (file)
@@ -415,13 +415,14 @@ qwebirc.irc.IRCClient = new Class({
       ndata.x = data.ip;
     } else if(type == "end") {
       mtype = "END";
-    } else if(type == "nosuchnick") {
-      mtype = "NOSUCHNICK";
     } else {
       return false;
     }
     
     xsend();
     return true;
+  },
+  genericerror: function(target, message) {
+    this.newTargetOrActiveLine(target, "GENERICERROR", {m: message, t: target});
   }
 });
index a900d773ece76b8fc8792a11ab8f27d9f57b50a3..0f4170d4da566fc2820b6222aef76952a35030cd 100644 (file)
@@ -18,5 +18,6 @@ qwebirc.irc.Numerics = {
   "338": "RPL_WHOISACTUALLY",
   "343": "RPL_WHOISOPERNAME",
   "301": "RPL_AWAY",
-  "401": "ERR_NOSUCHNICK"
+  "401": "ERR_NOSUCHNICK",
+  "404": "ERR_CANNOTSENDTOCHAN"
 };
index d0a4ed0c0b2296fff2a037f985bb5711265e44d3..bf12f261b8194e881283ca9f5a01485015c0ff8b 100644 (file)
@@ -56,7 +56,7 @@ qwebirc.ui.themes.Default = {
   "WHOISACTUALLY": [" realhost : $m [ip: $x]", true],
   "WHOISEND": ["End of WHOIS", true],
   "AWAY": ["$n is away: $m", true],
-  "WHOISNOSUCHNICK": ["No such nick: $n", true]
+  "GENERICERROR": ["$m: $t", true]
 };
 
 qwebirc.ui.Theme = new Class({