diff options
author | Ryan Huber <rhuber@gmail.com> | 2014-10-27 11:55:28 -0700 |
---|---|---|
committer | Ryan Huber <rhuber@gmail.com> | 2014-10-27 11:55:28 -0700 |
commit | bdd652dd28206e9c6c61f7c8666cdb28577c33e5 (patch) | |
tree | 607d174ea9d6f15a75ccd54b3f5334a272961819 /wee_slack.py | |
parent | dea0ac4dae59464f94fa61c7fc52ec904cf1a450 (diff) | |
download | wee-slack-bdd652dd28206e9c6c61f7c8666cdb28577c33e5.tar.gz |
process edits properly
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/wee_slack.py b/wee_slack.py index ca1daf3..4f8c758 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -691,11 +691,12 @@ def process_error(message_json): def process_message(message_json): - known_subtypes = ['channel_join', 'channel_leave'] + known_subtypes = ['channel_join', 'channel_leave', 'message_changed'] if message_json.has_key("subtype") and message_json["subtype"] in known_subtypes: proc[message_json["subtype"]](message_json) -# return - + return + else: + dbg('Unknown subtype: ' + str(message_json)) server = servers.find(message_json["myserver"]) mark_silly_channels_read(message_json["channel"]) @@ -710,7 +711,8 @@ def process_message(message_json): elif message_json.has_key("username"): message_json["user"] = message_json["message"]["username"] except: - dbg(message_json) + pass +# dbg(message_json) if message_json.has_key("user") and message_json.has_key("text"): #below prevents typing notification from disapearing if the server sends an unfurled message @@ -736,6 +738,16 @@ def process_message(message_json): else: server.channels.find(channel).buffer_prnt('unknown user', str(message_json), time) +def process_message_changed(message_json): + if message_json["type"] != "message": + dbg("message changed: " + str(message_json)) + server = servers.find(message_json["myserver"]) + channel = server.channels.find(message_json["channel"]) + user = server.users.find(message_json["message"]["user"]) + text = "Edited: " + message_json["message"]["text"] + time = message_json["ts"] + channel.buffer_prnt(user.name, text, time) + ### END Websocket handling methods def typing_bar_item_cb(data, buffer, args): |