aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2017-07-28 21:58:08 +0200
committerGitHub <noreply@github.com>2017-07-28 21:58:08 +0200
commita4ae1bb4349523a7ef6fdf29ba945b98bbed7cf7 (patch)
tree68d9ab209221d6ad512ad4be38ec1a789d0d4790 /wee_slack.py
parent645d6bd0b6f193f9f218ff1794175545f0be7afc (diff)
parent59856162998c58fa7e0a2bceb594f7fd2d307ea3 (diff)
downloadwee-slack-a4ae1bb4349523a7ef6fdf29ba945b98bbed7cf7.tar.gz
Merge pull request #403 from marceldev89/nicklist-presence-groups
Update nicklist when team member presence changes
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 7014071..4d78fc2 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1081,6 +1081,14 @@ class SlackTeam(object):
dbg("Unexpected error: {}\nSent: {}".format(sys.exc_info()[0], data))
self.set_connected()
+ def update_member_presence(self, user, presence):
+ user.presence = presence
+
+ for c in self.channels:
+ c = self.channels[c]
+ if user.id in c.members:
+ c.update_nicklist(user.id)
+
class SlackChannel(object):
"""
@@ -2151,7 +2159,10 @@ def process_manual_presence_change(message_json, eventrouter, **kwargs):
def process_presence_change(message_json, eventrouter, **kwargs):
- kwargs["user"].presence = message_json["presence"]
+ if "user" in kwargs:
+ user = kwargs["user"]
+ team = kwargs["team"]
+ team.update_member_presence(user, message_json["presence"])
def process_pref_change(message_json, eventrouter, **kwargs):