aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2014-10-27 16:01:25 -0700
committerRyan Huber <rhuber@gmail.com>2014-10-27 16:01:25 -0700
commita718275e05911567dc224f92f70bef1c8527b3e8 (patch)
tree0321724bb9e1e9ad99998477f53cd329ebccdb21
parentaa11b15452bcf1f196cb5998d4adc30c92305cf3 (diff)
downloadwee-slack-a718275e05911567dc224f92f70bef1c8527b3e8.tar.gz
fix members issue
-rw-r--r--wee_slack.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 03a8d72..f0bff10 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -645,7 +645,11 @@ def process_im_marked(message_json):
def process_channel_created(message_json):
server = servers.find(message_json["myserver"])
item = message_json["channel"]
- server.channels.append(Channel(server, item["name"], item["id"], False, 0, "#"))
+ if server.channels.find(message_json["channel"]["name"]):
+ server.channels.find(message_json["channel"]["name"]).open(False)
+ else:
+ item = message_json["channel"]
+ server.channels.append(Channel(server, item["name"], item["id"], item["is_open"], item["last_read"], "#", item["members"]))
w.prnt(server.buffer, "New channel created: %s" % item["name"])
def process_channel_left(message_json):
@@ -663,7 +667,7 @@ def process_channel_joined(message_json):
server.channels.find(message_json["channel"]["name"]).open(False)
else:
item = message_json["channel"]
- server.channels.append(Channel(server, item["name"], item["id"], item["is_open"], item["last_read"], "#"))
+ server.channels.append(Channel(server, item["name"], item["id"], item["is_open"], item["last_read"], "#", item["members"]))
def process_channel_leave(message_json):
server = servers.find(message_json["myserver"])
@@ -680,7 +684,7 @@ def process_group_joined(message_json):
server.channels.find(message_json["channel"]["name"]).open(False)
else:
item = message_json["channel"]
- server.channels.append(GroupChannel(server, item["name"], item["id"], item["is_open"], item["last_read"], "#"))
+ server.channels.append(GroupChannel(server, item["name"], item["id"], item["is_open"], item["last_read"], "#", item["members"]))
def process_im_close(message_json):
server = servers.find(message_json["myserver"])
@@ -767,8 +771,11 @@ def typing_bar_item_cb(data, buffer, args):
direct_typers = ["D/" + x for x in direct_typers]
current_channel = w.current_buffer()
channel = channels.find(current_channel)
- if channel and channel.__class__ != DmChannel:
- channel_typers = channels.find(current_channel).get_typing_list()
+ try:
+ if channel and channel.__class__ != DmChannel:
+ channel_typers = channels.find(current_channel).get_typing_list()
+ except:
+ w.prnt("", "Bug on %s" % channel)
typing_here = ", ".join(channel_typers + direct_typers)
if len(typing_here) > 0:
color = w.color('yellow')