Browse Source

now warning/killing for idling can be individually disabled

master
jcao219 13 years ago
parent
commit
9fdb596c21
  1. 8
      wolfgame.py

8
wolfgame.py

@ -799,7 +799,7 @@ def reaper(cli, gameid):
# check to see if idlers need to be killed. # check to see if idlers need to be killed.
var.IDLE_WARNED = [] var.IDLE_WARNED = []
if not var.WARN_IDLE_TIME or not var.KILL_IDLE_TIME: if not var.WARN_IDLE_TIME and not var.KILL_IDLE_TIME:
return return
while gameid == var.GAME_ID: while gameid == var.GAME_ID:
@ -811,13 +811,15 @@ def reaper(cli, gameid):
tdiff = datetime.now() - lst tdiff = datetime.now() - lst
if (tdiff > timedelta(seconds=var.WARN_IDLE_TIME) and if (tdiff > timedelta(seconds=var.WARN_IDLE_TIME) and
nick not in var.IDLE_WARNED): nick not in var.IDLE_WARNED):
to_warn.append(nick) if var.WARN_IDLE_TIME:
to_warn.append(nick)
var.IDLE_WARNED.append(nick) var.IDLE_WARNED.append(nick)
var.LAST_SAID_TIME[nick] = (datetime.now() - var.LAST_SAID_TIME[nick] = (datetime.now() -
timedelta(seconds=var.WARN_IDLE_TIME)) # Give him a chance timedelta(seconds=var.WARN_IDLE_TIME)) # Give him a chance
elif (tdiff > timedelta(seconds=var.KILL_IDLE_TIME) and elif (tdiff > timedelta(seconds=var.KILL_IDLE_TIME) and
nick in var.IDLE_WARNED): nick in var.IDLE_WARNED):
to_kill.append(nick) if var.KILL_IDLE_TIME:
to_kill.append(nick)
elif (tdiff < timedelta(seconds=var.WARN_IDLE_TIME) and elif (tdiff < timedelta(seconds=var.WARN_IDLE_TIME) and
nick in var.IDLE_WARNED): nick in var.IDLE_WARNED):
var.IDLE_WARNED.remove(nick) # he saved himself from death var.IDLE_WARNED.remove(nick) # he saved himself from death

Loading…
Cancel
Save