mirror of
https://github.com/progval/Limnoria.git
synced 2025-05-05 09:50:52 -05:00
Add handling of 437 (nick temporarily unavailable) errors
Servers bind a nick to a connection for a short window after it disappears to try and avoid contention over nicks. This may cause a 437 during connection to a server (c.f. ProgVal/Limnoria#1033) or even during normal nick changes, if the timing is lucky. Add handling for this error to the startup code and the Admin plugin. Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
parent
c3695c9419
commit
cffbd959e8
@ -49,8 +49,8 @@ class Admin(callbacks.Plugin):
|
|||||||
def do437(self, irc, msg):
|
def do437(self, irc, msg):
|
||||||
"""Nick/channel temporarily unavailable."""
|
"""Nick/channel temporarily unavailable."""
|
||||||
target = msg.args[0]
|
target = msg.args[0]
|
||||||
|
t = time.time() + 30
|
||||||
if irc.isChannel(target): # We don't care about nicks.
|
if irc.isChannel(target): # We don't care about nicks.
|
||||||
t = time.time() + 30
|
|
||||||
# Let's schedule a rejoin.
|
# Let's schedule a rejoin.
|
||||||
networkGroup = conf.supybot.networks.get(irc.network)
|
networkGroup = conf.supybot.networks.get(irc.network)
|
||||||
def rejoin():
|
def rejoin():
|
||||||
@ -60,6 +60,16 @@ class Admin(callbacks.Plugin):
|
|||||||
schedule.addEvent(rejoin, t)
|
schedule.addEvent(rejoin, t)
|
||||||
self.log.info('Scheduling a rejoin to %s at %s; '
|
self.log.info('Scheduling a rejoin to %s at %s; '
|
||||||
'Channel temporarily unavailable.', target, t)
|
'Channel temporarily unavailable.', target, t)
|
||||||
|
else:
|
||||||
|
irc = self.pendingNickChanges.get(irc, None)
|
||||||
|
if irc is not None:
|
||||||
|
def nick():
|
||||||
|
irc.queueMsg(ircmsgs.nick(target))
|
||||||
|
schedule.addEvent(nick, t)
|
||||||
|
self.log.info('Scheduling a nick change to %s at %s; '
|
||||||
|
'Nick temporarily unavailable.', target, t)
|
||||||
|
else:
|
||||||
|
self.log.debug('Got 437 without Admin.nick being called.')
|
||||||
|
|
||||||
def do471(self, irc, msg):
|
def do471(self, irc, msg):
|
||||||
try:
|
try:
|
||||||
|
@ -939,8 +939,11 @@ class Irc(IrcCommandDispatcher):
|
|||||||
if not self.afterConnect:
|
if not self.afterConnect:
|
||||||
newNick = self._getNextNick()
|
newNick = self._getNextNick()
|
||||||
assert newNick != self.nick
|
assert newNick != self.nick
|
||||||
log.info('Got 433: %s %s. Trying %s.',self.nick, problem, newNick)
|
log.info('Got %s: %s %s. Trying %s.',
|
||||||
|
msg.command, self.nick, problem, newNick)
|
||||||
self.sendMsg(ircmsgs.nick(newNick))
|
self.sendMsg(ircmsgs.nick(newNick))
|
||||||
|
def do437(self, msg):
|
||||||
|
self.do43x(msg, 'is temporarily unavailable')
|
||||||
def do433(self, msg):
|
def do433(self, msg):
|
||||||
self.do43x(msg, 'is in use')
|
self.do43x(msg, 'is in use')
|
||||||
def do432(self, msg):
|
def do432(self, msg):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user