//this.gateway.on('all', function() {console.log('ALL', this.get('connection_id'), arguments);});
this.gateway.on('connect', onConnect, this);
+ this.gateway.on('disconnect', onDisconnect, this);
this.gateway.on('nick', function(event) {
if (event.nick === this.get('nick')) {
this.gateway.on('quit', onQuit, this);
this.gateway.on('kick', onKick, this);
this.gateway.on('msg', onMsg, this);
+ this.gateway.on('nick', onNick, this);
this.gateway.on('ctcp_request', onCtcpRequest, this);
this.gateway.on('ctcp_response', onCtcpResponse, this);
this.gateway.on('notice', onNotice, this);
});
+
+ function onDisconnect(event) {
+ $.each(this.panels.models, function (index, panel) {
+ panel.addMsg('', 'Disconnected from the IRC network', 'action quit');
+ });
+ }
+
+
function onConnect(event) {
var panels, channel_names;
+ function onNick(event) {
+ var member;
+
+ $.each(this.panels.models, function (index, panel) {
+ if (panel.get('name') == event.nick)
+ panel.set('name', event.newnick);
+
+ if (!panel.isChannel()) return;
+
+ member = panel.get('members').getByNick(event.nick);
+ if (member) {
+ member.set('nick', event.newnick);
+ panel.addMsg('', '== ' + event.nick + ' is now known as ' + event.newnick, 'action nick');
+ }
+ });
+ }
+
+
+
function onCtcpRequest(event) {
// An ignored user? don't do anything with it
if (_kiwi.gateway.isNickIgnored(event.nick)) {
}
panel.addMsg('[' + (event.nick||'') + ']', event.msg);
+
+ // Show this notice to the active panel if it didn't have a set target
+ if (panel === this.panels.server)
+ _kiwi.app.panels().active.addMsg('[' + (event.nick||'') + ']', event.msg);
}
logon_date = formatDate(logon_date);
panel.addMsg(event.nick, 'idle for ' + idle_time + ', signed on ' + logon_date, 'whois');
+ } else if (event.away_reason) {
+ panel.addMsg(event.nick, 'Away: ' + event.away_reason, 'whois');
} else {
panel.addMsg(event.nick, 'idle for ' + idle_time, 'whois');
}