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 + "_"
return newnick
def nickChanged(self, nick):
self.nickname = nick
count.event(self.name, "selfnick")
def irc_ERR_NICKNAMEINUSE(self, prefix, params):
self._attemptedNick = self.alterCollidedNick(self._attemptedNick)
self.setNick(self._attemptedNick)

View File

@ -34,13 +34,10 @@ class Server(Protocol):
def connectionLost(self, reason):
self.authed = False
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():
del connections[self.addr]
else:
warn("Tried to remove a non-existant connection.")
if self.addr in connections.keys():
del connections[self.addr]
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:
MonitorPool.remove(self.addr)