From 149bbd92ca8e1a7a6c06dbdc782f77235ee45272 Mon Sep 17 00:00:00 2001 From: randomic Date: Tue, 26 Jun 2018 00:03:02 +0100 Subject: [PATCH 1/2] Skip server admin groups and template groups --- allianceauth/services/modules/teamspeak3/manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/allianceauth/services/modules/teamspeak3/manager.py b/allianceauth/services/modules/teamspeak3/manager.py index a5c977d3..51de1384 100755 --- a/allianceauth/services/modules/teamspeak3/manager.py +++ b/allianceauth/services/modules/teamspeak3/manager.py @@ -67,6 +67,8 @@ class Teamspeak3Manager: group_cache = self.server.send_command('servergrouplist') logger.debug("Received group cache from server: %s" % group_cache) for group in group_cache: + if group['keys']['type'] != '1': + continue logger.debug("Checking group %s" % group) if group['keys']['name'] == groupname: logger.debug("Found group %s, returning id %s" % (groupname, group['keys']['sgid'])) @@ -124,6 +126,8 @@ class Teamspeak3Manager: outlist = {} if group_cache: for group in group_cache: + if group['keys']['type'] != '1': + continue logger.debug("Assigning name/id dict: %s = %s" % (group['keys']['name'], group['keys']['sgid'])) outlist[group['keys']['name']] = group['keys']['sgid'] else: @@ -214,7 +218,7 @@ class Teamspeak3Manager: if isinstance(clients, dict): # Rewrap list clients = [clients] - + for client in clients: try: if client['keys']['client_database_id'] == user: From a0bab07e2f60516994ca98905cf850946539c2d9 Mon Sep 17 00:00:00 2001 From: Jamie McMillan Date: Tue, 26 Jun 2018 10:25:29 +0100 Subject: [PATCH 2/2] Fix indentation --- allianceauth/services/modules/teamspeak3/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/allianceauth/services/modules/teamspeak3/manager.py b/allianceauth/services/modules/teamspeak3/manager.py index 51de1384..aa690320 100755 --- a/allianceauth/services/modules/teamspeak3/manager.py +++ b/allianceauth/services/modules/teamspeak3/manager.py @@ -126,8 +126,8 @@ class Teamspeak3Manager: outlist = {} if group_cache: for group in group_cache: - if group['keys']['type'] != '1': - continue + if group['keys']['type'] != '1': + continue logger.debug("Assigning name/id dict: %s = %s" % (group['keys']['name'], group['keys']['sgid'])) outlist[group['keys']['name']] = group['keys']['sgid'] else: