home · contact · privacy
Fix crash on "!" message.
[plomlombot-irc.git] / irclog.py
index a62acadef4a4a2490a47e2b5ae9098523902d95f..6455daec874fb9300643a2eddc8dde83d1b75692 100644 (file)
--- a/irclog.py
+++ b/irclog.py
@@ -1,10 +1,11 @@
 #!/usr/bin/python3
 
-def format_logline(line, channel):
+def format_logline(line, channel, identity):
     if len(line.tokens) > 2:
         if line.tokens[1] == "JOIN":
-            return "-> " + line.sender + " (" + \
-                line.tokens[0][len(line.sender)+2:] + ") joins"
+            if identity == "":
+                identity = line.tokens[0][len(line.sender) + 2:]
+            return "-> " + line.sender + " (" + identity + ") joins"
         elif line.tokens[1] == "PART":
             msg = ""
             if len(line.tokens) > 3 and line.tokens[3][0] == ":":
@@ -14,7 +15,7 @@ def format_logline(line, channel):
             msg = ""
             if len(line.tokens) > 2 and line.tokens[2][0] == ":":
                 msg = " (" + str.join(" ", line.tokens[2:])[1:] + ")"
-            return "<- " + line.sender + " quits server" + msg 
+            return "<- " + line.sender + " quits server" + msg
         elif line.tokens[1] == "NICK":
             return "-- " + line.sender + " changes their name to " + line.receiver 
         elif len(line.tokens) > 3: