this.gateway.on('away', onAway, this);
this.gateway.on('list_start', onListStart, this);
this.gateway.on('irc_error', onIrcError, this);
+ this.gateway.on('unknown_command', onUnknownCommand, this);
},
panel.addMsg(' ', '== ' + _kiwi.global.i18n.translate('client_models_network_channel_inviteonly').fetch(event.channel), 'status');
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_inviteonly').fetch(event.channel));
break;
+ case 'user_on_channel':
+ panel.addMsg(' ', '== ' + event.nick + ' is already on this channel');
+ break;
case 'channel_is_full':
panel.addMsg(' ', '== ' + _kiwi.global.i18n.translate('client_models_network_channel_limitreached').fetch(event.channel), 'status');
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_limitreached').fetch(event.channel));
//_kiwi.front.tabviews.server.addMsg(null, ' ', '== ' + data, 'status');
}
}
+
+
+ function onUnknownCommand(event) {
+ var display_params = _.clone(event.params);
+
+ // A lot of commands have our nick as the first parameter. This is redundant for us
+ if (display_params[0] && display_params[0] == this.get('nick')) {
+ display_params.shift();
+ }
+
+ if (event.trailing)
+ display_params.push(event.trailing);
+
+ this.panels.server.addMsg('', '[' + event.command + '] ' + display_params.join(', ', ''));
+ }
}
)();
'321': 'RPL_LISTSTART',
'322': 'RPL_LIST',
'323': 'RPL_LISTEND',
+ '330': 'RPL_WHOISACCOUNT',
'331': 'RPL_NOTOPIC',
'332': 'RPL_TOPIC',
'333': 'RPL_TOPICWHOTIME',
'372': 'RPL_MOTD',
'375': 'RPL_MOTDSTART',
'376': 'RPL_ENDOFMOTD',
+ '378': 'RPL_WHOISHOST',
'379': 'RPL_WHOISMODES',
'401': 'ERR_NOSUCHNICK',
'404': 'ERR_CANNOTSENDTOCHAN',
'433': 'ERR_NICKNAMEINUSE',
'441': 'ERR_USERNOTINCHANNEL',
'442': 'ERR_NOTONCHANNEL',
+ '443': 'ERR_USERONCHANNEL',
'451': 'ERR_NOTREGISTERED',
'464': 'ERR_PASSWDMISMATCH',
'470': 'ERR_LINKCHANNEL',
'481': 'ERR_NOPRIVILEGES',
'482': 'ERR_CHANOPRIVSNEEDED',
'670': 'RPL_STARTTLS',
+ '671': 'RPL_WHOISSECURE',
'900': 'RPL_SASLAUTHENTICATED',
'903': 'RPL_SASLLOGGEDIN',
'904': 'ERR_SASLNOTAUTHORISED',
if (handlers[command]) {
handlers[command].call(this, data);
} else {
- unknownCommand(command, data);
+ unknownCommand.call(this, command, data);
}
};
};
unknownCommand = function (command, data) {
- // TODO: Do something here, log?
-};
+ var params = _.clone(data.params);
+
+ this.irc_connection.emit('server ' + this.irc_connection.irc_host.hostname + ' unknown_command', {
+ command: command,
+ params: params,
+ trailing: data.trailing
+ });
+
+
+/*
+ this.irc_connection.emit(namespace + ' ' + command.params[0] + ' notice', {
+ from_server: command.prefix ? true : false,
+ nick: command.nick || command.prefix || undefined,
+ ident: command.ident,
+ hostname: command.hostname,
+ target: command.params[0],
+ msg: command.trailing
+ });
+ */
+ };
handlers = {
});
},
+ 'RPL_WHOISHOST': function (command) {
+ this.irc_connection.emit('user ' + command.params[1] + ' whoishost', {
+ nick: command.params[1],
+ msg: command.trailing
+ });
+ },
+
+ 'RPL_WHOISSECURE': function (command) {
+ this.irc_connection.emit('user ' + command.params[1] + ' whoissecure', {
+ nick: command.params[1]
+ });
+ },
+
+ 'RPL_WHOISACCOUNT': function (command) {
+ this.irc_connection.emit('user ' + command.params[1] + ' whoisaccount', {
+ nick: command.params[1],
+ account: command.params[2]
+ });
+ },
+
'RPL_WHOWASUSER': function (command) {
this.irc_connection.emit('user ' + command.params[1] + ' whowas', {
nick: command.params[1],
});
},
+ ERR_USERONCHANNEL: function (command) {
+ this.irc_connection.emit('server ' + this.irc_connection.irc_host.hostname + ' user_on_channel', {
+ nick: command.params[1],
+ channel: command.params[2]
+ });
+ },
+
ERR_CHANNELISFULL: function (command) {
this.irc_connection.emit('server ' + this.irc_connection.irc_host.hostname + ' channel_is_full', {
channel: command.params[1],
not_on_channel: onNotOnChannel,
channel_is_full: onChannelIsFull,
invite_only_channel: onInviteOnlyChannel,
+ user_on_channel: onUserAlreadyInChannel,
banned_from_channel: onBannedFromChannel,
bad_channel_key: onBadChannelKey,
chanop_privs_needed: onChanopPrivsNeeded,
nickname_in_use: onNicknameInUse,
- erroneus_nickname: onErroneusNickname
+ erroneus_nickname: onErroneusNickname,
+ unknown_command: onUnknownCommand
};
EventBinder.bindIrcEvents('server *', this.irc_events, this, this.irc_connection);
});
}
+function onUserAlreadyInChannel(event) {
+ this.irc_connection.clientEvent('irc_error', {
+ error: 'user_on_channel',
+ channel: event.channel,
+ nick: event.nick
+ });
+}
+
function onBannedFromChannel(event) {
this.irc_connection.clientEvent('irc_error', {
error: 'banned_from_channel',
reason: event.reason
});
}
+
+function onUnknownCommand(event) {
+ this.irc_connection.clientEvent('unknown_command', {
+ error: 'unknown_command',
+ command: event.command,
+ params: event.params,
+ trailing: event.trailing
+ });
+}
whoisidle: onWhoisIdle,\r
whoisregnick: onWhoisRegNick,\r
whoisserver: onWhoisServer,\r
+ whoishost: onWhoisHost,\r
+ whoissecure: onWhoisSecure,\r
+ whoisaccount: onWhoisAccount,\r
endofwhois: onWhoisEnd,\r
whowas: onWhoWas,\r
endofwhowas: onWhoWasEnd,\r
});\r
}\r
\r
+function onWhoisHost(event) {\r
+ this.irc_connection.clientEvent('whois', {\r
+ nick: event.nick,\r
+ msg: event.msg,\r
+ end: false\r
+ });\r
+}\r
+\r
+function onWhoisSecure(event) {\r
+ this.irc_connection.clientEvent('whois', {\r
+ nick: event.nick,\r
+ msg: 'Using a secure connection',\r
+ end: false\r
+ });\r
+}\r
+\r
+function onWhoisAccount(event) {\r
+ this.irc_connection.clientEvent('whois', {\r
+ nick: event.nick,\r
+ msg: 'Logged in as ' + event.account,\r
+ end: false\r
+ });\r
+}\r
+\r
function onWhoisEnd(event) {\r
this.irc_connection.clientEvent('whois', {\r
nick: event.nick,\r