Skip to content

Commit

Permalink
Added support for a user whitelist in idlemove
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewLavine authored and hacst committed Apr 12, 2016
1 parent 61c9f25 commit e9ea8cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions modules-available/idlemove.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -35,4 +36,5 @@ channel = 0
;threshold = 60
;mute = True
;deafen = False
;channel = 1
;channel = 1

10 changes: 8 additions & 2 deletions modules/idlemove.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

from mumo_module import (commaSeperatedIntegers,
commaSeperatedBool,
commaSeperatedStrings,
MumoModule)

from threading import Timer
Expand All @@ -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, [])
),
}

Expand Down Expand Up @@ -127,6 +129,10 @@ def UpdateUserAutoAway(self, server, user):
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
Expand Down Expand Up @@ -220,4 +226,4 @@ def stopped(self, server, context = None):
sid = server.id()
self.affectedusers[sid] = set()
self.log().debug('Server %d gone', sid)

0 comments on commit e9ea8cd

Please sign in to comment.