From 08f47a2a7967aca55c58270f8dceb13b9f603a99 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 14 Jan 2014 03:44:17 +0100 Subject: Reaktor: asybot now with name in logger --- Reaktor/IRC/ircasy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Reaktor/IRC') diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index ca607f2b..aacf501a 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -21,7 +21,7 @@ class asybot(asychat): def __init__(self, server, port, nickname, channels, realname=False, username=False, hostname=False, hammer_interval=10, alarm_timeout=300, kill_timeout=360, loglevel=logging.ERROR): asychat.__init__(self) #logger magic - self.log = logging.getLogger('asybot') + self.log = logging.getLogger('asybot_' + nickname) hdlr = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON) formatter = logging.Formatter( '%(filename)s: %(levelname)s: %(message)s') hdlr.setFormatter(formatter) -- cgit v1.2.3 From cb60cf60d73d81918bcd2745192111305cfffd54 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 14 Jan 2014 03:44:47 +0100 Subject: Reaktor: asybot except signal --- Reaktor/IRC/ircasy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Reaktor/IRC') diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index aacf501a..3d2d3137 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -64,7 +64,10 @@ class asybot(asychat): self.alarm_timeout = alarm_timeout self.hammer_interval = hammer_interval self.kill_timeout = kill_timeout - signal(SIGALRM, lambda signum, frame: self.alarm_handler()) + try: + signal(SIGALRM, lambda signum, frame: self.alarm_handler()) + except Exception as e: + print('asybot: ' + str(e)) self.reset_alarm() def reset_alarm(self): -- cgit v1.2.3 From 9c2e4bce1eb2834259f92ed8463b34e1528d0de5 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 14 Jan 2014 03:45:05 +0100 Subject: asybot: only disconnect if connected --- Reaktor/IRC/ircasy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Reaktor/IRC') diff --git a/Reaktor/IRC/ircasy.py b/Reaktor/IRC/ircasy.py index 3d2d3137..7821305f 100644 --- a/Reaktor/IRC/ircasy.py +++ b/Reaktor/IRC/ircasy.py @@ -131,7 +131,8 @@ class asybot(asychat): self.close() def reconnect(self): - self.push('QUIT') + if self.connected: + self.push('QUIT') self.close() self.create_socket(AF_INET, SOCK_STREAM) self.connect((self.server, self.port)) -- cgit v1.2.3