aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
Commit message (Collapse)AuthorAgeFilesLines
* Release v2.1.1v2.1.1Trygve Aaberge2018-08-201-1/+1
|
* Fix missing nick for own messagesTrygve Aaberge2018-08-201-2/+3
| | | | | | | | | | | | | | This was introduced in commit 51c2e76 because I removed user from the request believing it to be unnecessary. I think the reason I didn't experience this problem after removing it (I'm pretty sure I tested it), is that we might receive both a message event and a request response for the message, and we use the first of those that arrives. The message event will always contain the user, while the request response will not (but it's passed along if provided as in this commit). Fixes #612
* Release v2.1.0v2.1.0Trygve Aaberge2018-08-201-1/+1
|
* Handle missing unread_count_display fieldsTrygve Aaberge2018-08-201-7/+4
| | | | | | | | | I have experienced unread_count_display missing from channels.info for some channels. It seems consistent for those particular channels, but I'm not sure what's different about them, or why it's missing from them. I haven't seen it missing from groups.info or conversations.open, but I figured it was best to set it the same way in the three methods.
* Simplify and cleanup process_messageTrygve Aaberge2018-08-201-31/+10
|
* Add a helper for getting functions with a prefixTrygve Aaberge2018-08-201-5/+10
|
* Don't render messages surrounded by _ as actionsTrygve Aaberge2018-08-201-8/+1
| | | | | | | | | | | | | | | Even though me_messages and messages surrounded by underlines render equally in the official client, it is two different types of messages. Converting messages surrounded by underlines to me_messages causes problems when editing, because the underlines will be removed from the message so it won't be shown as an action anymore. The official clients sends me_messages as that subtype, and after the previous commit, wee-slack also does this, so there is no reason for this conversion anymore. Since subtype isn't changed in SlackMessage anymore, we can use the subtype variable we have, and the comment is not needed anymore.
* Send actions as actual me_messagesTrygve Aaberge2018-08-201-10/+22
| | | | | | | | | | Previously, we would just surround the message with underlines. While this renders equally in the official client, it's not actually a me_message, which shows if you try to edit the message. me_messages are not currently supported in threads. If you try to send one in the official client you will get an error, so print an error in wee-slack as well.
* Reset color after nickTrygve Aaberge2018-08-191-1/+1
| | | | | | | | This changes the color of the text of action messages to normal color so that only the nick before the text is colored. This is the same as the irc plugin does. Fixes #355
* Keep nick when actions (/me messages) are editedTrygve Aaberge2018-08-191-4/+5
| | | | Fixes #463
* Set last_read when marking channel as readTrygve Aaberge2018-08-181-2/+4
| | | | | | This fixes a bug where old messages would show up as new instead of as backlog messages when channel history is reloaded (i.e. when running /rehistory or after reconnects).
* Clear messages before processing historyTrygve Aaberge2018-08-181-8/+3
| | | | | | | | | | | | If a message arrived after history was requested, but before the response arrived, it would be lost. It would be printed after the "getting channel history" text, and then handle_history would clear that, and it would not be printed again since the message ts already was processed. By clearing the messages dict, the message will get processed and printed again. So we should never clear the buffer without also clearing the messages, to prevent such problems.
* Don't try to modify buffer line when message not foundTrygve Aaberge2018-08-171-9/+9
| | | | | | | | If the timestamp given to change_message doesn't exist in the messages dict, just return. Previously an unknown ts would make modify_buffer_line crash unless text was set, because modify_buffer_line fails if text is None.
* Update message_json when message is changedTrygve Aaberge2018-08-171-3/+5
| | | | | This fixes an issue introduced in commit d7b26dd where (edited) would not show up after changed messages.
* Fix marking buffer as read after printing own messsagesTrygve Aaberge2018-08-171-8/+5
| | | | | Make sure to mark the buffer as read right after we print a message from our own user, so we don't see a flash of the unread bar.
* Don't process message again if it already existsTrygve Aaberge2018-08-171-0/+4
| | | | | | | | | | | | | | | | | | The API has started to send both responses for sent messages as well as message events for the same messages. Previously, we would only get message events for messages from other clients. For the messages we send ourselves we would just get responses, and no message events. This caused wee-slack to print own messages twice, once for the response and once for the message event. To prevent this, check if we already have a message for the ts, and if we do, ignore the new message. I don't want to rely on only the message events and ignore the responses, because this change has rolled out gradually, so not all users might get message events for own messages yet. Additionally, the docs are not clear on what the behavior should be. Fixes #606
* Clear messages dict when refetching historyTrygve Aaberge2018-08-161-6/+9
| | | | | | | | | | When refetching the history, we clear the buffer because the messages will be printed again. Now the dicts for messages and hashed_messages are also cleared, so they match what we actually have in the buffer. This is necessary so we can check if a message is in the messages dict to find out if it's printed to the buffer, which we need for the next commit.
* Move message edited text to render and remove message suffixTrygve Aaberge2018-08-111-21/+15
| | | | | | | | | | | The message suffix is only used to show that a message is edited. Instead of keeping track of the suffix, just check if the message has been edited in the render function, and add the text there. This way, we only have to add the '(edited)' text one place. With this change, the edited text moves to right after the message text, before the attachments and files. It also fixes a bug where '(edited)' would not show on messages that have a thread.
* Remove url replacing for file_share message subtypesTrygve Aaberge2018-08-101-9/+0
| | | | | | | | | Slack doesn't use the file_share subtype anymore, as file uploads are now sent as normal messages with files attached. The urls we render for files attached to messages are the same as the urls this code previously inserted. The urls this code replaced out are gone from Slack.
* Render files after message instead of changing message textTrygve Aaberge2018-08-101-8/+10
| | | | | | | | | | Instead of changing the message text, append the files belonging to the message when we render the message. This is the same as we do with attachments. This fixes the issue where the files would not be shown anymore if a message is changed. The rendering format of the files is changed to match the way we render refs.
* Remove unnecessary stuff in message changedTrygve Aaberge2018-08-101-24/+3
| | | | | | | I don't think any if this is used anymore. The function changed message_json, but that was not used after it was changed. It also added attachments, but render is called later which also adds attachments, so they ended up being included twice.
* Adding support for new slack upload message style (#599)David Thorman2018-07-281-0/+8
| | | | | | * Adding support for new slack upload message style * better handling of empty messages
* Merge pull request #462 from ericdwang/shared-channelsTrygve Aaberge2018-06-271-43/+144
|\ | | | | Add support for shared channels
| * Use team id to determine if user is externalTrygve Aaberge2018-06-071-12/+14
| | | | | | | | | | | | The is_stranger attribute isn't clearly documented, so it's safer to check if the team_id of the user matches the team_id of the team we request the user in.
| * Handle get_sender being called before users.infoTrygve Aaberge2018-06-071-16/+10
| | | | | | | | | | When messages were loaded before the user info were fetched for an external user, this would crash.
| * Don't assume all users.info responses are for external usersTrygve Aaberge2018-06-071-2/+2
| | | | | | | | | | We might want to use this request for other users as well in the future, so we shouldn't assume that all of the users received by it are external.
| * Ensure presence is always set on SlackUserTrygve Aaberge2018-06-071-3/+4
| | | | | | | | | | The presence attribute is missing in the response for external users, so we just set it to unknown.
| * Check if user exists in is_user_presentTrygve Aaberge2018-06-071-1/+1
| | | | | | | | | | This method may be called before an external user is fetched, so it doesn't exist yet.
| * Use users list to check if user info should be fetchedTrygve Aaberge2018-06-071-3/+1
| | | | | | | | | | This is probably more reliable than depending on the topic not being set.
| * Combine users and external_users listTrygve Aaberge2018-06-071-14/+6
| | | | | | | | | | | | | | | | | | | | | | Since we have an is_external attribute on the users, it's simpler to just have them all in a single list. The documentation says that the user id is not necessarily unique across teams, but I talked to Slack and they said it's unlikely to be a collision. If you refer to a user in a message, you only use the id without a team id, so you will have problems with collisions there anyway. I'm waiting to hear from Slack how to handle that.
| * Add support for DMs with external usersEric Wang2018-06-071-4/+20
| |
| * Replace Slack links with direct links to shared filesEric Wang2018-06-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | The current links in shared file messages only show a thumbnail and require an extra click to get to the actual shared file, which is a minor annoyance. Links from external members in shared channels are also from their team's Slack subdomain, so they're inaccessible if you're not a member of their team. The direct links are from the files.slack.com subdomain though and visible to all, and the official Slack client uses them to show those files.
| * Add support for shared channelsEric Wang2018-06-071-14/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since shared channels only work with the new conversations API, a new class of SlackChannel and API type were added to support them. Also `rtm.start` doesn't include external users so their information needs to be fetched individually when getting the channel history. To distinguish external users from team members their nicks get appended with an asterisk, which can be changed with a new setting. They also appear in a new "External" group in the nicklist since their presences can't be fetched with `users.getPresence`. Unfortunately `conversations.history` doesn't include thread messages so threads won't show up in shared channels.
* | Re-add support for prefix_same_nick (#590)Tollef Fog Heen2018-06-111-3/+9
| | | | | | | | | | Remember the last nick printed and re-add support prefix_same_nick. Fixes: #357
* | Don't raise exception on missing event callbacks (#589)Trygve Aaberge2018-06-111-10/+1
| | | | | | | | | | These missing callbacks are not really errors or exceptions, and we don't need to implement all of them. Raising an exception makes the users think something isn't working, and is confusing.
* | Re-use HTTP proxy settings from weechat when connectingCoolgeek7892018-06-081-6/+70
| | | | | | Fixes: #573
* | print `image_url` if it exists (#504)Charlie Allom2018-06-081-0/+5
|/ | | | | | | | | | | | | | | | | | | | * print `image_url` if it exists * add test for image_url * requirements.txt for pytest * fix requirements.txt * text before image_url * this isn’t required * README readability for development section thanks @trygveaa * README reorder for this development section
* Fix typing indicator when having multiple windowsTrygve Aaberge2018-06-071-3/+2
| | | | | | | | | | | | If you have multiple windows in weechat, you get (by default) one typing bar per window. Previously, the bar used the globally active channel (the active channel in the active window) for all the bars, so all the bars would show the same info. This changes it to use the active channel for the window the bar is in. The callback name is changed to include (extra), as that is necessary for getting the active buffer for each window as an argument to the callback function.
* If connection fails, validate that we have something that looks like a valid ↵Tollef Fog Heen2018-05-211-0/+4
| | | | token
* Fix a bunch of PEP8 errorsTollef Fog Heen2018-05-211-16/+21
|
* Handle spaces in tokens correctly instead of shouting at people to avoid themTollef Fog Heen2018-05-211-1/+1
|
* fix: corrected registration instructionsDaniel Brendle2018-05-141-1/+1
| | | | | | | | in the registration dialog, wee_slack asks the user to reload the slack script via /script. in my weechat 2.1 on debian sid, this is not the proper way to reload scripts anymore. instead one has to use the /python command to achieve the same effect. this commit corrects the misleading instruction message.
* Make sure to compare nick against uncoloured nick when choosing tagsTollef Fog Heen2018-05-061-1/+1
| | | | Fixes #531
* Merge pull request #346 from V13Axel/status_as_dm_topicTrygve Aaberge2018-04-281-6/+35
|\ | | | | Add emojis to status as a DM topic
| * Include real name in dm channel topicTrygve Aaberge2018-04-131-1/+5
| |
| * Don't show 'None' when status emoji or text is missingTrygve Aaberge2018-04-131-2/+2
| |
| * Fix finding dm channel after merge with masterTrygve Aaberge2018-04-131-2/+3
| | | | | | | | Finding by name didn't work anymore.
| * Refactor finding a channel by members into a methodTrygve Aaberge2018-04-131-6/+7
| |
| * Sync branch 'status_as_dm_topic' with masterTrygve Aaberge2018-04-131-0/+23
| |\
| | * Move formatting to its own functionV13Axel2018-04-121-2/+7
| | |