Removing text theme formatting chars from application code; Use more-readable names...
authorDarren <darren@darrenwhitlen.com>
Mon, 21 Apr 2014 01:20:42 +0000 (02:20 +0100)
committerDarren <darren@darrenwhitlen.com>
Mon, 21 Apr 2014 01:20:42 +0000 (02:20 +0100)
client/assets/text_themes/symbols.json
client/src/helpers/utils.js
client/src/models/application.js
client/src/models/channel.js
client/src/models/network.js
client/src/views/channel.js

index 9139fc5d934d57a73390369fcb6cf929e90c82e7..76b8708939f0f5289d0ae9df57619d624ffa7593 100644 (file)
@@ -1,55 +1,55 @@
 {
-  "channel_join": "%C14→ %N %T",
-  "channel_part": "%C14← %N %T",
-  "channel_quit": "%C14← %N %T",
-  "channel_kicked": "%C4×%O %N %T",
-  "channel_selfkick": "%C4× %T",
-  "channel_badpassword": "%C4× %T",
-  "channel_topic": "%C10ⓘ %T",
-  "mode": "%C10ⓘ %N %T",
-  "selfmode": "%C10ⓘ %N %T",
-  "channel_banned": "%C3×%O %T",
-  "channel_badkey": "%C4⚠ %T",
-  "channel_inviteonly": "%C4⚠ %C %T",
-  "channel_alreadyin": "%C4⚠ %N %T",
-  "channel_limitreached": "%C4⚠ %C %T",
-  "nickname_alreadyinuse": "%C4⚠ %T",
-  "channel_invalid_name": "%C4⚠ %C %T",
-  "network_disconnected": "%C4⚠ %T",
-  "channel_topic_setby": "%C10ⓘ %T",
-  "whois_channels": "%C14%T",
-  "whois_idle_and_signon": "%C14%T",
-  "whois_away": "%C14%T",
-  "whois_server": "%C14%T",
-  "whois_idle": "%C14%T",
-  "whois_notfound": "%C10ⓘ %T",
-  "nick_changed": "%C14ⓘ %N %T",
-  "applet_notfound": "%C4⚠ %T",
-  "channel_has_been_invited": "%C7ⓘ %N %T",
-  "encoding_changed": "%C10ⓘ %T",
-  "encoding_invalid": "%C4⚠ %T",
-  "settings_saved": "%C10ⓘ %T",
-  "ignore_title": "%C10%T:",
-  "ignore_none": "%C10%T",
-  "ignore_nick": "%C10%T",
-  "ignore_stop_notice": "%C10%T",
-  "ignore_stopped": "%C10%T",
-  "chanop_privs_needed": "%C4⚠ %T",
-  "no_such_nick": "%C10ⓘ %N: %T",
-  "unknown_command": "%C10ⓘ %T",
-  "motd": "%T",
-  "privmsg": "%T",
-  "ctcp": "[CTCP] %T",
-  "notice": "%C13%T",
-  "action": "%C13* %N %T",
-  "whois_ident": "%C14%N [%N!%J@%H] * %T",
-  "whois": "%C14%T",
-  "who": "%N [%N!%J@%H] * %R",
-  "quit": "%C14%T",
-  "rejoin": "%T",
-  "set_setting": "%C10ⓘ %T",
-  "list_aliases": "%C10ⓘ %T",
-  "ignored_pattern": "%C10ⓘ %T",
-  "query": "%T",
-  "msg": "%T"
+  "channel_join": "%C14→ %nick [%ident@%host] %text",
+  "channel_part": "%C14← %nick %text",
+  "channel_quit": "%C14← %nick %text",
+  "channel_kicked": "%C4×%O %nick %text",
+  "channel_selfkick": "%C4× %text",
+  "channel_badpassword": "%C4× %text",
+  "channel_topic": "%C10ⓘ %text",
+  "mode": "%C10ⓘ %nick %text",
+  "selfmode": "%C10ⓘ %nick %text",
+  "channel_banned": "%C3×%O %text",
+  "channel_badkey": "%C4⚠ %text",
+  "channel_inviteonly": "%C4⚠ %channel %text",
+  "channel_alreadyin": "%C4⚠ %nick %text",
+  "channel_limitreached": "%C4⚠ %channel %text",
+  "nickname_alreadyinuse": "%C4⚠ %text",
+  "channel_invalid_name": "%C4⚠ %channel %text",
+  "network_disconnected": "%C4⚠ %text",
+  "channel_topic_setby": "%C10ⓘ %text",
+  "whois_channels": "%C14%text",
+  "whois_idle_and_signon": "%C14%text",
+  "whois_away": "%C14%text",
+  "whois_server": "%C14%text",
+  "whois_idle": "%C14%text",
+  "whois_notfound": "%C10ⓘ %text",
+  "nick_changed": "%C14ⓘ %nick %text",
+  "applet_notfound": "%C4⚠ %text",
+  "channel_has_been_invited": "%C7ⓘ %nick %text",
+  "encoding_changed": "%C10ⓘ %text",
+  "encoding_invalid": "%C4⚠ %text",
+  "settings_saved": "%C10ⓘ %text",
+  "ignore_title": "%C10%text:",
+  "ignore_none": "%C10%text",
+  "ignore_nick": "%C10%text",
+  "ignore_stop_notice": "%C10%text",
+  "ignore_stopped": "%C10%text",
+  "chanop_privs_needed": "%C4⚠ %text",
+  "no_such_nick": "%C10ⓘ %nick: %text",
+  "unknown_command": "%C10ⓘ %text",
+  "motd": "%text",
+  "privmsg": "%text",
+  "ctcp": "[CTCP] %text",
+  "notice": "%C13%text",
+  "action": "%C13* %nick %text",
+  "whois_ident": "%C14%nick [%nick!%ident@%host] * %text",
+  "whois": "%C14%text",
+  "who": "%nick [%nick!%ident@%host] * %realname",
+  "quit": "%C14%text",
+  "rejoin": "%text",
+  "set_setting": "%C10ⓘ %text",
+  "list_aliases": "%C10ⓘ %text",
+  "ignored_pattern": "%C10ⓘ %text",
+  "query": "%text",
+  "msg": "%text"
 }
\ No newline at end of file
index 1779f6a231bcc2ff6be97b05e8077304943f21a1..b8fe808dbec64c01af15e09d69a1a46c3933e7aa 100644 (file)
@@ -514,35 +514,37 @@ function translateText(string_id, params) {
  * Simplyfy the text styling syntax
  *
  * Syntax:
- *   %N: nickname
- *   %C: channel
- *   %J: ident
- *   %H: host
- *   %R: realname
+ *   %nick:     nickname
+ *   %channel:  channel
+ *   %ident:    ident
+ *   %host:     host
+ *   %realname: realname
+ *   %text:     translated text
  *   %C[digit]: color
- *   %B: bold
- *   %I: italic
- *   %U: underline
- *   %O: cancel styles
- *   %T: translated text
+ *   %B:        bold
+ *   %I:        italic
+ *   %U:        underline
+ *   %O:        cancel styles
  **/
 function styleText(string_id, params) {
     var style, text;
 
-    style = formatToIrcMsg(_kiwi.app.text_theme[string_id]);
+    //style = formatToIrcMsg(_kiwi.app.text_theme[string_id]);
+    style = _kiwi.app.text_theme[string_id];
 
     // Expand a member mask into its individual parts (nick, ident, hostname)
-    if (params['%M']) {
-        params['%N'] = params['%M'].nick;
-        params['%J'] = params['%M'].ident;
-        params['%H'] = params['%M'].hostname;
+    if (params.member) {
+        params.nick = params.member.nick;
+        params.ident = params.member.ident;
+        params.host = params.member.hostname;
     }
 
-    // Do the magic. Use the shorthand syntax to produce output.
-    text = style.replace(/(%[A-Z])/g, function(match, key) {
-        if (typeof params[key.toUpperCase()] !== 'undefined')
-            return params[key.toUpperCase()];
+    // Do the magic. Use the %shorthand syntax to produce output.
+    text = style.replace(/%([A-Z]{2,})/ig, function(match, key) {
+        if (typeof params[key] !== 'undefined')
+            return params[key];
     });
 
+    text = formatToIrcMsg(text);
     return text;
 }
\ No newline at end of file
index 49bbc0ace149f014f651fdf8b6372ee229eec0ca..53fa40c56ad449957a0d5920651c3ce69d3a5210 100644 (file)
 \r
                     // Mention the disconnection on every channel\r
                     _kiwi.app.connections.forEach(function(connection) {\r
-                        connection.panels.server.addMsg('', styleText('quit', {'%T': msg}), 'action quit');\r
+                        connection.panels.server.addMsg('', styleText('quit', {text: msg}), 'action quit');\r
 \r
                         connection.panels.forEach(function(panel) {\r
                             if (!panel.isChannel())\r
                                 return;\r
 \r
-                            panel.addMsg('', styleText('quit', {'%T': msg}), 'action quit');\r
+                            panel.addMsg('', styleText('quit', {text: msg}), 'action quit');\r
                         });\r
                     });\r
 \r
 \r
                     // Only need to mention the repeating re-connection messages on server panels\r
                     _kiwi.app.connections.forEach(function(connection) {\r
-                        connection.panels.server.addMsg('', styleText('quit', {'%T': msg}), 'action quit');\r
+                        connection.panels.server.addMsg('', styleText('quit', {text: msg}), 'action quit');\r
                     });\r
                 });\r
 \r
 \r
                     // Mention the re-connection on every channel\r
                     _kiwi.app.connections.forEach(function(connection) {\r
-                        connection.panels.server.addMsg('', styleText('rejoin', {'%T': msg}), 'action join');\r
+                        connection.panels.server.addMsg('', styleText('rejoin', {text: msg}), 'action join');\r
 \r
                         connection.panels.forEach(function(panel) {\r
                             if (!panel.isChannel())\r
                                 return;\r
 \r
-                            panel.addMsg('', styleText('rejoin', {'%T': msg}), 'action join');\r
+                            panel.addMsg('', styleText('rejoin', {text: msg}), 'action join');\r
                         });\r
                     });\r
 \r
                 }\r
 \r
                 // Read the value to the user\r
-                _kiwi.app.panels().active.addMsg('', styleText('set_setting', {'%T': setting + ' = ' + _kiwi.global.settings.get(setting).toString()}));\r
+                _kiwi.app.panels().active.addMsg('', styleText('set_setting', {text: setting + ' = ' + _kiwi.global.settings.get(setting).toString()}));\r
             };\r
 \r
 \r
             fn_to_bind['command:save'] = function (ev) {\r
                 _kiwi.global.settings.save();\r
-                _kiwi.app.panels().active.addMsg('', styleText('settings_saved', {'%T': translateText('client_models_application_settings_saved')}));\r
+                _kiwi.app.panels().active.addMsg('', styleText('settings_saved', {text: translateText('client_models_application_settings_saved')}));\r
             };\r
 \r
 \r
                 // No parameters passed so list them\r
                 if (!ev.params[1]) {\r
                     $.each(controlbox.preprocessor.aliases, function (name, rule) {\r
-                        _kiwi.app.panels().server.addMsg(' ', styleText('list_aliases', {'%T': name + '   =>   ' + rule}));\r
+                        _kiwi.app.panels().server.addMsg(' ', styleText('list_aliases', {text: name + '   =>   ' + rule}));\r
                     });\r
                     return;\r
                 }\r
                 // No parameters passed so list them\r
                 if (!ev.params[0]) {\r
                     if (list.length > 0) {\r
-                        _kiwi.app.panels().active.addMsg(' ', styleText('ignore_title', {'%T': translateText('client_models_application_ignore_title')}));\r
+                        _kiwi.app.panels().active.addMsg(' ', styleText('ignore_title', {text: translateText('client_models_application_ignore_title')}));\r
                         $.each(list, function (idx, ignored_pattern) {\r
-                            _kiwi.app.panels().active.addMsg(' ', styleText('ignored_pattern', {'%T': ignored_pattern}));\r
+                            _kiwi.app.panels().active.addMsg(' ', styleText('ignored_pattern', {text: ignored_pattern}));\r
                         });\r
                     } else {\r
-                        _kiwi.app.panels().active.addMsg(' ', styleText('ignore_none', {'%T': translateText('client_models_application_ignore_none')}));\r
+                        _kiwi.app.panels().active.addMsg(' ', styleText('ignore_none', {text: translateText('client_models_application_ignore_none')}));\r
                     }\r
                     return;\r
                 }\r
                 // We have a parameter, so add it\r
                 list.push(ev.params[0]);\r
                 this.connections.active_connection.set('ignore_list', list);\r
-                _kiwi.app.panels().active.addMsg(' ', styleText('ignore_nick', {'%T': translateText('client_models_application_ignore_nick', [ev.params[0]])}));\r
+                _kiwi.app.panels().active.addMsg(' ', styleText('ignore_nick', {text: translateText('client_models_application_ignore_nick', [ev.params[0]])}));\r
             };\r
 \r
 \r
                 var list = this.connections.active_connection.get('ignore_list');\r
 \r
                 if (!ev.params[0]) {\r
-                    _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stop_notice', {'%T': translateText('client_models_application_ignore_stop_notice')}));\r
+                    _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stop_notice', {text: translateText('client_models_application_ignore_stop_notice')}));\r
                     return;\r
                 }\r
 \r
 \r
                 this.connections.active_connection.set('ignore_list', list);\r
 \r
-                _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stopped', {'%T': translateText('client_models_application_ignore_stopped', [ev.params[0]])}));\r
+                _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stopped', {text: translateText('client_models_application_ignore_stopped', [ev.params[0]])}));\r
             };\r
 \r
 \r
 \r
         if (message) {\r
             this.connections.active_connection.gateway.msg(panel.get('name'), message);\r
-            panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('query', {'%T': message}));\r
+            panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('query', {text: message}));\r
         }\r
 \r
     }\r
         ev.params.shift();\r
         message = formatToIrcMsg(ev.params.join(' '));\r
 \r
-        panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('msg', {'%T': message}));\r
+        panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('msg', {text: message}));\r
         this.connections.active_connection.gateway.msg(destination, message);\r
     }\r
 \r
         }\r
 \r
         var panel = _kiwi.app.panels().active;\r
-        panel.addMsg('', styleText('action', {'%N': _kiwi.app.connections.active_connection.get('nick'), '%T': ev.params.join(' ')}), 'action');\r
+        panel.addMsg('', styleText('action', {nick: _kiwi.app.connections.active_connection.get('nick'), text: ev.params.join(' ')}), 'action');\r
         this.connections.active_connection.gateway.action(panel.get('name'), ev.params.join(' '));\r
     }\r
 \r
             if (_kiwi.applets[ev.params[0]]) {\r
                 panel.load(new _kiwi.applets[ev.params[0]]());\r
             } else {\r
-                _kiwi.app.panels().server.addMsg('', styleText('applet_notfound', {'%T': translateText('client_models_application_applet_notfound', [ev.params[0]])}));\r
+                _kiwi.app.panels().server.addMsg('', styleText('applet_notfound', {text: translateText('client_models_application_applet_notfound', [ev.params[0]])}));\r
                 return;\r
             }\r
         }\r
 \r
         _kiwi.app.connections.active_connection.gateway.raw('INVITE ' + nick + ' ' + channel);\r
 \r
-        _kiwi.app.panels().active.addMsg('', styleText('channel_has_been_invited', {'%N': nick, '%T': translateText('client_models_application_has_been_invited', [channel])}), 'action');\r
+        _kiwi.app.panels().active.addMsg('', styleText('channel_has_been_invited', {nick: nick, text: translateText('client_models_application_has_been_invited', [channel])}), 'action');\r
     }\r
 \r
 \r
         if (ev.params[0]) {\r
             _kiwi.gateway.setEncoding(null, ev.params[0], function (success) {\r
                 if (success) {\r
-                    _kiwi.app.panels().active.addMsg('', styleText('encoding_changed', {'%T': translateText('client_models_application_encoding_changed', [ev.params[0]])}));\r
+                    _kiwi.app.panels().active.addMsg('', styleText('encoding_changed', {text: translateText('client_models_application_encoding_changed', [ev.params[0]])}));\r
                 } else {\r
-                    _kiwi.app.panels().active.addMsg('', styleText('encoding_invalid', {'%T': translateText('client_models_application_encoding_invalid', [ev.params[0]])}));\r
+                    _kiwi.app.panels().active.addMsg('', styleText('encoding_invalid', {text: translateText('client_models_application_encoding_invalid', [ev.params[0]])}));\r
                 }\r
             });\r
         } else {\r
-            _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_notspecified', {'%T': translateText('client_models_application_encoding_notspecified')}));\r
-            _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_usage', {'%T': translateText('client_models_application_encoding_usage')}));\r
+            _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_notspecified', {text: translateText('client_models_application_encoding_notspecified')}));\r
+            _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_usage', {text: translateText('client_models_application_encoding_usage')}));\r
         }\r
     }\r
 \r
         // Use the same nick as we currently have\r
         nick = _kiwi.app.connections.active_connection.get('nick');\r
 \r
-        _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_connecting', {'%T': translateText('client_models_application_connection_connecting', [server, port.toString()])}));\r
+        _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_connecting', {text: translateText('client_models_application_connection_connecting', [server, port.toString()])}));\r
 \r
         _kiwi.gateway.newConnection({\r
             nick: nick,\r
             password: password\r
         }, function(err, new_connection) {\r
             if (err)\r
-                _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_error', {'%T': translateText('client_models_application_connection_error', [server, port.toString(), err.toString()])}));\r
+                _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_error', {text: translateText('client_models_application_connection_error', [server, port.toString(), err.toString()])}));\r
         });\r
     }\r
 \r
index 93746ad5647bbf3b59284583619ef3aeacea6aab..0fe8d4310eb77784511df30ea2e5c3e0668bee8f 100644 (file)
@@ -22,7 +22,7 @@ _kiwi.model.Channel = _kiwi.model.Panel.extend({
                 return;\r
             }\r
 \r
-            this.addMsg(' ', styleText('channel_join', {'%M': member.getMaskParts(), '%T': translateText('client_models_channel_join'), '%C': name}), 'action join', {time: options.kiwi.time});\r
+            this.addMsg(' ', styleText('channel_join', {member: member.getMaskParts(), text: translateText('client_models_channel_join'), channel: name}), 'action join', {time: options.kiwi.time});\r
         }, this);\r
 \r
         members.bind("remove", function (member, members, options) {\r
@@ -30,20 +30,20 @@ _kiwi.model.Channel = _kiwi.model.Panel.extend({
             var msg = (options.kiwi.message) ? '(' + options.kiwi.message + ')' : '';\r
 \r
             if (options.kiwi.type === 'quit' && show_message) {\r
-                this.addMsg(' ', styleText('channel_quit', {'%M': member.getMaskParts(), '%T': translateText('client_models_channel_quit', [msg]), '%C': name}), 'action quit', {time: options.kiwi.time});\r
+                this.addMsg(' ', styleText('channel_quit', {member: member.getMaskParts(), text: translateText('client_models_channel_quit', [msg]), channel: name}), 'action quit', {time: options.kiwi.time});\r
 \r
             } else if (options.kiwi.type === 'kick') {\r
 \r
                 if (!options.kiwi.current_user_kicked) {\r
                     //If user kicked someone, show the message regardless of settings.\r
                     if (show_message || options.kiwi.current_user_initiated) {\r
-                        this.addMsg(' ', styleText('channel_kicked', {'%M': member.getMaskParts(), '%T': translateText('client_models_channel_kicked', [options.kiwi.by, msg]), '%C': name}), 'action kick', {time: options.kiwi.time});\r
+                        this.addMsg(' ', styleText('channel_kicked', {member: member.getMaskParts(), text: translateText('client_models_channel_kicked', [options.kiwi.by, msg]), channel: name}), 'action kick', {time: options.kiwi.time});\r
                     }\r
                 } else {\r
-                    this.addMsg(' ', styleText('channel_selfkick', {'%T': translateText('client_models_channel_selfkick', [options.kiwi.by, msg]), '%C': name}), 'action kick', {time: options.kiwi.time});\r
+                    this.addMsg(' ', styleText('channel_selfkick', {text: translateText('client_models_channel_selfkick', [options.kiwi.by, msg]), channel: name}), 'action kick', {time: options.kiwi.time});\r
                 }\r
             } else if (show_message) {\r
-                this.addMsg(' ', styleText('channel_part', {'%M': member.getMaskParts(), '%T': translateText('client_models_channel_part', [msg]), '%C': name}), 'action part', {time: options.kiwi.time});\r
+                this.addMsg(' ', styleText('channel_part', {member: member.getMaskParts(), text: translateText('client_models_channel_part', [msg]), channel: name}), 'action part', {time: options.kiwi.time});\r
 \r
             }\r
         }, this);\r
index 9e67ba2bf7de681d2f263ac479ba363d3b11e7b8..5c754d373fd8e1cd816a09339db50f13badd00ab 100644 (file)
 
     function onDisconnect(event) {
         $.each(this.panels.models, function (index, panel) {
-            panel.addMsg('', styleText('network_disconnected', {'%T': translateText('client_models_network_disconnected', [])}), 'action quit');
+            panel.addMsg('', styleText('network_disconnected', {text: translateText('client_models_network_disconnected', [])}), 'action quit');
         });
     }
 
 
 
     function onMotd(event) {
-        this.panels.server.addMsg(this.get('name'), styleText('motd', {'%T': event.msg}), 'motd');
+        this.panels.server.addMsg(this.get('name'), styleText('motd', {text: event.msg}), 'motd');
     }
 
 
             }
         }
 
-        panel.addMsg(event.nick, styleText('privmsg', {'%T': event.msg}), 'privmsg', {time: event.time});
+        panel.addMsg(event.nick, styleText('privmsg', {text: event.msg}), 'privmsg', {time: event.time});
     }
 
 
             member = panel.get('members').getByNick(event.nick);
             if (member) {
                 member.set('nick', event.newnick);
-                panel.addMsg('', styleText('nick_changed', {'%N': event.nick, '%T': translateText('client_models_network_nickname_changed', [event.newnick]), '%C': name}), 'action nick', {time: event.time});
+                panel.addMsg('', styleText('nick_changed', {nick: event.nick, text: translateText('client_models_network_nickname_changed', [event.newnick]), channel: name}), 'action nick', {time: event.time});
             }
         });
     }
             return;
         }
 
-        this.panels.server.addMsg('[' + event.nick + ']',  styleText('ctcp', {'%T': event.msg}), 'ctcp', {time: event.time});
+        this.panels.server.addMsg('[' + event.nick + ']',  styleText('ctcp', {text: event.msg}), 'ctcp', {time: event.time});
     }
 
 
             panel = this.panels.server;
         }
 
-        panel.addMsg('[' + (event.nick||'') + ']', styleText('notice', {'%T': event.msg}), 'notice', {time: event.time});
+        panel.addMsg('[' + (event.nick||'') + ']', styleText('notice', {text: event.msg}), 'notice', {time: event.time});
 
         // Show this notice to the active panel if it didn't have a set target, but only in an active channel or query window
         active_panel = _kiwi.app.panels().active;
 
         if (!event.from_server && panel === this.panels.server && active_panel !== this.panels.server) {
             if (active_panel.isChannel() || active_panel.isQuery())
-            _kiwi.app.panels().active.addMsg('[' + (event.nick||'') + ']', styleText('notice', {'%T': event.msg}), 'notice', {time: event.time});
+            _kiwi.app.panels().active.addMsg('[' + (event.nick||'') + ']', styleText('notice', {text: event.msg}), 'notice', {time: event.time});
         }
     }
 
             }
         }
 
-        panel.addMsg('', styleText('action', {'%N': event.nick, '%T': event.msg}), 'action', {time: event.time});
+        panel.addMsg('', styleText('action', {nick: event.nick, text: event.msg}), 'action', {time: event.time});
     }
 
 
         if (!c) return;
 
         when = formatDate(new Date(event.when * 1000));
-        c.addMsg('', styleText('channel_topic_setby', {'%T': translateText('client_models_network_topic', [event.nick, when]), '%C': event.channel}), 'topic');
+        c.addMsg('', styleText('channel_topic_setby', {text: translateText('client_models_network_topic', [event.nick, when]), channel: event.channel}), 'topic');
     }
 
 
                     request_updated_banlist = true;
             }
 
-            channel.addMsg('', styleText('mode', {'%N': event.nick, '%T': translateText('client_models_network_mode', [friendlyModeString()]), '%C': event.target}), 'action mode', {time: event.time});
+            channel.addMsg('', styleText('mode', {nick: event.nick, text: translateText('client_models_network_mode', [friendlyModeString()]), channel: event.target}), 'action mode', {time: event.time});
 
             // TODO: Be smart, remove the specific ban from the banlist rather than request a whole banlist
             if (request_updated_banlist)
         } else {
             // This is probably a mode being set on us.
             if (event.target.toLowerCase() === this.get("nick").toLowerCase()) {
-                this.panels.server.addMsg('', styleText('selfmode', {'%N': event.nick, '%T': translateText('client_models_network_mode', [friendlyModeString()]), '%C': event.target}), 'action mode');
+                this.panels.server.addMsg('', styleText('selfmode', {nick: event.nick, text: translateText('client_models_network_mode', [friendlyModeString()]), channel: event.target}), 'action mode');
             } else {
                console.log('MODE command recieved for unknown target %s: ', event.target, event);
             }
 
         panel = _kiwi.app.panels().active;
         if (event.ident) {
-            panel.addMsg(event.nick, styleText('whois_ident', {'%N': event.nick, '%J': event.ident, '%H': event.host, '%T': event.msg}), 'whois');
+            panel.addMsg(event.nick, styleText('whois_ident', {nick: event.nick, ident: event.ident, host: event.host, text: event.msg}), 'whois');
 
         } else if (event.chans) {
-            panel.addMsg(event.nick, styleText('whois_channels', {'%N': event.nick, '%T': translateText('client_models_network_channels', [event.chans])}), 'whois');
+            panel.addMsg(event.nick, styleText('whois_channels', {nick: event.nick, text: translateText('client_models_network_channels', [event.chans])}), 'whois');
         } else if (event.irc_server) {
-            panel.addMsg(event.nick, styleText('whois_server', {'%N': event.nick, '%T': translateText('client_models_network_server', [event.irc_server, event.server_info])}), 'whois');
+            panel.addMsg(event.nick, styleText('whois_server', {nick: event.nick, text: translateText('client_models_network_server', [event.irc_server, event.server_info])}), 'whois');
         } else if (event.msg) {
-            panel.addMsg(event.nick, styleText('whois', {'%T': event.msg}), 'whois');
+            panel.addMsg(event.nick, styleText('whois', {text: event.msg}), 'whois');
         } else if (event.logon) {
             logon_date = new Date();
             logon_date.setTime(event.logon * 1000);
             logon_date = formatDate(logon_date);
 
-            panel.addMsg(event.nick, styleText('whois_idle_and_signon', {'%N': event.nick, '%T': translateText('client_models_network_idle_and_signon', [idle_time, logon_date])}), 'whois');
+            panel.addMsg(event.nick, styleText('whois_idle_and_signon', {nick: event.nick, text: translateText('client_models_network_idle_and_signon', [idle_time, logon_date])}), 'whois');
         } else if (event.away_reason) {
-            panel.addMsg(event.nick, styleText('whois_away', {'%N': event.nick, '%T': translateText('client_models_network_away', [event.away_reason])}), 'whois');
+            panel.addMsg(event.nick, styleText('whois_away', {nick: event.nick, text: translateText('client_models_network_away', [event.away_reason])}), 'whois');
         } else {
-            panel.addMsg(event.nick, styleText('whois_idle', {'%N': event.nick, '%T': translateText('client_models_network_idle', [idle_time])}), 'whois');
+            panel.addMsg(event.nick, styleText('whois_idle', {nick: event.nick, text: translateText('client_models_network_idle', [idle_time])}), 'whois');
         }
     }
 
 
         panel = _kiwi.app.panels().active;
         if (event.host) {
-            panel.addMsg(event.nick, styleText('who', {'%N': event.nick, '%J': event.ident, '%H': event.host, '%R': event.real_name, '%T': event.msg}), 'whois');
+            panel.addMsg(event.nick, styleText('who', {nick: event.nick, ident: event.ident, host: event.host, realname: event.real_name, text: event.msg}), 'whois');
         } else {
-            panel.addMsg(event.nick, styleText('whois_notfound', {'%N': event.nick, '%T': translateText('client_models_network_nickname_notfound', [])}), 'whois');
+            panel.addMsg(event.nick, styleText('whois_notfound', {nick: event.nick, text: translateText('client_models_network_nickname_notfound', [])}), 'whois');
         }
     }
 
 
         switch (event.error) {
         case 'banned_from_channel':
-            panel.addMsg(' ', styleText('channel_banned', {'%N': event.nick, '%T': translateText('client_models_network_banned', [event.channel, event.reason]), '%C': event.channel}), 'status');
+            panel.addMsg(' ', styleText('channel_banned', {nick: event.nick, text: translateText('client_models_network_banned', [event.channel, event.reason]), channel: event.channel}), 'status');
             _kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_banned').fetch(event.channel, event.reason));
             break;
         case 'bad_channel_key':
-            panel.addMsg(' ', styleText('channel_badkey', {'%N': event.nick, '%T': translateText('client_models_network_channel_badkey', [event.channel]), '%C': event.channel}), 'status');
+            panel.addMsg(' ', styleText('channel_badkey', {nick: event.nick, text: translateText('client_models_network_channel_badkey', [event.channel]), channel: event.channel}), 'status');
             _kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_badkey').fetch(event.channel));
             break;
         case 'invite_only_channel':
-            panel.addMsg(' ', styleText('channel_inviteonly', {'%N': event.nick, '%T': translateText('client_models_network_channel_inviteonly', [event.nick, event.channel]), '%C': event.channel}), 'status');
+            panel.addMsg(' ', styleText('channel_inviteonly', {nick: event.nick, text: translateText('client_models_network_channel_inviteonly', [event.nick, event.channel]), channel: event.channel}), 'status');
             _kiwi.app.message.text(event.channel + ' ' + _kiwi.global.i18n.translate('client_models_network_channel_inviteonly').fetch());
             break;
         case 'user_on_channel':
-            panel.addMsg(' ', styleText('channel_alreadyin', {'%N': event.nick, '%T': translateText('client_models_network_channel_alreadyin'), '%C': event.channel}));
+            panel.addMsg(' ', styleText('channel_alreadyin', {nick: event.nick, text: translateText('client_models_network_channel_alreadyin'), channel: event.channel}));
             break;
         case 'channel_is_full':
-            panel.addMsg(' ', styleText('channel_limitreached', {'%N': event.nick, '%T': translateText('client_models_network_channel_limitreached', [event.channel]), '%C': event.channel}), 'status');
+            panel.addMsg(' ', styleText('channel_limitreached', {nick: event.nick, text: translateText('client_models_network_channel_limitreached', [event.channel]), channel: event.channel}), 'status');
             _kiwi.app.message.text(event.channel + ' ' + _kiwi.global.i18n.translate('client_models_network_channel_limitreached').fetch(event.channel));
             break;
         case 'chanop_privs_needed':
-            panel.addMsg(' ', styleText('chanop_privs_needed', {'%T': event.reason, '%C': event.channel}), 'status');
+            panel.addMsg(' ', styleText('chanop_privs_needed', {text: event.reason, channel: event.channel}), 'status');
             _kiwi.app.message.text(event.reason + ' (' + event.channel + ')');
             break;
         case 'no_such_nick':
             tmp = this.panels.getByName(event.nick);
             if (tmp) {
-                tmp.addMsg(' ', styleText('no_such_nick', {'%N': event.nick, '%T': event.reason, '%C': event.channel}), 'status');
+                tmp.addMsg(' ', styleText('no_such_nick', {nick: event.nick, text: event.reason, channel: event.channel}), 'status');
             } else {
-                this.panels.server.addMsg(' ', styleText('no_such_nick', {'%N': event.nick, '%T': event.reason, '%C': event.channel}), 'status');
+                this.panels.server.addMsg(' ', styleText('no_such_nick', {nick: event.nick, text: event.reason, channel: event.channel}), 'status');
             }
             break;
         case 'nickname_in_use':
-            this.panels.server.addMsg(' ', styleText('nickname_alreadyinuse', {'%N': event.nick, '%T': translateText('client_models_network_nickname_alreadyinuse', [event.nick]), '%C': event.channel}), 'status');
+            this.panels.server.addMsg(' ', styleText('nickname_alreadyinuse', {nick: event.nick, text: translateText('client_models_network_nickname_alreadyinuse', [event.nick]), channel: event.channel}), 'status');
             if (this.panels.server !== this.panels.active) {
                 _kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_nickname_alreadyinuse').fetch(event.nick));
             }
             break;
 
         case 'password_mismatch':
-            this.panels.server.addMsg(' ', styleText('channel_badpassword', {'%N': event.nick, '%T': translateText('client_models_network_badpassword', []), '%C': event.channel}), 'status');
+            this.panels.server.addMsg(' ', styleText('channel_badpassword', {nick: event.nick, text: translateText('client_models_network_badpassword', []), channel: event.channel}), 'status');
             break;
         default:
             // We don't know what data contains, so don't do anything with it.
             display_params.shift();
         }
 
-        this.panels.server.addMsg('', styleText('unknown_command', {'%T': '[' + event.command + '] ' + display_params.join(', ', '')}));
+        this.panels.server.addMsg('', styleText('unknown_command', {text: '[' + event.command + '] ' + display_params.join(', ', '')}));
     }
 }
 
index 7e5e3136446e26b1eefe9de80e3734b201e70b7e..1f24f7cea4ad7869cf69d452d2e8058df0ccffd8 100644 (file)
@@ -243,7 +243,7 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({
             topic = this.model.get("topic");
         }
 
-        this.model.addMsg('', styleText('channel_topic', {'%T': translateText('client_views_channel_topic', [this.model.get('name'), topic]), '%C': this.model.get('name')}), 'topic');
+        this.model.addMsg('', styleText('channel_topic', {text: translateText('client_views_channel_topic', [this.model.get('name'), topic]), channel: this.model.get('name')}), 'topic');
 
         // If this is the active channel then update the topic bar
         if (_kiwi.app.panels().active === this) {