Skip to content

Commit

Permalink
only log user nick changes to the channels that the user is present in
Browse files Browse the repository at this point in the history
  • Loading branch information
singingwolfboy committed Mar 17, 2014
1 parent 2732719 commit 36cabad
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions chanlogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,12 @@ def log_quit(bot, trigger):
def log_nick_change(bot, trigger):
tpl = bot.config.chanlogs.nick_template or NICK_TPL
logline = _format_template(tpl, bot, trigger=trigger)
# write it to *all* channels
for channel in bot.channels:
fpath = get_fpath(bot, channel)
with bot.memory['chanlog_locks'][fpath]:
with open(fpath, "a") as f:
f.write(logline + "\n")
old_nick = bot.origin.nick
new_nick = bot.origin.sender
# write it to *all* channels that the user is present in
for channel, privileges in bot.privileges.items():
if old_nick in privileges or new_nick in privileges:
fpath = get_fpath(bot, channel)
with bot.memory['chanlog_locks'][fpath]:
with open(fpath, "a") as f:
f.write(logline + "\n")

0 comments on commit 36cabad

Please sign in to comment.