aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Move completion code to a separate fileTrygve Aaberge2024-02-206-360/+384
|
* Only reset foreground color in with_color functionTrygve Aaberge2024-02-196-24/+24
| | | | | | | The with_color helper is usually used to set only the foreground color (currently all usages), so by only reseting the foreground we keep any existing background color. This fixes the default background on the current buffer in the buflist for muted conversations.
* Add command `/slack mute`Trygve Aaberge2024-02-192-1/+39
|
* Refactor command functions to be asyncTrygve Aaberge2024-02-191-39/+26
|
* Support async command functionsTrygve Aaberge2024-02-191-6/+15
|
* Move set user profile functionsTrygve Aaberge2024-02-191-14/+14
|
* Don't require any arguments for `/slack join`Trygve Aaberge2024-02-181-1/+1
| | | | It will use the current buffer if no arguments are given.
* Fetch max 500 users in each requestTrygve Aaberge2024-02-181-1/+1
| | | | | Some users have gotten HTTP 500 from the API when trying to request 1000 users in one request.
* Don't print the same message multiple timesTrygve Aaberge2024-02-183-14/+32
| | | | | | | | | | When joining a channel you seem to get the last messages for it over the WebSocket. When joining a channel you've parted and you still have the buffer for open, those messages will already be in the buffer, so we have to make sure their not printed multiple times. I've also been told that messages can appear multiple times in the reconnect brach, which this should fix too.
* Add command `/slack part`Trygve Aaberge2024-02-184-12/+66
|
* Add an option to leave the channel when a buffer is closedTrygve Aaberge2024-02-184-1/+22
|
* Don't call conversations.leave when closed from serverTrygve Aaberge2024-02-183-12/+27
|
* Add command `/slack join`Trygve Aaberge2024-02-183-0/+79
| | | | | For now this only supports known channels, which currently typically means they have to be referenced in a channel with history loaded.
* Include all workspace nicks in nick completionTrygve Aaberge2024-02-181-5/+23
|
* Add command `/slack query` to open DM/MPDM channelsTrygve Aaberge2024-02-183-9/+96
| | | | | | For now this only supports known nicks, i.e. mostly nicks that have posted a message, is mentioned in a message or appears in the nicklist in any of the conversations that's loaded.
* Don't run buffer close callback when script is unloadingTrygve Aaberge2024-02-184-0/+6
| | | | | We don't want to call the API to close im/mpim conversations when the script is unloading.
* Unset _connect_task after cancelling itTrygve Aaberge2024-02-181-0/+1
| | | | | | | If _connect_task remains set, the connect command won't allow you to connect again because it thinks it's still connecting. This caused a problem where if you disconnect while connecting (or after connecting has crashed), it wasn't possible to connect again afterwards.
* Correctly show reactions with more than 50 users in v3.0.0Trygve Aaberge2024-02-185-10/+150
| | | | | | | | | | | If a reaction has more than 50 users, the list of users will be cropped to just 50 users. This made the counts wrong since we used the number of users rather than the count property. Fix it by using the count property instead and adding "and others" to the list of users if show_reaction_nicks is enabled (the same as the Slack client shows when you hover over the reaction). This is the same fix as in commit 6b388cd9, but for version 3.0.0.
* Support files in Slack Connect channelsTrygve Aaberge2024-02-185-84/+131
| | | | | | | | | Files uploaded in Slack Connect channels doesn't contain any information, so we have to make a request to files.info in order to get the information to render it. See https://api.slack.com/apis/channels-between-orgs#check_file_info for more info.
* Improve performance of rerender_history for WeeChat >= 4.0.0Trygve Aaberge2024-02-181-7/+32
| | | | | | | | | | | | | Previously each message was rerendered individually. This meant that for each message, we start at the bottom of the buffer and go through all the lines upwards until we find the message. So the lines were looped through a lot of times which was slow. Now we instead go through all the lines once, look up the message for each line and updates it. This is only for >= 4.0.0 since earlier versions may have multiple lines for each message (when the message has multiple lines). That would complicate this way of updating the messages, and I don't think it's worth implementing it when it's only for an old version.
* Post users.profile.set as a JSON bodyTrygve Aaberge2024-02-185-85/+109
| | | | | It's better to post nested objects as JSON rather than url encoding them, and this fixes some type errors.
* Rename clean option in status to clearTrygve Aaberge2024-02-181-2/+2
|
* Set user statusPierguido Lambri2024-02-183-2/+60
| | | | | | | It's now possible to set and clear the uses status. For now it's not possible to set the status emoji or the status expiration. Signed-off-by: Pierguido Lambri <plambri@redhat.com>
* Set user user presence (#919)Pier2024-02-182-0/+22
| | | | | | | | | | | The user can now set the presence with: /slack presence away Or: /slack presence active Signed-off-by: Pierguido Lambri <plambri@redhat.com>
* Set buffer_pointer to None when buffer doesn't existTrygve Aaberge2024-02-184-28/+39
| | | | | | This enforces us to check that buffer_pointer is set, so we don't accidentally operate on the core buffer, which is what is done when buffer_pointer is an empty string.
* Fix bots with multiple names only being added once to nicklistTrygve Aaberge2024-02-186-84/+42
| | | | | If a bot uses multiple nicks, we have to add all of them to the nicklist, so none of the nicks are shown as offline.
* Don't include external nick suffix when completingTrygve Aaberge2024-02-181-4/+4
| | | | | Mostly because it's a bit simpler not having to handle this suffix when linkifying text.
* Refactor nick handlingTrygve Aaberge2024-02-186-76/+76
|
* Handle messages without a user fieldTrygve Aaberge2024-02-185-47/+95
| | | | | | This can happen in channels shared between workspaces if one of the workspaces are removed. Then messages from users in that workspace will not have a user field anymore, but instead a user_profile field.
* Underline URL texts by defaultTrygve Aaberge2024-02-181-2/+2
|
* Unescape from_url in attachmentsTrygve Aaberge2024-02-181-1/+1
| | | | | | | | | | | | | | It looks like from_url should be unescaped, but title_link and image_url should not. Slack seems a bit inconsistent here though, as an image in an attachment will use the unescaped title_link, but the link in the title itself will use the original (possibly escaped) one. And the title for the image link will use the original (possibly escaped) title, while the title in the attachment will unescape it. I suppose you're not supposed to HTML escape (or Slacks version of it) URLs in title_link and image_url (which makes sense), but Slack does escape from_url if you send a message with a link to a thread message, so we have to handle that.
* Unescape file titlesTrygve Aaberge2024-02-182-30/+35
| | | | | Also mark a lot of fields as NotRequired as tombstone files doesn't have these fields.
* Support handling files that are not foundTrygve Aaberge2024-02-181-0/+5
|
* Use format_url everywhere a URL is printedTrygve Aaberge2024-02-182-30/+30
|
* Check that buffer_pointer is set before printing/modifying messagesTrygve Aaberge2024-02-181-0/+6
|
* Check enterprise_user when determining if a user is externalTrygve Aaberge2024-02-182-1/+12
| | | | | | | The team id in the profile may be either the enterprise id or the workspace id depending on the token used and the workspace the user belongs to, so if the user has enterprise_user set, check the enterprise_id too.
* Only open channels for the current sub workspaceTrygve Aaberge2024-02-183-1/+74
| | | | | | | | | | | | | | | | | | | | | It's possible to have a token that's only for one workspace in an enterprise grid. For me with such a token, it returns channels in all workspaces in client.userBoot, but only channels in the tokens workspace in client.counts. This meant that we didn't get last_read for all channels we opened, and additionally some methods like conversations.members would fail with "channel_not_found" for those channels. This filters the channels from client.userBoot by checking that the channel is in the current sub workspace, if the token we're using is not an org level (for all workspaces the user is in) token. Additionally it raises an error if any of the channels to open isn't included in the response from client.counts to prevent missing last_read for any channels if there are other channels that isn't included. I could have filtered the list of channels to open by the channels included from client.counts, but I don't want any channels to just silently be ignored.
* Show thread broadcast prefix in thread buffersTrygve Aaberge2024-02-182-10/+11
|
* Fix bugs with /slack reply commandTrygve Aaberge2024-02-184-17/+21
|
* Use the api_cookie value as the `d` cookie if no keys are specifiedTrygve Aaberge2024-02-182-0/+12
| | | | | | Usually, only the `d` cookie is needed, so this allows you to only specify the value of that cookie without the key if you don't need to set any other cookies.
* URL encode cookies if not encodedTrygve Aaberge2024-02-184-4/+32
| | | | | The cookies need to be encoded for the Slack API to accept them, so this makes it work if the config is set with cookies that are not encoded.
* Revert "Only use letters for message hashes"Trygve Aaberge2024-02-181-3/+1
| | | | | | | | | | I have display_thread_replies_in_channel and often search for the thread hash in a buffer to scroll between the different messages in the thread. After changing the hashes to use only letters, this has made the search match other messages much more often (matching words including the hash characters), which is inconvenient. This reverts commit 78bdd84765e53d4c33d963f0d3a8c54652b64ca9.
* Make URL format configurableTrygve Aaberge2024-02-184-9/+29
|
* Fix URLs not being shown (only URL text was) in _unfurl_refsTrygve Aaberge2024-02-181-13/+18
|
* Perform nick completion in last spoken orderTrygve Aaberge2024-02-181-11/+45
| | | | | | | | | | | | | | | This makes it complete nicks that spoke last first, and then nicks that haven't spoken, and lastly yourself. This is the same as the IRC plugin does by default. It adds completion of nicks both with and without @, as the default completion of nicks from the nicklist is just alphabetical. Completion of workspace nicks is removed for now. It only completed workspace nicks that are already loaded, so it might be better to complete workspace nicks in the `input_complete_cb` function instead (since functions using `completion_list_add` can't be async, only `input_complete_cb` can).
* Support color rich text elementsTrygve Aaberge2024-02-183-0/+25
|
* Add command /slack replyTrygve Aaberge2024-02-183-1/+24
|
* Set options value to True if it's set without a valueTrygve Aaberge2024-02-182-50/+30
| | | | | | | It became very confusing to use None to represent it being set without a value, so use True instead. If it has a value it will always be a string, so you can still distinguish between an option without a value and an option with a truthy value.
* Mark conversations info team as not requiredTrygve Aaberge2024-02-182-2/+2
| | | | | I have a huddle message in an IM on an enterprise workspace that doesn't have this field.
* Mark conversations info last_read as not requiredTrygve Aaberge2024-02-181-1/+1
| | | | | It seems that if you request conversations.info right after joining a channel, it's missing in the response.