Add quieting code again, but disabled by default

This reverts commit 5e4bb1ed5d1beb91ea7b903096b06c6f8cc3b798 and puts
the relevant quiet-related code in a conditional instead, depending on a
newly-added var.QUIET_DEAD_PLAYERS setting.
This commit is contained in:
Janik Kleinhoff 2014-09-18 16:12:17 +02:00
parent 5e4bb1ed5d
commit b2e0a6b1a3
2 changed files with 19 additions and 0 deletions

View File

@ -111,6 +111,11 @@ def connect_callback(cli):
to_be_devoiced = [] to_be_devoiced = []
cmodes = [] cmodes = []
@hook("quietlist", hookid=294)
def on_quietlist(cli, server, botnick, channel, q, quieted, by, something):
if re.match(".+\!\*@\*", quieted): # only unquiet people quieted by bot
cmodes.append(("-q", quieted))
@hook("whospcrpl", hookid=294) @hook("whospcrpl", hookid=294)
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
@ -136,6 +141,12 @@ def connect_callback(cli):
var.OPPED = True var.OPPED = True
if var.PHASE == "none": if var.PHASE == "none":
@hook("quietlistend", 294)
def on_quietlist_end(cli, svr, nick, chan, *etc):
if chan == botconfig.CHANNEL:
mass_mode(cli, cmodes)
cli.mode(botconfig.CHANNEL, "q") # unquiet all
cli.mode(botconfig.CHANNEL, "-m") # remove -m mode from channel cli.mode(botconfig.CHANNEL, "-m") # remove -m mode from channel
elif modeaction == "-o" and target == botconfig.NICK: elif modeaction == "-o" and target == botconfig.NICK:
var.OPPED = False var.OPPED = False
@ -182,6 +193,10 @@ def reset_modes_timers(cli):
cmodes = [] cmodes = []
for plr in var.list_players(): for plr in var.list_players():
cmodes.append(("-v", plr)) cmodes.append(("-v", plr))
if var.QUIET_DEAD_PLAYERS:
for deadguy in var.DEAD:
if not is_fake_nick(deadguy):
cmodes.append(("-q", deadguy+"!*@*"))
mass_mode(cli, cmodes) mass_mode(cli, cmodes)
def reset(cli): def reset(cli):
@ -1602,6 +1617,9 @@ def del_player(cli, nick, forced_death = False, devoice = True, end_game = True,
mass_mode(cli, cmode) mass_mode(cli, cmode)
return not chk_win(cli) return not chk_win(cli)
if var.PHASE != "join": if var.PHASE != "join":
# Died during the game, so quiet!
if var.QUIET_DEAD_PLAYERS and not is_fake_nick(nick):
cmode.append(("+q", nick+"!*@*"))
mass_mode(cli, cmode) mass_mode(cli, cmode)
if nick not in var.DEAD: if nick not in var.DEAD:
var.DEAD.append(nick) var.DEAD.append(nick)

View File

@ -42,6 +42,7 @@ MAX_PRIVMSG_TARGETS = 4
LEAVE_STASIS_PENALTY = 1 LEAVE_STASIS_PENALTY = 1
IDLE_STASIS_PENALTY = 1 IDLE_STASIS_PENALTY = 1
PART_STASIS_PENALTY = 1 PART_STASIS_PENALTY = 1
QUIET_DEAD_PLAYERS = False
GOAT_HERDER = True GOAT_HERDER = True