3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-23 18:54:05 +01:00

opercmds: fix wrong counting in 'masskill' if a user gets kicked from multiple channels

This commit is contained in:
James Lu 2017-08-07 16:55:00 -07:00
parent 7266f09879
commit 1597c78089

View File

@ -205,6 +205,8 @@ def masskill(irc, source, args, use_regex=False):
results = killed = 0
userlist_func = irc.match_all_re if use_regex else irc.match_all
seen_users = set()
for uid in userlist_func(args.banmask):
userobj = irc.users[uid]
@ -228,6 +230,8 @@ def masskill(irc, source, args, use_regex=False):
except:
log.exception('(%s) Failed to send process massban hook; some kickbans may have not '
'been sent to plugins / relay networks!', irc.name)
if uid not in seen_users: # Don't count users multiple times on different channels
killed += 1
else:
irc.reply("Not kicking \x02%s\x02 from \x02%s\x02 because you don't have CLAIM access. If this is "
@ -248,6 +252,7 @@ def masskill(irc, source, args, use_regex=False):
'been sent to plugins / relay networks!', irc.name)
killed += 1
results += 1
seen_users.add(uid)
else:
irc.reply('Masskilled %s/%s users.' % (killed, results))
utils.add_cmd(masskill, aliases=('mkill',))