var handlers = {
RPL_WELCOME: function (command) {
var nick = command.params[0];
- this.irc_connection.registered = true;
this.cap_negotiation = false;
this.emit('server ' + this.irc_connection.irc_host.hostname + ' connect', {
nick: nick
// Max number of lines to write a second
this.write_buffer_lines_second = 2;
- // If registeration with the IRCd has completed
- this.registered = false;
-
// If we are in the CAP negotiation stage
this.cap_negotiation = true;
that.socket.on('close', function socketCloseCb(had_error) {
// If that.connected is false, we never actually managed to connect
var was_connected = that.connected,
- had_registered = that.server.registered,
+ safely_registered = (new Date()) - that.server.registered > 10000, // Safely = registered + 10secs after.
should_reconnect = false;
that.connected = false;
should_reconnect = true;
// If this was an unplanned disconnect and we were originally connected OK, reconnect
- } else if (!that.requested_disconnect && was_connected && had_registered) {
+ } else if (!that.requested_disconnect && was_connected && safely_registered) {
should_reconnect = true;
} else {
this.list_buffer = [];
this.motd_buffer = '';
+ // Date when registeration with the IRCd had completed
this.registered = false;
this.irc_events = {
function onConnect(event) {
- this.registered = true;
+ this.registered = new Date();
this.irc_connection.clientEvent('connect', {
nick: event.nick