From c609d61a74a0952badbf862028149f6267de982e Mon Sep 17 00:00:00 2001 From: Ryan Huber Date: Tue, 28 Oct 2014 12:42:40 -0700 Subject: handle im channel creation --- wee_slack.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'wee_slack.py') diff --git a/wee_slack.py b/wee_slack.py index 17047f1..129f975 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -632,12 +632,6 @@ def process_group_marked(message_json): if not legacy_mode: w.buffer_set(channel.channel_buffer, "hotlist", "-1") -def process_im_marked(message_json): - channel = channels.find(message_json["channel"]) - channel.mark_read(False) - if not legacy_mode: - w.buffer_set(channel.channel_buffer, "hotlist", "-1") - def process_channel_created(message_json): server = servers.find(message_json["myserver"]) item = message_json["channel"] @@ -690,6 +684,22 @@ def process_im_open(message_json): server = servers.find(message_json["myserver"]) server.channels.find(message_json["channel"]).open(False) +def process_im_marked(message_json): + channel = channels.find(message_json["channel"]) + channel.mark_read(False) + if not legacy_mode: + w.buffer_set(channel.channel_buffer, "hotlist", "-1") + +def process_im_created(message_json): + server = servers.find(message_json["myserver"]) + item = message_json["channel"] + 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(DmChannel(server, item["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): server = servers.find(message_json["myserver"]) server.channels.find(message_json["channel"]).set_typing(server.users.find(message_json["user"]).name) -- cgit