# HG changeset patch # User Charly COSTE # Date 1267214360 -3600 # Node ID 6388579c701d62f851a1d087c303386d035112a3 # Parent 2a81c480439a7ef580f33e47ba4d1f29df4d52d8 auto-reconnect in irclib, restart if bot's IRC connection was lost Signed-off-by: Charly COSTE diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -240,7 +240,13 @@ class IRC: if s == c._get_socket(): c.lock.acquire() if hasattr(c, 'socket'): - c.process_data() + try: + c.process_data() + except ServerNotConnectedError: + if c.real_nickname == self.bot.nickname: + self.bot.restart() + else: + c.connect() c.lock.release() def process_timeout(self):