aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Print error message when sending message failsTrygve Aaberge2020-10-051-3/+6
| | | | Relates to #797
* Remove unnecessary team parameter in SlackMessage initTrygve Aaberge2020-10-051-7/+7
|
* Don't display the typing indicator for muted conversations (#794)Latchezar Tzvetkoff2020-10-041-1/+1
|
* Use slack_timeout for websocket connectionTrygve Aaberge2020-09-091-2/+3
| | | | Relates to #793
* Check that user is not None in typing noticesTrygve Aaberge2020-09-081-1/+1
| | | | | | | | | I have experienced this being called with a user id we're not aware of, in which case metadata["user"] will be None. I think shared teams/channels are the reason for this. We should look up the user id when it's unknown, but for now just ignore typing notices for unknown users so we don't get an exception.
* Fix argument names in format functionTrygve Aaberge2020-08-291-1/+1
| | | | | The argument names didn't match the names used in the template string. This bug was introduced in commit 63382c5.
* Fix thread broadcasts sent from wee-slack not becoming broadcastsTrygve Aaberge2020-08-241-1/+2
| | | | This was broken in commit d427501.
* Fix thread broadcasts not appearing in channelsTrygve Aaberge2020-08-241-2/+5
| | | | This was broken in commit d427501.
* Set correct localvar type for threads in pmsTrygve Aaberge2020-08-201-5/+9
| | | | | | | Previously threads in pms had localvar type set to channel. Now the type is set to the same as the parent channel. Fixes #789
* Support global weemoji.json fileTrygve Aaberge2020-08-181-2/+7
|
* Use native multiline input support for weechat >= 2.9Trygve Aaberge2020-08-181-5/+10
|
* Fix usage of dates with non ASCII characters for Python 2 (#788)Nicolas Schodet2020-08-111-1/+1
| | | | | When not using english locale, date could contains non ASCII characters. Fixes #419
* Fix thread bot messages appearing in channel instead of threadTrygve Aaberge2020-08-021-11/+7
| | | | | | | | Bot messages in threads have subtype set to bot_message (just like bot messages in channels), so we can't use subtype to check if a message is a thread message or a channel message. Fixes #749
* Remove thread short_name indent if buflist.format.indent checks slack_typeTrygve Aaberge2020-07-141-1/+4
| | | | | | | | | | | | | If buflist.format.indent includes "slack_type", assume that it handles the indent for slack threads specifically, so we should not add any indent in the short_name. Otherwise, add a space at the start of short_name so it is indented in the buflist. This means that you can use e.g. this value for buflist.format.indent to get a nice tree view in the buflist, with threads nested under the channels: /set buflist.format.indent "${color:237}${if:${buffer.local_variables.slack_type}==thread?${if:${buffer.next_buffer.local_variables.slack_type}==thread?│ ├─:│ └─}:${if:${buffer.next_buffer.local_variables.type}=~^(channel|private)$?├─:└─}}"
* Revert "Use buflist.format.indent for thread short name indent"Trygve Aaberge2020-07-141-3/+1
| | | | | | | | | | | | | | | | | | | | This caused some issues, so I think it's best to revert it: - If you don't set a color in the indent option, and otherwise use default format options, the normal indent will be colored green while the thread indent will be colored white. - It will look worse for people with tree-style indent unless they specifically change the indent option for Slack. - The indent will be included when the name is shown in the hotlist, and other places that show short_name. Even without this, it's still possible to get nice indenting of threads if you add the condition `${buffer.local_variables.slack_type}==thread` in the indent option and use that to print extra indent for threads. You will get an extra space before the name (the default indent), but I'll add a commit to remove that if the indent option includes slack_type. This reverts commit f55bf93ad9dd9a90afa987ee45ac7c862d85084b.
* Support creating channelsTrygve Aaberge2020-07-091-0/+31
| | | | | | | | Add command /slack create to create a channel. Currently doesn't switch to the channel after it's created, even when switch_buffer_on_join is true, that is a todo for later. Fixes #415
* Set buffer localvar slack_typeTrygve Aaberge2020-07-091-1/+4
| | | | | | The localvar type has to be set to server, channel or private for things to work properly. Add slack_type so you can differentiate between channels, groups/private channels, threads, ims and mpims.
* Set extra_var slack_thread in indent evaluationTrygve Aaberge2020-07-091-1/+1
| | | | | This allows you add a condition for slack threads in the indent option to display the correct thing, e.g. when using tree style indent.
* Set default color for thread short_nameTrygve Aaberge2020-07-091-1/+1
| | | | | The indent string may set a color and not reset it, because it's not necessary to reset it for normal channels.
* Evaluate buflist indent config option as an expressionTrygve Aaberge2020-07-091-1/+2
| | | | Fixes #783
* Revert "Don't set no_highlight for backlog messages"Trygve Aaberge2020-07-061-2/+2
| | | | | | | | | | | | | | | | | | | This caused a problem for relay clients. They are not notified when print hooks are disabled/enabled, so they have to use the tags and line properties to determine if a line should notify. One could argue that they should not notify when notify_none is present, even if it's a highlight, but this is not how the hotlist or default beep trigger in weechat behaves. When a message with a highlight is printed, that is added to the hotlist and beeps even if notify_none is set (wee-slack removes the buffer from the hotlist immediately after printing the line, which is why that wasn't a problem in plain weechat). Additionally, this caused messages you had reacted to to be highlighted when the buffer was reprinted, since the text now included your name when the line was printed. This reverts commit de5eb518fda26fed3b5cd41c20b064c04020bbb9.
* Fix buffers not changing color in buflist when (un)mutedTrygve Aaberge2020-06-241-0/+1
|
* Remove buffer notify option for unmuted buffersTrygve Aaberge2020-06-241-1/+2
| | | | | | | | | | | | | | | | | | | | | We were setting the notify level for unmuted buffers to 3. This is not the right thing to do because weechat has a weechat.look.buffer_notify_default option which might be set to a different value. By removing the option instead, weechat will use the default value. Additionally, when we change the notify level for a buffer, this is stored in the config (for weechat >= 2.6). Having such a config for all buffers is annoying, but with this change the config will only be present for muted buffers. This fix is not perfect because you still get config values for muted buffers, and since wee-slack is overriding the notify level you can't override it yourself for specific buffers. A potential solution to this could be to set notify level for each line instead of setting notify level for the buffer. Fixes #746
* Set localvar type to private for mpdmsTrygve Aaberge2020-06-241-1/+1
| | | | | | Mpdms should behave the same way as dms when it comes to notifications etc., so I think it makes more sense to set type to private than to channel.
* Support showing buflist presence when short_name is overriddenTrygve Aaberge2020-06-201-0/+2
| | | | | | | | | | | When you set a short name, the prefix wee-slack sets (# for channels, + for dms with present users etc.) is normally dropped so the short name is exactly how the user wants it. However that makes it impossible to see presence in the buflist when short name is set (unless you set it with /label which keeps the prefix). Therefore, if the short name is set to a name starting with a space, replace the space with + if the user is present. This gives the same prefix behavior and characters as when short name is not set.
* Combine channel formatted_name methodsTrygve Aaberge2020-06-201-58/+22
|
* Don't throw error if trying to rename team bufferTrygve Aaberge2020-06-201-1/+1
|
* Don't print short name prefix if set with /buffer setTrygve Aaberge2020-06-201-8/+37
| | | | | | | | When short name is set with /buffer set short_name, instead of changing it to include the prefix, keep it as is. I think this is what would be expected, and it also allows the user to choose which prefix to show. When showing typing notices, replace the first character with the typing character.