From: Darren Date: Mon, 7 Nov 2011 13:36:50 +0000 (+0000) Subject: TopicSetBy event implimented X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2a4e22fa12130fa3bba47b7455f8a0f6b54f3ef8;p=KiwiIRC.git TopicSetBy event implimented --- diff --git a/client/js/front.events.js b/client/js/front.events.js index bc24356..bbe81c8 100644 --- a/client/js/front.events.js +++ b/client/js/front.events.js @@ -9,37 +9,38 @@ kiwi.front.events = { * Binds all of the event handlers to their events */ bindAll: function () { - $(kiwi.gateway).bind("onmsg", this.onMsg); - $(kiwi.gateway).bind("onnotice", this.onNotice); - $(kiwi.gateway).bind("onaction", this.onAction); - $(kiwi.gateway).bind("onmotd", this.onMOTD); - $(kiwi.gateway).bind("onoptions", this.onOptions); - $(kiwi.gateway).bind("onconnect", this.onConnect); - $(kiwi.gateway).bind("onconnect_fail", this.onConnectFail); - $(kiwi.gateway).bind("ondisconnect", this.onDisconnect); - $(kiwi.gateway).bind("onreconnecting", this.onReconnecting); - $(kiwi.gateway).bind("onnick", this.onNick); - $(kiwi.gateway).bind("onuserlist", this.onUserList); - $(kiwi.gateway).bind("onuserlist_end", this.onUserListEnd); - $(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); - $(kiwi.gateway).bind("onkick", this.onKick); - $(kiwi.gateway).bind("onquit", this.onQuit); - $(kiwi.gateway).bind("onmode", this.onMode); - $(kiwi.gateway).bind("onwhois", this.onWhois); - $(kiwi.gateway).bind("onsync", this.onSync); - $(kiwi.gateway).bind("onchannel_redirect", this.onChannelRedirect); - $(kiwi.gateway).bind("ondebug", this.onDebug); - $(kiwi.gateway).bind("onctcp_request", this.onCTCPRequest); - $(kiwi.gateway).bind("onctcp_response", this.onCTCPResponse); - $(kiwi.gateway).bind("onirc_error", this.onIRCError); - $(kiwi.gateway).bind("onkiwi", this.onKiwi); + $(kiwi.gateway).bind('onmsg', this.onMsg) + .bind('onnotice', this.onNotice) + .bind('onaction', this.onAction) + .bind('onmotd', this.onMOTD) + .bind('onoptions', this.onOptions) + .bind('onconnect', this.onConnect) + .bind('onconnect_fail', this.onConnectFail) + .bind('ondisconnect', this.onDisconnect) + .bind('onreconnecting', this.onReconnecting) + .bind('onnick', this.onNick) + .bind('onuserlist', this.onUserList) + .bind('onuserlist_end', this.onUserListEnd) + .bind('onlist_start', this.onChannelListStart) + .bind('onlist_channel', this.onChannelList) + .bind('onlist_end', this.onChannelListEnd) + .bind('onbanlist', this.onBanList) + .bind('onbanlist_end', this.onBanListEnd) + .bind('onjoin', this.onJoin) + .bind('ontopic', this.onTopic) + .bind('ontopicsetby', this.onTopicSetBy) + .bind('onpart', this.onPart) + .bind('onkick', this.onKick) + .bind('onquit', this.onQuit) + .bind('onmode', this.onMode) + .bind('onwhois', this.onWhois) + .bind('onsync', this.onSync) + .bind('onchannel_redirect', this.onChannelRedirect) + .bind('ondebug', this.onDebug) + .bind('onctcp_request', this.onCTCPRequest) + .bind('onctcp_response', this.onCTCPResponse) + .bind('onirc_error', this.onIRCError) + .bind('onkiwi', this.onKiwi); }, /** @@ -114,6 +115,19 @@ kiwi.front.events = { } }, + /** + * Handles the topicsetby event + * @param {eventObject} e The event object + * @param {Object} data The event data + */ + onTopicSetBy: function (e, data) { + var when, tab = Tabview.getTab(data.channel); + if (tab) { + when = new Date(data.when*1000).toLocaleString(); + tab.addMsg(null, '', 'Topic set by ' + data.nick + ' at ' + when, 'topic'); + } + }, + /** * Handles the notice event * @param {eventObject} e The event object diff --git a/client/js/front.js b/client/js/front.js index 9e1d833..4d15bf9 100644 --- a/client/js/front.js +++ b/client/js/front.js @@ -171,7 +171,6 @@ kiwi.front = { server_tabview = new Tabview('server'); server_tabview.userlist.setWidth(0); // Disable the userlist server_tabview.setIcon('/img/app_menu.png'); - console.log($('.icon', server_tabview.tab)); $('.icon', server_tabview.tab).tipTip({ delay: 0, keepAlive: true, diff --git a/server/app.js b/server/app.js index bc6b204..550e1af 100644 --- a/server/app.js +++ b/server/app.js @@ -88,6 +88,7 @@ var ircNumerics = { RPL_LISTEND: '323', RPL_NOTOPIC: '331', RPL_TOPIC: '332', + RPL_TOPICWHOTIME: '333', RPL_NAMEREPLY: '353', RPL_ENDOFNAMES: '366', RPL_BANLIST: '367', @@ -340,6 +341,16 @@ this.parseIRCMessage = function (websocket, ircSocket, data) { obj = {nick: '', channel: msg.params.split(" ")[1], topic: ''}; websocket.sendClientEvent('topic', obj); break; + case ircNumerics.RPL_TOPICWHOTIME: + (function () { + var parts = msg.params.split(' '), + nick = parts[2], + channel = parts[1], + when = parts[3]; + obj = {nick: nick, channel: channel, when: when}; + websocket.sendClientEvent('topicsetby', obj); + })(); + break; case 'MODE': opts = msg.params.split(" "); params = {nick: msg.nick};