Moving index.html out of the assets folder - the page is not an asset of itself
[KiwiIRC.git] / server / controlinterface.js
index 2d0a88ac85cf40cdce453381b264a944e3b7544f..091bc1fa486e006ad9c2086ae5d2109061689f34 100644 (file)
@@ -84,25 +84,26 @@ commands.stats = function(args, raw) {
 
 commands.reconfig = function(args, raw) {
     if (config.loadConfig()) {
-        console.log('New config file loaded');
+        this.write('New config file loaded');
     } else {
-        console.log("No new config file was loaded");
+        this.write("No new config file was loaded");
     }
 };
 
 
 commands.rehash = function(args, raw) {
     rehash.rehashAll();
-    console.log('Rehashed');
+    this.write('Rehashed');
 };
 
 
 commands.jumpserver = function(args, raw) {
-    var num_clients = _.size(global.clients.clients),
+    var that = this,
+        num_clients = _.size(global.clients.clients),
         packet = {}, args_idx;
 
     if (num_clients === 0) {
-        console.log('No connected clients');
+        this.write('No connected clients');
         return;
     }
 
@@ -113,9 +114,14 @@ commands.jumpserver = function(args, raw) {
 
     packet.kiwi_server = args[args_idx];
 
-    console.log('Broadcasting jumpserver to ' + num_clients.toString() + ' clients..');
+    if (!packet.kiwi_server) {
+        this.write('No Kiwi server specified');
+        return;
+    }
+
+    this.write('Broadcasting jumpserver to ' + num_clients.toString() + ' clients..');
     global.clients.broadcastKiwiCommand('jumpserver', packet, function() {
-        console.log('Broadcast complete.');
+        that.write('Broadcast complete.');
     });
 };