summaryrefslogtreecommitdiffstats
path: root/webchat/serverCommands.js
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2013-11-11 18:05:25 +0100
committerlassulus <lassulus@googlemail.com>2013-11-11 18:05:25 +0100
commitbc0a0e1ec282bcfc7aa2ef9eb444b2403d0c7199 (patch)
tree5702abe66d226370e58f721679b2253760fd7737 /webchat/serverCommands.js
parentd577b700aa39c6dba270cbc9c11f3777866d4a69 (diff)
webchat: refactor into serverCommands.js
Diffstat (limited to 'webchat/serverCommands.js')
-rw-r--r--webchat/serverCommands.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/webchat/serverCommands.js b/webchat/serverCommands.js
new file mode 100644
index 00000000..05c9ea0e
--- /dev/null
+++ b/webchat/serverCommands.js
@@ -0,0 +1,26 @@
+
+
+var serverCommands = {};
+serverCommands.say = function (settings, params) {
+ var nick = settings.nick
+ var message = params.msg
+ params.nick = nick
+ irc_client.say("#krebs", nick + ' → ' + message);
+ return clients.notifyAll('message', params)
+// return clients.broadcast({ method: 'message', params: params })
+
+}
+
+serverCommands.nick = function (settings, params) {
+ var oldnick = settings.nick || settings.conn.remoteAddress
+ var newnick = params.nick
+ settings.nick = newnick
+ return clients.notifyAll('nickchange', { nick: oldnick, newnick: newnick });
+// return clients.broadcast({ method: 'nickchange', params: { nick: oldnick, newnick: newnick }})
+}
+
+serverCommands.badcommand = function (settings, params) {
+ settings.conn.write(JSON.stringify({ method: 'usererror', params: { message: 'bad command' }}))
+}
+
+module.exports = serverCommands