From 936eabe7a3330aa56a96aab89b0955ad735a522d Mon Sep 17 00:00:00 2001 From: Jack Allnutt Date: Sun, 25 Sep 2011 02:19:34 +0100 Subject: [PATCH] Added support for RPL_BANLIST[END] to server, stub methods in the client. --- js/front.events.js | 8 +++++++- js/front.js | 3 +++ node/app.js | 10 ++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/js/front.events.js b/js/front.events.js index 4966721..7df5313 100644 --- a/js/front.events.js +++ b/js/front.events.js @@ -16,6 +16,8 @@ kiwi.front.events = { $(kiwi.gateway).bind("onlist_start", this.onChannelListStart); $(kiwi.gateway).bind("onlist_channel", this.onChannelList); $(kiwi.gateway).bind("onlist_end", this.onChannelListEnd); + $(kiwi.gateway).bind("banlist", this.onBanList); + $(kiwi.gateway).bind("banlist_end", this.onBanListEnd); $(kiwi.gateway).bind("onjoin", this.onJoin); $(kiwi.gateway).bind("ontopic", this.onTopic); $(kiwi.gateway).bind("onpart", this.onPart); @@ -195,7 +197,6 @@ kiwi.front.events = { } }; - // TODO: convert seconds to mins:secs secs = Math.floor(data.delay / 1000); mins = Math.floor(secs / 60); secs = secs % 60; @@ -338,6 +339,11 @@ kiwi.front.events = { kiwi.front.cache.list.tab.show(); }, + onBanList: function (e, data) { + }, + + onBanListEnd: function (e, data) { + }, onJoin: function (e, data) { var tab = Tabview.getTab(data.channel); diff --git a/js/front.js b/js/front.js index 41d7173..c72d02d 100644 --- a/js/front.js +++ b/js/front.js @@ -1183,6 +1183,9 @@ Tabview.prototype.changeTopic = function (new_topic) { }; // Static functions Tabview.tabExists = function (name) { + if ((!name) || (typeof name !== 'string')) { + return false; + } var ret = (typeof kiwi.front.tabviews[name.toLowerCase()] !== 'undefined'); return ret; }; diff --git a/node/app.js b/node/app.js index 21656fa..63ab3b4 100644 --- a/node/app.js +++ b/node/app.js @@ -90,6 +90,8 @@ var ircNumerics = { RPL_TOPIC: '332', RPL_NAMEREPLY: '353', RPL_ENDOFNAMES: '366', + RPL_BANLIST: '367', + RPL_ENDOFBANLIST: '368', RPL_MOTD: '372', RPL_WHOISMODES: '379', ERR_NOSUCHNICK: '401', @@ -284,6 +286,14 @@ this.parseIRCMessage = function (websocket, ircSocket, data) { case ircNumerics.ERR_NOSUCHNICK: websocket.sendClientEvent('irc_error', {error: 'no_such_nick', nick: msg.params.split(" ")[1], reason: msg.trailing}); break; + case ircNumerics.RPL_BANLIST: + params = msg.params.split(" "); + console.log(params); + websocket.sendClientEvent('banlist', {server: '', channel: params[1], banned: params[2], banned_by: params[3], banned_at: params[4]}); + break; + case ircNumerics.RPL_ENDOFBANLIST: + websocket.sendClientEvent('banlist_end', {server: '', channel: msg.params.split(" ")[1]}); + break; case 'JOIN': // Some BNC's send malformed JOIN causing the channel to be as a // parameter instead of trailing. -- 2.25.1