]> jfr.im git - erebus.git/commitdiff
move responsibility for input logging to the core
authorJohn Runyon <redacted>
Wed, 13 Dec 2023 22:28:34 +0000 (15:28 -0700)
committerJohn Runyon <redacted>
Wed, 13 Dec 2023 22:28:34 +0000 (15:28 -0700)
bot.py
erebus.py
modules/basic_socket.py

diff --git a/bot.py b/bot.py
index 681400febb9ffbcdd7748516f56541e401508552..73115a8da034c7c3b26d22e0417d4d99ae5ce708 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -99,8 +99,6 @@ class Bot(object):
                        self.conn.send("NICK %s" % (self.permnick))
 
        def parse(self, line):
-               if self.parent.cfg.getboolean('debug', 'io'):
-                       self.log('I', line)
                pieces = line.split()
 
                if pieces[0][0] == ":":
index c161a42c3b612b655d4749f695096f4afd365f2d..5ebb39ea548edb67ce3ba50cff0390e5d5580a85 100644 (file)
--- a/erebus.py
+++ b/erebus.py
@@ -379,6 +379,8 @@ def loop():
                        main.fd(fileno).close()
                else:
                        for line in data:
+                               if cfg.getboolean('debug', 'io'):
+                                       main.log(str(main.fd(fileno)), 'I', line)
                                try:
                                        main.fd(fileno).parse(line)
                                except:
index f81822bed795a011e7b147c03ef373b867a5581a..1f6563d5c293f6c4653402d1ebd483dc542b87d9 100644 (file)
@@ -64,10 +64,8 @@ class BasicServer(object):
                return lines
 
        def parse(self, line):
-               peer = self.sock.getpeername()
                bot = lib.parent.randbot()
                maxlen = bot.maxmsglen() - len("PRIVMSG  :") - len(self.chan)
-               lib.parent.log(str(self), 'I', line)
                while len(line) > maxlen:
                        cutat = line.rfind(' ', 0, maxlen)
                        if cutat == -1:
@@ -77,6 +75,8 @@ class BasicServer(object):
                bot.msg(self.chan, line)
 
        def send(self, line):
+               if lib.parent.parent.cfg.getboolean('debug', 'io'):
+                       lib.parent.log(str(self), 'O', line)
                self.sock.sendall(line.encode('utf-8', 'backslashreplace')+b"\r\n")
 
        def _getsockerr(self):