Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/logbot.py
diff options
context:
space:
mode:
authorFilip H.F. "FiXato" Slagter <fixato@gmail.com>2012-06-08 23:44:16 +0200
committerFilip H.F. "FiXato" Slagter <fixato@gmail.com>2012-06-08 23:44:16 +0200
commit5cdb5750858bb344f86d5dada08614f91c63dcb1 (patch)
tree11425326e87028b73cfd2e7aa2a7bea8cc26f4aa /logbot.py
parent0be9eac469c7eb7699042288060d9b65eea48a53 (diff)
Only write the nick change event on channels that actually have the nick on the channel
This should prevent nick changes appearing in logs that don't have the user on the channel.
Diffstat (limited to 'logbot.py')
-rwxr-xr-x[-rw-r--r--]logbot.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/logbot.py b/logbot.py
index 8691d9d..d7010b5 100644..100755
--- a/logbot.py
+++ b/logbot.py
@@ -199,7 +199,10 @@ class Logbot(SingleServerIRCBot):
def write_event(self, name, event, params={}):
# Format the event properly
- chans = event.target()
+ if name == 'nick':
+ chans = params["%chan%"]
+ else:
+ chans = event.target()
msg = self.format_event(name, event, params)
msg = urlify2(msg)
@@ -323,10 +326,15 @@ class Logbot(SingleServerIRCBot):
})
def on_nick(self, c, e):
- self.write_event("nick", e,
- {"%old%" : nm_to_n(e.source()),
- "%new%" : e.target(),
- })
+ old_nick = nm_to_n(e.source())
+ # Only write the event on channels that actually had the user in the channel
+ for chan in self.channels:
+ if old_nick in [x.lstrip('~%&@+') for x in self.channels[chan].users()]:
+ self.write_event("nick", e,
+ {"%old%" : old_nick,
+ "%new%" : e.target(),
+ "%chan%": chan,
+ })
def on_part(self, c, e):
self.write_event("part", e)