aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2014-10-28 13:03:29 -0700
committerRyan Huber <rhuber@gmail.com>2014-10-28 13:03:29 -0700
commit92c4fd46b82f3ce516741b534dd954b715c58951 (patch)
tree868b52f5c8b8020dbb43229e5dbf1dca90dc9ae1 /wee_slack.py
parentc609d61a74a0952badbf862028149f6267de982e (diff)
downloadwee-slack-92c4fd46b82f3ce516741b534dd954b715c58951.tar.gz
handle new user joining and im_created
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 129f975..16a401d 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -612,6 +612,12 @@ def slack_websocket_cb(data, fd):
def process_pong(message_json):
pass
+def process_team_join(message_json):
+ server = servers.find(message_json["myserver"])
+ item = message_json["user"]
+ server.users.append(User(server, item["name"], item["id"], item["presence"]))
+ w.prnt(server.buffer, "New user joined: %s" % item["name"])
+
def process_presence_change(message_json):
buffer_name = "%s.%s" % (domain, message_json["user"])
buf_ptr = w.buffer_search("", buffer_name)
@@ -692,12 +698,14 @@ def process_im_marked(message_json):
def process_im_created(message_json):
server = servers.find(message_json["myserver"])
+ dbg(message_json)
item = message_json["channel"]
- if server.channels.find(message_json["channel"]["name"]):
- server.channels.find(message_json["channel"]["name"]).open(False)
+ channel_name = server.users.find(item["user"]).name
+ if server.channels.find(channel_name):
+ server.channels.find(channel_name).open(False)
else:
item = message_json["channel"]
- server.channels.append(DmChannel(server, item["name"], item["id"], item["is_open"], item["last_read"]))
+ server.channels.append(DmChannel(server, channel_name, item["id"], item["is_open"], item["last_read"]))
w.prnt(server.buffer, "New channel created: %s" % item["name"])
def process_user_typing(message_json):