Implement counting nickname changes and remove check on listener

This commit is contained in:
Mark Veidemanis 2018-03-10 14:01:43 +00:00
parent da6c45f093
commit 5b1e3c6fb1
2 changed files with 7 additions and 6 deletions

View File

@ -101,6 +101,10 @@ class IRCBot(IRCClient):
newnick = nickname + "_" newnick = nickname + "_"
return newnick return newnick
def nickChanged(self, nick):
self.nickname = nick
count.event(self.name, "selfnick")
def irc_ERR_NICKNAMEINUSE(self, prefix, params): def irc_ERR_NICKNAMEINUSE(self, prefix, params):
self._attemptedNick = self.alterCollidedNick(self._attemptedNick) self._attemptedNick = self.alterCollidedNick(self._attemptedNick)
self.setNick(self._attemptedNick) self.setNick(self._attemptedNick)

View File

@ -34,13 +34,10 @@ class Server(Protocol):
def connectionLost(self, reason): def connectionLost(self, reason):
self.authed = False self.authed = False
log("Connection lost from %s:%s -- %s" % (self.addr.host, self.addr.port, reason.getErrorMessage())) log("Connection lost from %s:%s -- %s" % (self.addr.host, self.addr.port, reason.getErrorMessage()))
if not listener == None: if self.addr in connections.keys():
if self.addr in connections.keys(): del connections[self.addr]
del connections[self.addr]
else:
warn("Tried to remove a non-existant connection.")
else: else:
warn("Tried to remove a connection from a listener that wasn't running.") warn("Tried to remove a non-existant connection.")
if self.addr in MonitorPool: if self.addr in MonitorPool:
MonitorPool.remove(self.addr) MonitorPool.remove(self.addr)