TopicSetBy event implimented
authorDarren <darren@darrenwhitlen.com>
Mon, 7 Nov 2011 13:36:50 +0000 (13:36 +0000)
committerDarren <darren@darrenwhitlen.com>
Mon, 7 Nov 2011 13:36:50 +0000 (13:36 +0000)
client/js/front.events.js
client/js/front.js
server/app.js

index bc24356d63b2b9ca463c6643503b6a999d5087d9..bbe81c8b2a5ec9aea72e3c7cc8c1cdb860362afd 100644 (file)
@@ -9,37 +9,38 @@ kiwi.front.events = {
     *   Binds all of the event handlers to their events\r
     */\r
        bindAll: function () {\r
-        $(kiwi.gateway).bind("onmsg", this.onMsg);\r
-        $(kiwi.gateway).bind("onnotice", this.onNotice);\r
-        $(kiwi.gateway).bind("onaction", this.onAction);\r
-        $(kiwi.gateway).bind("onmotd", this.onMOTD);\r
-        $(kiwi.gateway).bind("onoptions", this.onOptions);\r
-        $(kiwi.gateway).bind("onconnect", this.onConnect);\r
-        $(kiwi.gateway).bind("onconnect_fail", this.onConnectFail);\r
-        $(kiwi.gateway).bind("ondisconnect", this.onDisconnect);\r
-        $(kiwi.gateway).bind("onreconnecting", this.onReconnecting);\r
-        $(kiwi.gateway).bind("onnick", this.onNick);\r
-        $(kiwi.gateway).bind("onuserlist", this.onUserList);\r
-        $(kiwi.gateway).bind("onuserlist_end", this.onUserListEnd);\r
-        $(kiwi.gateway).bind("onlist_start", this.onChannelListStart);\r
-        $(kiwi.gateway).bind("onlist_channel", this.onChannelList);\r
-        $(kiwi.gateway).bind("onlist_end", this.onChannelListEnd);\r
-        $(kiwi.gateway).bind("banlist", this.onBanList);\r
-        $(kiwi.gateway).bind("banlist_end", this.onBanListEnd);\r
-        $(kiwi.gateway).bind("onjoin", this.onJoin);\r
-        $(kiwi.gateway).bind("ontopic", this.onTopic);\r
-        $(kiwi.gateway).bind("onpart", this.onPart);\r
-        $(kiwi.gateway).bind("onkick", this.onKick);\r
-        $(kiwi.gateway).bind("onquit", this.onQuit);\r
-        $(kiwi.gateway).bind("onmode", this.onMode);\r
-        $(kiwi.gateway).bind("onwhois", this.onWhois);\r
-        $(kiwi.gateway).bind("onsync", this.onSync);\r
-        $(kiwi.gateway).bind("onchannel_redirect", this.onChannelRedirect);\r
-        $(kiwi.gateway).bind("ondebug", this.onDebug);\r
-        $(kiwi.gateway).bind("onctcp_request", this.onCTCPRequest);\r
-        $(kiwi.gateway).bind("onctcp_response", this.onCTCPResponse);\r
-        $(kiwi.gateway).bind("onirc_error", this.onIRCError);\r
-        $(kiwi.gateway).bind("onkiwi", this.onKiwi);\r
+        $(kiwi.gateway).bind('onmsg', this.onMsg)\r
+            .bind('onnotice', this.onNotice)\r
+            .bind('onaction', this.onAction)\r
+            .bind('onmotd', this.onMOTD)\r
+            .bind('onoptions', this.onOptions)\r
+            .bind('onconnect', this.onConnect)\r
+            .bind('onconnect_fail', this.onConnectFail)\r
+            .bind('ondisconnect', this.onDisconnect)\r
+            .bind('onreconnecting', this.onReconnecting)\r
+            .bind('onnick', this.onNick)\r
+            .bind('onuserlist', this.onUserList)\r
+            .bind('onuserlist_end', this.onUserListEnd)\r
+            .bind('onlist_start', this.onChannelListStart)\r
+            .bind('onlist_channel', this.onChannelList)\r
+            .bind('onlist_end', this.onChannelListEnd)\r
+            .bind('onbanlist', this.onBanList)\r
+            .bind('onbanlist_end', this.onBanListEnd)\r
+            .bind('onjoin', this.onJoin)\r
+            .bind('ontopic', this.onTopic)\r
+            .bind('ontopicsetby', this.onTopicSetBy)\r
+            .bind('onpart', this.onPart)\r
+            .bind('onkick', this.onKick)\r
+            .bind('onquit', this.onQuit)\r
+            .bind('onmode', this.onMode)\r
+            .bind('onwhois', this.onWhois)\r
+            .bind('onsync', this.onSync)\r
+            .bind('onchannel_redirect', this.onChannelRedirect)\r
+            .bind('ondebug', this.onDebug)\r
+            .bind('onctcp_request', this.onCTCPRequest)\r
+            .bind('onctcp_response', this.onCTCPResponse)\r
+            .bind('onirc_error', this.onIRCError)\r
+            .bind('onkiwi', this.onKiwi);\r
        },\r
 \r
     /**\r
@@ -114,6 +115,19 @@ kiwi.front.events = {
         }\r
     },\r
 \r
+    /**\r
+    *   Handles the topicsetby event\r
+    *   @param  {eventObject}   e       The event object\r
+    *   @param  {Object}        data    The event data\r
+    */\r
+    onTopicSetBy: function (e, data) {\r
+        var when, tab = Tabview.getTab(data.channel);\r
+        if (tab) {\r
+            when = new Date(data.when*1000).toLocaleString();\r
+            tab.addMsg(null, '', 'Topic set by ' + data.nick + ' at ' + when, 'topic');\r
+        }\r
+    },\r
+\r
     /**\r
     *   Handles the notice event\r
     *   @param  {eventObject}   e       The event object\r
index 9e1d833f3b82884db8f147e5b7fe599ba7f21249..4d15bf995706bc4b689a7b72d5f2a212ca9af043 100644 (file)
@@ -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,
index bc6b204352dd35da16a1f278d3f198ac12ff1359..550e1af1c4bb81e68d281780996ad4dbde237ed1 100644 (file)
@@ -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};