this.websocket.emit('kiwi', c, callback);
};
+Client.prototype.dispose = function () {
+ websocketDisconnect.apply(this);
+ this.removeAllListeners();
+};
+
function handleClientMessage(msg, callback) {
var server, args, obj, channels, keys;
default:
callback();
}
-};
+}
// Websocket has disconnected, so quit all the IRC connections
_.each(this.irc_connections, function (irc_connection, i, cons) {
if (irc_connection) {
irc_connection.end('QUIT :' + (config.get().quit_message || ''));
+ irc_connection.dispose();
cons[i] = null;
}
});
this.emit('destroy');
-};
+}
// TODO: Should this close all the websocket connections too?
function websocketError() {
this.emit('destroy');
-};
+}
\ No newline at end of file
end.call(this, data + '\r\n', 'utf-8', callback);
};
+IrcConnection.prototype.dispose = function () {
+ this.removeAllListeners();
+};
+
+
var write = function (data, encoding, callback) {
this.socket.write(data, encoding, callback);
};
});
wl.on('destroy', function (client) {
clients = _.reject(clients, function (c) {
- return client === c;
+ if (client === c) {
+ c.dispose();
+ return true;
+ }
+
+ return false;
});
});
});