Use separate hook IDs where using the same one doesn't make sense

I'd prefer not using the same hook ID for anything, but it's convenient
to be able to unhook multiple related things at once, so we'll just
change the hook IDs again if it's ever needed. Nothing should be
hardcoding them anyway, so changing them shouldn't cause issues.
This commit is contained in:
nyuszika7h 2015-04-16 16:07:13 +02:00
parent cf096c20d0
commit 9479807852

View File

@ -161,7 +161,7 @@ def connect_callback(cli):
if re.match("{0}.+\!\*@\*".format(var.QUIET_PREFIX), ban): if re.match("{0}.+\!\*@\*".format(var.QUIET_PREFIX), ban):
cmodes.append(("-{0}".format(var.QUIET_MODE), ban)) cmodes.append(("-{0}".format(var.QUIET_MODE), ban))
@hook("whoreply", hookid=294) @hook("whoreply", hookid=295)
def on_whoreply(cli, svr, botnick, chan, user, host, server, nick, status, rest): def on_whoreply(cli, svr, botnick, chan, user, host, server, nick, status, rest):
if not var.DISABLE_ACCOUNTS: if not var.DISABLE_ACCOUNTS:
plog("IRCd does not support accounts, disabling account-related features.") plog("IRCd does not support accounts, disabling account-related features.")
@ -185,7 +185,7 @@ def connect_callback(cli):
newstat += var.MODES_PREFIXES[stat] newstat += var.MODES_PREFIXES[stat]
var.USERS[nick] = dict(cloak=host,account="*",inchan=True,modes=set(newstat),moded=set()) var.USERS[nick] = dict(cloak=host,account="*",inchan=True,modes=set(newstat),moded=set())
@hook("whospcrpl", hookid=294) @hook("whospcrpl", hookid=295)
def on_whoreply(cli, server, nick, ident, cloak, _, user, status, acc): def on_whoreply(cli, server, nick, ident, cloak, _, user, status, acc):
if user in var.USERS: return # Don't add someone who is already there if user in var.USERS: return # Don't add someone who is already there
if user == botconfig.NICK: if user == botconfig.NICK:
@ -203,7 +203,7 @@ def connect_callback(cli):
newstat += var.MODES_PREFIXES[stat] newstat += var.MODES_PREFIXES[stat]
var.USERS[user] = dict(cloak=cloak,account=acc,inchan=True,modes=set(newstat),moded=set()) var.USERS[user] = dict(cloak=cloak,account=acc,inchan=True,modes=set(newstat),moded=set())
@hook("endofwho", hookid=294) @hook("endofwho", hookid=295)
def afterwho(*args): def afterwho(*args):
# Devoice all on connect # Devoice all on connect
for nick in to_be_devoiced: for nick in to_be_devoiced:
@ -220,7 +220,7 @@ def connect_callback(cli):
#bot can be tricked into thinking it's still opped by doing multiple modes at once #bot can be tricked into thinking it's still opped by doing multiple modes at once
@hook("mode", hookid=294) @hook("mode", hookid=296)
def on_give_me_ops(cli, nick, chan, modeaction, target="", *other): def on_give_me_ops(cli, nick, chan, modeaction, target="", *other):
if chan != botconfig.CHANNEL: if chan != botconfig.CHANNEL:
return return
@ -230,11 +230,11 @@ def connect_callback(cli):
var.USERS[botconfig.NICK]["modes"].add("o") var.USERS[botconfig.NICK]["modes"].add("o")
if var.PHASE == "none": if var.PHASE == "none":
@hook("quietlistend", 294) @hook("quietlistend", hookid=297)
def on_quietlist_end(cli, svr, nick, chan, *etc): def on_quietlist_end(cli, svr, nick, chan, *etc):
if chan == botconfig.CHANNEL: if chan == botconfig.CHANNEL:
mass_mode(cli, cmodes, ["-m"]) mass_mode(cli, cmodes, ["-m"])
@hook("endofbanlist", 294) @hook("endofbanlist", hookid=297)
def on_banlist_end(cli, svr, nick, chan, *etc): def on_banlist_end(cli, svr, nick, chan, *etc):
if chan == botconfig.CHANNEL: if chan == botconfig.CHANNEL:
mass_mode(cli, cmodes, ["-m"]) mass_mode(cli, cmodes, ["-m"])