-function kiwiCommand(command, callback) {
- var that = this;
-
- if (typeof callback !== 'function') {
- callback = function () {};
- }
- switch (command.command) {
- case 'connect':
- if (command.hostname && command.port && command.nick) {
- var con;
-
- if (global.config.restrict_server) {
- this.state.connect(
- global.config.restrict_server,
- global.config.restrict_server_port,
- global.config.restrict_server_ssl,
- command.nick,
- {hostname: this.websocket.handshake.revdns, address: this.websocket.handshake.real_address},
- global.config.restrict_server_password,
- callback);
-
- } else {
- this.state.connect(
- command.hostname,
- command.port,
- command.ssl,
- command.nick,
- {hostname: this.websocket.handshake.revdns, address: this.websocket.handshake.real_address},
- command.password,
- callback);
- }
- } else {
- return callback('Hostname, port and nickname must be specified');
- }
- break;
- default:
- callback();
- }
-}