self.authname = authname
self.authpass = authpass
+ self.connecttime = 0 # time at which we received numeric 001
+ self.server = server # the address we try to (re-)connect to
+ self.port = port
+ self.servername = server # the name of the server we got connected to
+
curs = self.parent.query("SELECT chname FROM chans WHERE bot = %s AND active = 1", (self.permnick,))
if curs:
chansres = curs.fetchall()
one = { #things to look for after source
'NOTICE': self._gotconnected,
'001': self._got001,
+ '004': self._got004,
'376': self._gotRegistered,
'422': self._gotRegistered,
'PRIVMSG': self._gotprivmsg,
sys.exit(2)
os._exit(2)
def _got001(self, pieces):
- pass # wait until the end of MOTD instead
+ # We wait until the end of MOTD instead to consider ourselves registered, but consider uptime as of 001
+ self.connecttime = time.time()
+ def _got004(self, pieces):
+ self.servername = pieces[3]
def _gotRegistered(self, pieces):
self.conn.registered(True)