Use regular lowercase for hosts + minor code cleanup

This commit is contained in:
nyuszika7h 2016-09-11 19:59:46 +02:00
parent 037065b40c
commit 01b7cea83c
2 changed files with 5 additions and 4 deletions

View File

@ -1171,14 +1171,14 @@ class MaelstromMode(GameMode):
self.DEAD_ACCOUNTS.add(irc_lower(var.USERS[nick]["account"]))
if not var.ACCOUNTS_ONLY:
self.DEAD_HOSTS.add(irc_lower(var.USERS[nick]["host"]))
self.DEAD_HOSTS.add(var.USERS[nick]["host"].lower())
def on_join(self, evt, cli, var, nick, chan, rest, forced=False):
if var.PHASE != "day" or (nick != chan and chan != botconfig.CHANNEL):
return
if (irc_lower(nick) in (irc_lower(x) for x in var.ALL_PLAYERS) or
irc_lower(var.USERS[nick]["account"]) in self.DEAD_ACCOUNTS or
irc_lower(var.USERS[nick]["host"]) in self.DEAD_HOSTS):
var.USERS[nick]["host"].lower() in self.DEAD_HOSTS):
cli.notice(nick, messages["maelstrom_dead"])
return
if not forced and evt.data["join_player"](cli, nick, botconfig.CHANNEL, sanity=False):

View File

@ -100,8 +100,9 @@ def mass_privmsg(cli, targets, msg, notice=False, privmsg=False):
def reply(cli, nick, chan, msg, private=False, prefix_nick=False):
if chan == nick:
pm(cli, nick, msg)
elif private or (nick not in list_players() and var.PHASE in var.GAME_PHASES and chan == botconfig.CHANNEL) \
or (var.DEVOICE_DURING_NIGHT and var.PHASE == "night" and chan == botconfig.CHANNEL):
elif private or (chan == botconfig.CHANNEL and
((nick not in list_players() and var.PHASE in var.GAME_PHASES) or
(var.DEVOICE_DURING_NIGHT and var.PHASE == "night"))):
cli.notice(nick, msg)
else:
if prefix_nick: