aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix /query not working for new MPIMsTrygve Aaberge2022-09-181-18/+34
|
* Support retrying requests when ratelimitedTrygve Aaberge2022-09-181-48/+87
|
* Gracefully handle user_is_restricted error on initial loadTrygve Aaberge2022-09-181-1/+10
| | | | | | If you are a guest on a team, requesting the user groups may fail with this error. Instead of failing the whole startup, report an error and continue.
* Support including the d-s cookieTrygve Aaberge2022-09-181-1/+5
| | | | | According to one comment it was necessary for them to include this cookie as well.
* Support specifying both url encoded and raw (not url encoded) cookiesTrygve Aaberge2022-09-181-3/+15
|
* Don't open all DMs and MPDMs on startTrygve Aaberge2022-09-181-11/+32
| | | | | | | | Instead open only unread DMs and MPDMs. Unfortunately it doesn't seem to be possible to know which DMs or MPDMs are open from the last run or in the official client (without using internal APIs). We could explore alternatives like opening the ones with recent messages, or storing which are open, but this will have to do for now.
* Handle conversations.info for all typesTrygve Aaberge2022-09-181-18/+11
| | | | | | This sets last_read on the channel, though we have no guarantee that we get the result from info before history, and if we get history first, the read messages will still be marked as unread.
* Use SlackRequest options in file downloadTrygve Aaberge2022-09-181-1/+2
|
* Show which requests fail at startupTrygve Aaberge2022-09-181-6/+7
|
* Check if members is not empty in SlackMPDMChannelTrygve Aaberge2022-09-171-1/+1
| | | | | | If you use an xoxc token, the conversations.list endpoint returns an empty list for members of mpdms that have is_group set to true, which made this fail.
* Support specifying an auth cookie in slack_api_tokenTrygve Aaberge2022-09-171-1/+13
| | | | | | | | | | | | This is necessary for xoxc tokens. The cookie is specified after the token with a colon separating them, i.e. "token1,token2:cookiefor2,token3". This makes slack_api_token even more inconvenient, but it will have to do until we rewrite the config to have a section for each team, like the irc config has. Fixes #844
* Support specifying cookies in SlackRequestTrygve Aaberge2022-09-171-9/+28
| | | | This is a necessary step for #844
* Remove empty hook_process_hashtable callsTrygve Aaberge2022-09-171-3/+0
| | | | | I don't think these are necessary. I've not experienced any errors after removing them.
* Support starting wee-slack without using rtm.startTrygve Aaberge2022-09-171-21/+256
| | | | | | | | | | | rtm.start is deprecated and will stop working on September 20, 2022. This patch replaces it with several other API endpoints to get the info we need. The handle_rtmstart method is kept for the test setup to work, but this setup should also be replaced with the new API endpoints. This is a necessary step for #699 and #844
* Don't crash on missing mode on files in messagesTrygve Aaberge2022-09-171-1/+1
|
* Use correct parameter name for info requestTrygve Aaberge2022-09-171-1/+1
|
* Fix tests and formatting after last commitTrygve Aaberge2022-09-171-3/+3
|
* Check closed IM channels for unread messages (#859)Daniel Nelson2022-09-171-0/+17
| | | | | On connection check closed IM channels for unread messages and if any are found open a buffer. This ensures that new direct messages are not missed.
* Fix message changes not being processedTrygve Aaberge2022-01-311-1/+2
| | | | | | | | | | | | | The Slack API has changed message_changed events from having a unique ts to having the ts of the message that's changed, which means that the condition in the start of process_message to not process duplicate messages (see commit 68966be for info about that) made it skip the message_changed events. To fix this, only do this duplication check for messages without a subtype (i.e. new normal messages). This condition is becoming a bit convoluted, so it might be better to do this duplication check another way, but this will have to do for now to get the issue fixed.
* Fix formatting after black upgradeTrygve Aaberge2022-01-301-9/+5
|
* Fix alignment of multiline messages with non-ASCII prefix. (#854)bemoody2021-11-161-1/+2
| | | | | | | | | | | | On Python 2, weechat.string_remove_color doesn't work for Unicode strings containing non-ASCII characters. The string must be converted to bytes using encode_to_utf8. Furthermore, the length of a non-ASCII string (either in bytes or codepoints) isn't the same as the width of the string on screen. To accurately calculate the width, when the string might contain combining or double-width characters, use weechat.strlen_screen. Co-authored-by: Benjamin Moody <benjaminmoody@gmail.com>
* Validate token not empty, before initiate connection (#853)Inom2021-11-161-1/+5
| | | | | | | | | | I continuously received this error: ``` AttributeError: 'NoneType' object has no attribute 'token' ``` Because tokens list was `['', '']`. And wee-chat tried initiate connections without tokens. This small change fix this error.
* Don't unhide buffers when reprinting messages (#839)Kevin Pulo2021-06-231-0/+1
|
* Remove Python >= 3.6 only syntaxTrygve Aaberge2021-06-231-1/+1
| | | | This comma broke compatibility with Python 2.7, so remove it.
* Fix alignment of multiline messagesTrygve Aaberge2021-05-261-2/+5
| | | | | | When `weechat.look.prefix_align` is set to `none`, lines after the first in a message would not align with the first. Use the same number of spaces as the prefix for those lines, so they align with the first.
* Release v2.8.0v2.8.0Trygve Aaberge2021-05-111-1/+1
|
* Add compatibility with WeeChat >= 3.2 (XDG directories)Sébastien Helleu2021-05-111-3/+8
|
* Support MPIMs in channel list of rtm.startTrygve Aaberge2021-05-111-14/+36
| | | | | | | | | | | For some reason, some MPIMs are listed in the channel list of the response from rtm.start, with is_mpim set to true, instead of in the mpims list. These incorrectly appeared as private channels instead of MPIMs in wee-slack. These entries do not contain a members list, so we have to call conversations.members and set the name after receiving the response from that.
* Add indicator for broadcast thread messages (#838)Bill Doyle2021-05-111-1/+13
|
* Support mpim_aware RTM APITrygve Aaberge2021-05-081-13/+24
| | | | | | | | | | | | Apparently, the API now sends an mpim_joined event when an MPIM is created instead of a group_joined event, even if we don't set mpim_aware to true. Instead of just handling mpim_joined in addition to group_joined (which could cause issues if both are called for MPIMs, though I haven't experienced that), it's better to properly support mpim_aware. Fixes #825, fixes #833
* Include channel name in file names for downloaded filesTrygve Aaberge2021-04-301-4/+6
| | | | Fixes #836
* Ignore failing flake rules instead of selecting only a fewTrygve Aaberge2021-04-131-1/+5
| | | | E203 should be ignored when using black according to their docs.
* Fix some flake8 errorsTrygve Aaberge2021-04-131-2/+2
|
* Some code cleanup from lgtm.com checksTrygve Aaberge2021-04-121-17/+18
|
* Call conversations.members for all channelsTrygve Aaberge2021-03-211-1/+4
| | | | | | | | | It turns out that some channels in rtm.start include a member list with a few users, but not all. Therefore, I don't know how we can know if the list is complete or not, so we have to call conversations.members for all channels. Fixes #829
* Call conversations.members for all channel typesTrygve Aaberge2021-03-211-22/+9
| | | | | | | | | | I'm not sure when members for a channel is included in rtm.start, but it seems like shared and private channels doesn't include the field at all, while some other channels have started to only include the user. Therefore, call conversations.members if a channel doesn't have any members or if the only member is the user. Hopefully this fixes #829
* Format all python files with blackTrygve Aaberge2021-03-201-1010/+2006
|
* Clear last_line_from when clearing bufferTrygve Aaberge2021-03-061-0/+1
| | | | | | Fixes a bug where the first line would use prefix_same_nick after reprinting messages if the first and last message were from the same person.
* Increase the number of channel members we fetchTrygve Aaberge2021-03-061-1/+1
| | | | | | | | conversations.members only returns 100 members if we don't specify limit, and requires pagination to get the rest. We want to know more members than that, so specify a limit of 1000, which is the max we can specify. If a channel has more than 1000 members, we would have to use papagination to get all, but I'll just do this simple change for now.
* Get user info for unknown users after getting channel membersTrygve Aaberge2021-03-061-4/+4
| | | | | | | Since all members might not be known yet in get_history (which is why we call conversations.members), if we look up unknown users there, we won't look up all the unknown users. Check for unknown users when receiving the response for conversations.members instead.
* Fallback to user identifier if we can't find a name in get_senderTrygve Aaberge2021-03-061-1/+1
| | | | | | | | | | | | | | | I don't like displaying the user identifier, but if all of the steps in get_sender fails, it's better to fallback to the identifier rather than an empty string, so you can at least distinguish between different users. It falls back to an empty string again if user_identifier is None, because some messages in the tests doesn't even have a user_identifier. Though, I don't think any messages the Slack servers are sending now are missing user_identifier. After the last commit, hopefully this fallback to user identifier will never be used though.
* Get message sender nick from profile for unknown usersTrygve Aaberge2021-03-061-0/+7
| | | | | | If a message is sent from an external user, the message will include the user profile, so we can use that to display the correct name if we haven't fetched the user info yet.
* Release v2.7.0v2.7.0Trygve Aaberge2021-02-241-1/+1
|
* Add support to disable teammate link previews (#815)Joan Touzet2021-02-221-0/+5
|
* Don't escape <>& in me messagesTrygve Aaberge2021-02-211-14/+16
| | | | | | | | | Apparently chat.meMessage requires these characters unescaped, even though it interpret links using these characters. There doesn't seem to be any options for changing this behavior, so we have to linkify nicks/channels while also leaving <>& unescaped. Fixes #704, closes #822
* lookup message via hash with fallback to countAshish Kulkarni2021-02-201-2/+5
|
* allow new threads to be opened via /thread <THREADID>Ashish Kulkarni2021-02-201-2/+1
| | | | | This was broken in #774 as it checked if there was at least one reply, which is not the case for new threads.
* Replace deprecated APIs with conversations APITrygve Aaberge2021-02-201-13/+13
| | | | | | | | | | | | | | | Now that conversations.mark works for all tokens, just using the conversations API the same way as the old APIs works fine as far as I can see. Loosing unread_count_display by replacing mpim.open with conversations.open and channels.info with conversations.info means that mpims and channels will not be marked as unread when wee-slack loads if background_load_all_history has been set to false anymore. As far as I can see, the only way to check if they have unread messages is by loading the history, so there is no way around this. Fixes #792
* Fix thread id collision detection not working in Python 2Trygve Aaberge2020-10-091-1/+1
| | | | | | | | | hashlib returns a byte string in Python 2, but since we only use unicode strings elsewhere the check against that in SlackChannelHashedMessages.__missing__ didn't work. Make sure sha1_hex returns a unicode string instead. Fixes #800, closes #801
* Combine duplicated send_message codeTrygve Aaberge2020-10-051-19/+14
|