rem: ev = new CEvent ("network", "do-connect", this, "onDoConnect"); this.eventPump.addEvent (ev); 
add: this.delayedConnect(); 
context: function net_doconnect(e){    const NS_ERROR_OFFLINE = 0x804b0010;    var c;    // Clear the timer, if there is one.    if ("reconnectTimer" in this)    {        clearTimeout(this.reconnectTimer);        delete this.reconnectTimer;    }    var ev;    if (this.state == NET_CANCELLING)    {        if ("primServ" in this && this.primServ.connection)            this.primServ.connection.disconnect();        else            this.state = NET_OFFLINE;        ev = new CEvent ("network", "error", this, "onError");        ev.server = this;        ev.debug = "Connect sequence was cancelled.";        ev.errorCode = JSIRC_ERR_CANCELLED;        this.eventPump.addEvent(ev);        return false;    }    if ("primServ" in this && this.primServ.isConnected)        return true;    if (this.connectAttempt++ >= this.MAX_CONNECT_ATTEMPTS)    {        this.state = NET_OFFLINE;        ev = new CEvent ("network", "error", this, "onError");        ev.server = this;        ev.debug = "Connection attempts exhausted, giving up.";        ev.errorCode = JSIRC_ERR_EXHAUSTED;        this.eventPump.addEvent(ev);        return false;    }    this.state = NET_CONNECTING; /* connection is considered "made" when server                                  * sends a 001 message (see server.on001) */    var host = this.nextHost++;    if (host >= this.serverList.length)    {        this.nextHost = 1;        host = 0;    }    if (this.serverList[host].isSecure || !this.requireSecurity)    {        ev = new CEvent ("network", "startconnect", this, "onStartConnect");        ev.debug = "Connecting to " + this.serverList[host].unicodeName + ":" +                   this.serverList[host].port + ", attempt " + this.connectAttempt +                   " of " + this.MAX_CONNECT_ATTEMPTS + "...";        ev.host = this.serverList[host].hostname;        ev.port = this.serverList[host].port;        ev.server = this.serverList[host];        ev.connectAttempt = this.connectAttempt;        this.eventPump.addEvent (ev);        try        {            if (!this.serverList[host].connect(null))            {                /* connect failed, try again  */                ev = new CEvent ("network", "do-connect", this, "onDoConnect");                this.eventPump.addEvent (ev);            }        }        catch(ex)        {            this.state = NET_OFFLINE;            ev = new CEvent ("network", "error", this, "onError");            ev.server = this;            ev.debug = "Exception opening socket: " + ex;            ev.errorCode = JSIRC_ERR_NO_SOCKET;            if ((typeof ex == "object") && (ex.result == NS_ERROR_OFFLINE))                ev.errorCode = JSIRC_ERR_OFFLINE;            this.eventPump.addEvent(ev);        }    }    else    {        /* Server doesn't use SSL as requested, try next one.         * In the meantime, correct the connection attempt counter  */        this.connectAttempt--;        ev = new CEvent ("network", "do-connect", this, "onDoConnect");        this.eventPump.addEvent (ev);    }    return true;}
meta: 1567	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1567/7ce7a7a774d0c7cef5bca1fb7a9f3e9d5c03a68c/irc.js/clean/js/lib/irc.js