Skip to content

Commit ac14f05

Browse files
committed
Handle nick error numerics to avoid odd reconnect behaviour
1 parent 75d9364 commit ac14f05

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

plugins/core/core_misc.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def on_join(chan, conn, nick):
3232

3333
@hook.irc_raw('324')
3434
def check_mode(irc_paramlist, conn, message):
35-
#message(", ".join(irc_paramlist), "bloodygonzo")
35+
# message(", ".join(irc_paramlist), "bloodygonzo")
3636
mode = irc_paramlist[2]
3737
require_reg = conn.config.get('require_registered_channels', False)
3838
if not "r" in mode and conn.name == "snoonet" and require_reg:
@@ -125,3 +125,18 @@ def keep_alive(conn):
125125
while True:
126126
conn.cmd('PING', conn.nick)
127127
yield from asyncio.sleep(60)
128+
129+
130+
@hook.irc_raw('433')
131+
def on_nick_in_use(conn, irc_paramlist):
132+
conn.nick = irc_paramlist[1] + '_'
133+
conn.cmd("NICK", conn.nick)
134+
135+
136+
@asyncio.coroutine
137+
@hook.irc_raw('432', singlethread=True)
138+
def on_invalid_nick(conn):
139+
nick = conn.config['nick']
140+
conn.nick = nick
141+
conn.cmd("NICK", conn.nick)
142+
yield from asyncio.sleep(30) # Just in case, we make sure to wait at least 30 seconds between sending this

0 commit comments

Comments
 (0)