Added support for a user whitelist in idlemove

This commit is contained in:
Matthew Lavine
2015-06-26 19:38:45 -04:00
committed by Stefan Hacker
parent 61c9f25b65
commit e9ea8cd305
2 changed files with 12 additions and 4 deletions

View File

@@ -26,7 +26,8 @@ deafen = False
channel = 0
; Channel the player has to be in for this treshold rule to affect him (-1 == Any)
;source_channel = -1
; Comma seperated list of player names that will not be moved when idle (such as bots)
whitelist =
; For every server you want to override the [all] section for create
; a [server_<serverid>] section. For example:
@@ -35,4 +36,5 @@ channel = 0
;threshold = 60
;mute = True
;deafen = False
;channel = 1
;channel = 1

View File

@@ -39,6 +39,7 @@
from mumo_module import (commaSeperatedIntegers,
commaSeperatedBool,
commaSeperatedStrings,
MumoModule)
from threading import Timer
@@ -57,7 +58,8 @@ class idlemove(MumoModule):
('mute', commaSeperatedBool, [True]),
('deafen', commaSeperatedBool, [False]),
('channel', commaSeperatedIntegers, [1]),
('source_channel', commaSeperatedIntegers, [-1])
('source_channel', commaSeperatedIntegers, [-1]),
('whitelist', commaSeperatedStrings, [])
),
}
@@ -127,6 +129,10 @@ class idlemove(MumoModule):
self.affectedusers[sid] = set()
index = self.affectedusers[sid]
# Check if the user is whitelisted
if user.name in scfg.whitelist:
return
# Remember values so we can see changes later
threshold = None
mute = user.mute
@@ -220,4 +226,4 @@ class idlemove(MumoModule):
sid = server.id()
self.affectedusers[sid] = set()
self.log().debug('Server %d gone', sid)