diff --git a/message.py b/message.py index 94491c6..acda4b7 100644 --- a/message.py +++ b/message.py @@ -219,6 +219,7 @@ class Message: print ("Can't reparse message") def parsemsg (self, hooks): + hooks.treat_pre(self) #Treat all messages starting with 'nemubot:' as distinct commands if self.content.find("%s:"%self.srv.nick) == 0: #Remove the bot name diff --git a/modules/events/__init__.py b/modules/events/__init__.py index 0106491..ee3e140 100644 --- a/modules/events/__init__.py +++ b/modules/events/__init__.py @@ -185,6 +185,3 @@ def parseask(msg): else: msg.send_snd ("Un événement portant ce nom existe déjà.") return False - -def parselisten (msg): - return False diff --git a/server.py b/server.py index 228a55b..94d76c1 100644 --- a/server.py +++ b/server.py @@ -175,9 +175,12 @@ class Server(threading.Thread): def accepted_channel(self, chan, sender = None): """Return True if the channel (or the user) is authorized""" if self.listen_nick: - return (chan in self.channels and (sender is None or sender in self.channels[chan].people)) or chan == self.nick + return (chan in self.channels and (sender is None or sender in + self.channels[chan].people) + ) or chan == self.nick else: - return chan in self.channels and (sender is None or sender in self.channels[chan].people) + return chan in self.channels and (sender is None or sender + in self.channels[chan].people) def disconnect(self): """Close the socket with the server and all DCC client connections""" @@ -244,7 +247,8 @@ class Server(threading.Thread): msg = message.Message (self, line, private) msg.treat(self.context.hooks) except: - print ("\033[1;31mERROR:\033[0m occurred during the processing of the message: %s" % line) + print ("\033[1;31mERROR:\033[0m occurred during the processing of" + " the message: %s" % line) exc_type, exc_value, exc_traceback = sys.exc_info() traceback.print_exception(exc_type, exc_value, exc_traceback) @@ -258,15 +262,18 @@ class Server(threading.Thread): if self.password != None: self.s.send(b"PASS " + self.password.encode () + b"\r\n") self.s.send(("NICK %s\r\n" % self.nick).encode ()) - self.s.send(("USER %s %s bla :%s\r\n" % (self.nick, self.host, self.realname)).encode ()) + self.s.send(("USER %s %s bla :%s\r\n" % (self.nick, self.host, + self.realname)).encode ()) print ("Connection to %s:%d completed" % (self.host, self.port)) if len(self.channels) > 0: for chn in self.channels.keys(): if self.channels[chn].password is not None: - self.s.send(("JOIN %s %s\r\n" % (self.channels[chn].name, self.channels[chn].password)).encode ()) + self.s.send(("JOIN %s %s\r\n" % (self.channels[chn].name, + self.channels[chn].password)).encode ()) else: - self.s.send(("JOIN %s\r\n" % self.channels[chn].name).encode ()) + self.s.send(("JOIN %s\r\n" % + self.channels[chn].name).encode ()) print ("Listen to channels: %s" % ' '.join (self.channels.keys())) readbuffer = b'' #Here we store all the messages from server