From: Darren Date: Fri, 30 Nov 2012 20:33:43 +0000 (+0000) Subject: CTCP CLIENTINFO, SOURCE, TIME X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b39bb3318adeb23164d3e980261ac00439f6b524;p=KiwiIRC.git CTCP CLIENTINFO, SOURCE, TIME --- diff --git a/client/assets/dev/model_application.js b/client/assets/dev/model_application.js index 156b0f8..6610a46 100644 --- a/client/assets/dev/model_application.js +++ b/client/assets/dev/model_application.js @@ -416,6 +416,14 @@ _kiwi.model.Application = function () { }); + gw.on('onctcp_request', function (event) { + // Reply to a TIME ctcp + if (event.msg.toUpperCase() === 'TIME') { + gw.ctcp(true, event.type, event.nick, (new Date()).toString()); + } + }); + + gw.on('onnotice', function (event) { var panel; diff --git a/server/irc/commands.js b/server/irc/commands.js index 36e8e63..ca710ad 100644 --- a/server/irc/commands.js +++ b/server/irc/commands.js @@ -322,8 +322,20 @@ var listeners = { this.client.sendIrcCommand('kiwi', {server: this.con_num, namespace: namespace, data: tmp.substr(namespace.length + 1)}); } else if (command.trailing.substr(1, 7) === 'VERSION') { this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'VERSION KiwiIRC' + String.fromCharCode(1)); + } else if (command.trailing.substr(1, 6) === 'SOURCE') { + this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'SOURCE http://www.kiwiirc.com/' + String.fromCharCode(1)); + } else if (command.trailing.substr(1, 10) === 'CLIENTINFO') { + this.irc_connection.write('NOTICE ' + command.nick + ' :' + String.fromCharCode(1) + 'CLIENTINFO SOURCE VERSION TIME' + String.fromCharCode(1)); } else { - this.client.sendIrcCommand('ctcp_request', {server: this.con_num, nick: command.nick, ident: command.ident, hostname: command.hostname, channel: command.params[0], msg: command.trailing.substr(1, command.trailing.length - 2)}); + this.client.sendIrcCommand('ctcp_request', { + server: this.con_num, + nick: command.nick, + ident: command.ident, + hostname: command.hostname, + target: command.params[0], + type: (command.trailing.substr(1, command.trailing.length - 2).split(' ') || [null])[0], + msg: command.trailing.substr(1, command.trailing.length - 2) + }); } } else { //{nick: msg.nick, ident: msg.ident, hostname: msg.hostname, channel: msg.params.trim(), msg: msg.trailing}