From 9e77d0e2be7e14e3b5c0b4628ab4ae0a82695a51 Mon Sep 17 00:00:00 2001 From: Darren Date: Mon, 22 Jul 2013 22:25:37 +0100 Subject: [PATCH] /invite command handling --- client/assets/src/models/application.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/client/assets/src/models/application.js b/client/assets/src/models/application.js index e2c3789..db5e696 100644 --- a/client/assets/src/models/application.js +++ b/client/assets/src/models/application.js @@ -455,6 +455,8 @@ _kiwi.model.Application = function () { controlbox.on('command:query', queryCommand); + controlbox.on('command:invite', inviteCommand); + controlbox.on('command:topic', topicCommand); controlbox.on('command:notice', noticeCommand); @@ -775,6 +777,27 @@ _kiwi.model.Application = function () { } + + function inviteCommand (ev) { + var nick, channel; + + // A nick must be specified + if (!ev.params[0]) + return; + + // Can only invite into channels + if (!_kiwi.app.panels().active.isChannel()) + return; + + nick = ev.params[0]; + channel = _kiwi.app.panels().active.get('name'); + + _kiwi.app.connections.active_connection.gateway.raw('INVITE ' + nick + ' ' + channel); + + _kiwi.app.panels().active.addMsg('', '== ' + nick + ' has been invited to ' + channel, 'action'); + } + + function whoisCommand (ev) { var nick; -- 2.25.1