Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilip H.F. "FiXato" Slagter <fixato@gmail.com>2012-06-09 00:16:24 +0200
committerFilip H.F. "FiXato" Slagter <fixato@gmail.com>2012-06-09 00:16:24 +0200
commit3b878cc2ccaa3bec6dcd0ecf545baae0e3cce800 (patch)
tree14d62d7c3ee9efa8bc852dbea1c553bba96044e1
parent5cdb5750858bb344f86d5dada08614f91c63dcb1 (diff)
Only write quit events on channels that actually had the user in it
Should prevent the quit messages from showing up in all channel logs.
-rwxr-xr-xlogbot.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/logbot.py b/logbot.py
index d7010b5..298782b 100755
--- a/logbot.py
+++ b/logbot.py
@@ -199,14 +199,14 @@ class Logbot(SingleServerIRCBot):
def write_event(self, name, event, params={}):
# Format the event properly
- if name == 'nick':
+ if name == 'nick' or name == 'quit':
chans = params["%chan%"]
else:
chans = event.target()
msg = self.format_event(name, event, params)
msg = urlify2(msg)
- # Quit goes across all channels
+ # In case there are still events that don't supply a channel name (like /quit and /nick did)
if not chans or not chans.startswith("#"):
chans = self.chans
else:
@@ -352,7 +352,11 @@ class Logbot(SingleServerIRCBot):
c.privmsg(nm_to_n(e.source()), self.format["help"])
def on_quit(self, c, e):
- self.write_event("quit", e)
+ 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 nick in [x.lstrip('~%&@+') for x in self.channels[chan].users()]:
+ self.write_event("quit", e, {"%chan%" : chan})
def on_topic(self, c, e):
self.write_event("topic", e)