From: Darren Date: Mon, 21 Apr 2014 01:20:42 +0000 (+0100) Subject: Removing text theme formatting chars from application code; Use more-readable names... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9ec48c54cddc02127b70ad63d86a195be32868c6;p=KiwiIRC.git Removing text theme formatting chars from application code; Use more-readable names instead of single chars for text theming --- diff --git a/client/assets/text_themes/symbols.json b/client/assets/text_themes/symbols.json index 9139fc5..76b8708 100644 --- a/client/assets/text_themes/symbols.json +++ b/client/assets/text_themes/symbols.json @@ -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 diff --git a/client/src/helpers/utils.js b/client/src/helpers/utils.js index 1779f6a..b8fe808 100644 --- a/client/src/helpers/utils.js +++ b/client/src/helpers/utils.js @@ -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 diff --git a/client/src/models/application.js b/client/src/models/application.js index 49bbc0a..53fa40c 100644 --- a/client/src/models/application.js +++ b/client/src/models/application.js @@ -192,13 +192,13 @@ // Mention the disconnection on every channel _kiwi.app.connections.forEach(function(connection) { - connection.panels.server.addMsg('', styleText('quit', {'%T': msg}), 'action quit'); + connection.panels.server.addMsg('', styleText('quit', {text: msg}), 'action quit'); connection.panels.forEach(function(panel) { if (!panel.isChannel()) return; - panel.addMsg('', styleText('quit', {'%T': msg}), 'action quit'); + panel.addMsg('', styleText('quit', {text: msg}), 'action quit'); }); }); @@ -211,7 +211,7 @@ // Only need to mention the repeating re-connection messages on server panels _kiwi.app.connections.forEach(function(connection) { - connection.panels.server.addMsg('', styleText('quit', {'%T': msg}), 'action quit'); + connection.panels.server.addMsg('', styleText('quit', {text: msg}), 'action quit'); }); }); @@ -227,13 +227,13 @@ // Mention the re-connection on every channel _kiwi.app.connections.forEach(function(connection) { - connection.panels.server.addMsg('', styleText('rejoin', {'%T': msg}), 'action join'); + connection.panels.server.addMsg('', styleText('rejoin', {text: msg}), 'action join'); connection.panels.forEach(function(panel) { if (!panel.isChannel()) return; - panel.addMsg('', styleText('rejoin', {'%T': msg}), 'action join'); + panel.addMsg('', styleText('rejoin', {text: msg}), 'action join'); }); }); @@ -390,13 +390,13 @@ } // Read the value to the user - _kiwi.app.panels().active.addMsg('', styleText('set_setting', {'%T': setting + ' = ' + _kiwi.global.settings.get(setting).toString()})); + _kiwi.app.panels().active.addMsg('', styleText('set_setting', {text: setting + ' = ' + _kiwi.global.settings.get(setting).toString()})); }; fn_to_bind['command:save'] = function (ev) { _kiwi.global.settings.save(); - _kiwi.app.panels().active.addMsg('', styleText('settings_saved', {'%T': translateText('client_models_application_settings_saved')})); + _kiwi.app.panels().active.addMsg('', styleText('settings_saved', {text: translateText('client_models_application_settings_saved')})); }; @@ -406,7 +406,7 @@ // No parameters passed so list them if (!ev.params[1]) { $.each(controlbox.preprocessor.aliases, function (name, rule) { - _kiwi.app.panels().server.addMsg(' ', styleText('list_aliases', {'%T': name + ' => ' + rule})); + _kiwi.app.panels().server.addMsg(' ', styleText('list_aliases', {text: name + ' => ' + rule})); }); return; } @@ -438,12 +438,12 @@ // No parameters passed so list them if (!ev.params[0]) { if (list.length > 0) { - _kiwi.app.panels().active.addMsg(' ', styleText('ignore_title', {'%T': translateText('client_models_application_ignore_title')})); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_title', {text: translateText('client_models_application_ignore_title')})); $.each(list, function (idx, ignored_pattern) { - _kiwi.app.panels().active.addMsg(' ', styleText('ignored_pattern', {'%T': ignored_pattern})); + _kiwi.app.panels().active.addMsg(' ', styleText('ignored_pattern', {text: ignored_pattern})); }); } else { - _kiwi.app.panels().active.addMsg(' ', styleText('ignore_none', {'%T': translateText('client_models_application_ignore_none')})); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_none', {text: translateText('client_models_application_ignore_none')})); } return; } @@ -451,7 +451,7 @@ // We have a parameter, so add it list.push(ev.params[0]); this.connections.active_connection.set('ignore_list', list); - _kiwi.app.panels().active.addMsg(' ', styleText('ignore_nick', {'%T': translateText('client_models_application_ignore_nick', [ev.params[0]])})); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_nick', {text: translateText('client_models_application_ignore_nick', [ev.params[0]])})); }; @@ -459,7 +459,7 @@ var list = this.connections.active_connection.get('ignore_list'); if (!ev.params[0]) { - _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stop_notice', {'%T': translateText('client_models_application_ignore_stop_notice')})); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stop_notice', {text: translateText('client_models_application_ignore_stop_notice')})); return; } @@ -469,7 +469,7 @@ this.connections.active_connection.set('ignore_list', list); - _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stopped', {'%T': translateText('client_models_application_ignore_stopped', [ev.params[0]])})); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stopped', {text: translateText('client_models_application_ignore_stopped', [ev.params[0]])})); }; @@ -529,7 +529,7 @@ if (message) { this.connections.active_connection.gateway.msg(panel.get('name'), message); - panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('query', {'%T': message})); + panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('query', {text: message})); } } @@ -542,7 +542,7 @@ ev.params.shift(); message = formatToIrcMsg(ev.params.join(' ')); - panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('msg', {'%T': message})); + panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('msg', {text: message})); this.connections.active_connection.gateway.msg(destination, message); } @@ -552,7 +552,7 @@ } var panel = _kiwi.app.panels().active; - panel.addMsg('', styleText('action', {'%N': _kiwi.app.connections.active_connection.get('nick'), '%T': ev.params.join(' ')}), 'action'); + panel.addMsg('', styleText('action', {nick: _kiwi.app.connections.active_connection.get('nick'), text: ev.params.join(' ')}), 'action'); this.connections.active_connection.gateway.action(panel.get('name'), ev.params.join(' ')); } @@ -667,7 +667,7 @@ if (_kiwi.applets[ev.params[0]]) { panel.load(new _kiwi.applets[ev.params[0]]()); } else { - _kiwi.app.panels().server.addMsg('', styleText('applet_notfound', {'%T': translateText('client_models_application_applet_notfound', [ev.params[0]])})); + _kiwi.app.panels().server.addMsg('', styleText('applet_notfound', {text: translateText('client_models_application_applet_notfound', [ev.params[0]])})); return; } } @@ -694,7 +694,7 @@ _kiwi.app.connections.active_connection.gateway.raw('INVITE ' + nick + ' ' + channel); - _kiwi.app.panels().active.addMsg('', styleText('channel_has_been_invited', {'%N': nick, '%T': translateText('client_models_application_has_been_invited', [channel])}), 'action'); + _kiwi.app.panels().active.addMsg('', styleText('channel_has_been_invited', {nick: nick, text: translateText('client_models_application_has_been_invited', [channel])}), 'action'); } @@ -729,14 +729,14 @@ if (ev.params[0]) { _kiwi.gateway.setEncoding(null, ev.params[0], function (success) { if (success) { - _kiwi.app.panels().active.addMsg('', styleText('encoding_changed', {'%T': translateText('client_models_application_encoding_changed', [ev.params[0]])})); + _kiwi.app.panels().active.addMsg('', styleText('encoding_changed', {text: translateText('client_models_application_encoding_changed', [ev.params[0]])})); } else { - _kiwi.app.panels().active.addMsg('', styleText('encoding_invalid', {'%T': translateText('client_models_application_encoding_invalid', [ev.params[0]])})); + _kiwi.app.panels().active.addMsg('', styleText('encoding_invalid', {text: translateText('client_models_application_encoding_invalid', [ev.params[0]])})); } }); } else { - _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_notspecified', {'%T': translateText('client_models_application_encoding_notspecified')})); - _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_usage', {'%T': translateText('client_models_application_encoding_usage')})); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_notspecified', {text: translateText('client_models_application_encoding_notspecified')})); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_usage', {text: translateText('client_models_application_encoding_usage')})); } } @@ -798,7 +798,7 @@ // Use the same nick as we currently have nick = _kiwi.app.connections.active_connection.get('nick'); - _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_connecting', {'%T': translateText('client_models_application_connection_connecting', [server, port.toString()])})); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_connecting', {text: translateText('client_models_application_connection_connecting', [server, port.toString()])})); _kiwi.gateway.newConnection({ nick: nick, @@ -808,7 +808,7 @@ password: password }, function(err, new_connection) { if (err) - _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_error', {'%T': translateText('client_models_application_connection_error', [server, port.toString(), err.toString()])})); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_error', {text: translateText('client_models_application_connection_error', [server, port.toString(), err.toString()])})); }); } diff --git a/client/src/models/channel.js b/client/src/models/channel.js index 93746ad..0fe8d43 100644 --- a/client/src/models/channel.js +++ b/client/src/models/channel.js @@ -22,7 +22,7 @@ _kiwi.model.Channel = _kiwi.model.Panel.extend({ return; } - this.addMsg(' ', styleText('channel_join', {'%M': member.getMaskParts(), '%T': translateText('client_models_channel_join'), '%C': name}), 'action join', {time: options.kiwi.time}); + this.addMsg(' ', styleText('channel_join', {member: member.getMaskParts(), text: translateText('client_models_channel_join'), channel: name}), 'action join', {time: options.kiwi.time}); }, this); members.bind("remove", function (member, members, options) { @@ -30,20 +30,20 @@ _kiwi.model.Channel = _kiwi.model.Panel.extend({ var msg = (options.kiwi.message) ? '(' + options.kiwi.message + ')' : ''; if (options.kiwi.type === 'quit' && show_message) { - this.addMsg(' ', styleText('channel_quit', {'%M': member.getMaskParts(), '%T': translateText('client_models_channel_quit', [msg]), '%C': name}), 'action quit', {time: options.kiwi.time}); + this.addMsg(' ', styleText('channel_quit', {member: member.getMaskParts(), text: translateText('client_models_channel_quit', [msg]), channel: name}), 'action quit', {time: options.kiwi.time}); } else if (options.kiwi.type === 'kick') { if (!options.kiwi.current_user_kicked) { //If user kicked someone, show the message regardless of settings. if (show_message || options.kiwi.current_user_initiated) { - 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}); + 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}); } } else { - this.addMsg(' ', styleText('channel_selfkick', {'%T': translateText('client_models_channel_selfkick', [options.kiwi.by, msg]), '%C': name}), 'action kick', {time: options.kiwi.time}); + this.addMsg(' ', styleText('channel_selfkick', {text: translateText('client_models_channel_selfkick', [options.kiwi.by, msg]), channel: name}), 'action kick', {time: options.kiwi.time}); } } else if (show_message) { - this.addMsg(' ', styleText('channel_part', {'%M': member.getMaskParts(), '%T': translateText('client_models_channel_part', [msg]), '%C': name}), 'action part', {time: options.kiwi.time}); + this.addMsg(' ', styleText('channel_part', {member: member.getMaskParts(), text: translateText('client_models_channel_part', [msg]), channel: name}), 'action part', {time: options.kiwi.time}); } }, this); diff --git a/client/src/models/network.js b/client/src/models/network.js index 9e67ba2..5c754d3 100644 --- a/client/src/models/network.js +++ b/client/src/models/network.js @@ -241,7 +241,7 @@ 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'); }); } @@ -293,7 +293,7 @@ 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'); } @@ -424,7 +424,7 @@ } } - 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}); } @@ -441,7 +441,7 @@ 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}); } }); } @@ -468,7 +468,7 @@ 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}); } @@ -502,14 +502,14 @@ 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}); } } @@ -541,7 +541,7 @@ } } - 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}); } @@ -568,7 +568,7 @@ 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'); } @@ -706,7 +706,7 @@ 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) @@ -715,7 +715,7 @@ } 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); } @@ -737,24 +737,24 @@ 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'); } } @@ -766,9 +766,9 @@ 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'); } } @@ -802,38 +802,38 @@ 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)); } @@ -846,7 +846,7 @@ 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. @@ -863,7 +863,7 @@ 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(', ', '')})); } } diff --git a/client/src/views/channel.js b/client/src/views/channel.js index 7e5e313..1f24f7c 100644 --- a/client/src/views/channel.js +++ b/client/src/views/channel.js @@ -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) {