aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | refactor: Make use of message keys more clear and efficientTrygve Aaberge2017-10-151-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of the times we used sorted_message_keys, we were accessing some of the last elements in the list. Since OrderedDict is doubly linked, using reversed(keys) and next/islice is much more efficient than converting it to a list. Because of this the method now returns a generator in reverse order. It is renamed to main_message_keys_reversed to make it clear that it isn't returning thread messages, and that it is now reversed.
| * | | refactor: Use OrderedDict for SlackChannel.messagesTrygve Aaberge2017-10-151-15/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By using an OrderedDict, we can sort the messages when we store them, so we don't have to sort them each time we access them with sorted_message_keys. If we are guaranteed that the message we store is always the newest message, we can even drop the sorting, as OrderedDicts are sorted in insertion order. However, I'm not sure if we might store an older message at some point, so to be safe, we sort the messages each time we store one.
| * | | fix: Use the timestamp of the last message in mark_readTrygve Aaberge2017-09-231-1/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sending a mark read message to slack, use the timestamp of the last message in the channel, instead of the current timestamp. This should prevent potentially marking messages as read, if they arrive after mark_read was called and the clock of the slack server and the machine wee-slack runs on is not exactly in sync. According to issue #307 messages might also be marked as read if they arrive right after you switch buffer, and you have a slow internet connection. Though, since the time used in mark_read is set synchronously when the buffer is changed, I'm not sure if that can be the case. Either way, I think this patch should fix the issue. If there are no messages in the channel, fall back to using the current time as timestamp. Fixes #307
* | | Merge pull request #438 from trygveaa/attachment-tests-and-minor-fixesTrygve Aaberge2018-01-102-6/+157
|\ \ \ | | | | | | | | Attachment tests and minor fixes
| * | | fix: Unescape html before checking attachment linksTrygve Aaberge2017-10-152-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | The title and from_url fields of attachments doesn't seem to be escaped, so the check if they already are in the text didn't work if the link contained e.g. an ampersand.
| * | | Add a newline between attachmentsTrygve Aaberge2017-09-202-4/+26
| | | |
| * | | Don't render equal title_link and from_url in attachments twiceTrygve Aaberge2017-09-202-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-up of commit 0345ba1. That prevented rendering the link if it already was in the text. This prevents rendering both the title_link and from_url if they are equal, but not in the text. In this case it only renders the title_link.
| * | | test: Add tests for unwrap_attachmentsTrygve Aaberge2017-09-201-0/+115
| |/ /
* | | Merge pull request #452 from ericdwang/query-mpdmTrygve Aaberge2017-12-172-25/+65
|\ \ \ | | | | | | | | Add ability to open multiparty DMs with /query and /slack talk
| * | | Clean up /query related codeEric Wang2017-11-291-23/+12
| | | |
| * | | Fix MPDM joins not syncing with Slack and switch to mpim.openEric Wang2017-11-291-7/+21
| | | | | | | | | | | | | | | | | | | | conversations.open doesn't return `unread_count_display` for MPDMs for some reason (only DMs), so use mpim.open instead.
| * | | Refactor command_talk and fix MPDMs not being createdEric Wang2017-11-292-45/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix incorrect parameter name for MPDMs: `users` instead of `user_ids` - Accept comma-separated nicks instead of space-separated to match weechat's `/query` syntax - Check user IDs instead of usernames to find channels - Use `SLACK_API_TRANSLATOR` instead of hard coding API methods - Update documentation
| * | | Add ability to open multiparty DMs with /query and /slack talkEric Wang2017-11-292-10/+41
|/ / / | | | | | | | | | | | | `command_talk` can now accept multiple arguments, which allows commands like `/query user1 user2` to open a MPDM with user1 and user2.
* | | Merge pull request #464 from trygveaa/send-special-messagesTrygve Aaberge2017-11-212-1/+9
|\ \ \ | | | | | | | | Allow sending special messages by escaping them with / or \
| * | | Allow sending special messages by prefixing them with a slash or a spaceTrygve Aaberge2017-11-072-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows you to send messages starting with / or messages like s/a/b/ and +:test: as normal text messages instead of performing the action they normally would. This is done by prefixing the message with a slash (/) or a space ( ), and then the prefix character is removed from the resulting message. Allowing / as a prefix, so you can write e.g. //slack is the normal way to send messages starting with / in weechat. This will work for all messages starting with a slash, but won't work for e.g. /+:test:, as that is interpreted as a command. Using space as a prefix is the way Slack does it. This will work for all messages.
* | | | Merge pull request #478 from alyssais/hide_closed_group_dmsTrygve Aaberge2017-11-211-14/+12
|\ \ \ \ | | | | | | | | | | Hide closed group dms
| * | | | Don't show closed group DMsAlyssa Ross2017-11-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Group DMs shouldn't be displayed just because `is_member` is `True`, because it always will be. Instead, if a channel/DM/whatever has an `is_open` property, use that, and only fall back to `is_member` when `is_open` isn't present (such as for channels).
| * | | | Refactor check_should_openAlyssa Ross2017-11-201-14/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Make the method a bit easier to follow, and don't use exceptions for flow control.
* | | | | Merge pull request #471 from com4/masterTrygve Aaberge2017-11-211-1/+6
|\ \ \ \ \ | | | | | | | | | | | | Add option to disable sending typing notification to Slack
| * | | | | Add option to disable sending typing notification to Slackjason2017-11-081-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Many IM clients that support alerting the receiving user that you're typing include an option to disable this behavior. This commit adds the `send_typing_notice` boolean option. When it is false `typing_notification_cb` is not registered for the `input_text_changed` Weechat signal. By default this option is true.
* | | | | | Merge pull request #475 from immae/team_identifierTrygve Aaberge2017-11-211-1/+1
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Hilight team identifier in slack
| * | | | | Hilight team identifier in slackIsmaël Bouya2017-11-131-1/+1
| |/ / / /
* | | | | Merge pull request #461 from trygveaa/remove-team-nicklistTrygve Aaberge2017-11-161-1/+0
|\ \ \ \ \ | | | | | | | | | | | | Remove the nicklist from the team buffers
| * | | | | Remove the nicklist from the team buffersTrygve Aaberge2017-10-261-1/+0
| | |/ / / | |/| | | | | | | | | | | | | This list is not populated anymore, so we shouldn't show it at all.
* | | | | Allow query with @'esIsmaël Bouya2017-11-131-0/+2
| |/ / / |/| | |
* | | | Display nicklist in MPDM messagesjason2017-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | - Fix a regression from 95fa08 that disabled the nicklist in multi-person direct messages
* | | | Merge pull request #468 from ToxicFrog/toxicfrog/tagsBen Kelly2017-11-071-9/+9
|\ \ \ \ | |/ / / |/| | | Add irc_privmsg to message tags; remove unused "highlightme" tagset
| * | | Add irc_privmsg to message tags; remove unused "highlightme" tagsetBen Kelly2017-11-041-9/+9
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In plain weechat, irc_privmsg is used for all messages received via the IRC PRIVMSG command, which includes messages to channels, not just PMs. Not having this tag means some weechat settings related to hilighting don't behave as expected, and some other scripts like anotify don't play nice with slack buffers. Fixes #283. Signed-off-by: Ben Kelly <bk@ancilla.ca> Signed-off-by: Ben Kelly <btk@google.com>
* | | Merge pull request #460 from auscompgeek/fix-server-buffer-varTrygve Aaberge2017-10-261-0/+1
|\ \ \ | | | | | | | | Set the server buffer variable on server buffers
| * | | Set the server buffer variable on server buffersDavid Vo2017-10-261-0/+1
|/ / /
* | | Merge pull request #449 from dzfweb/masterTrygve Aaberge2017-10-251-0/+24
|\ \ \
| * | | created '/slack users' and '/slack channels' commandDouglas Zanco Franco2017-10-251-0/+24
|/ / /
* | | Merge pull request #451 from ericdwang/masterTrygve Aaberge2017-10-231-15/+26
|\ \ \ | | | | | | | | Add mpim API type for multiparty DMs
| * | | Fix channel joins not syncing with SlackEric Wang2017-10-201-1/+1
| | | |
| * | | Use Conversations API for join/open and leave/close methodsEric Wang2017-10-161-19/+15
| | | |
| * | | Add mpim API type for multiparty DMsEric Wang2017-10-161-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously MPDMs used the groups API, which worked fine except when trying to close them. The closing events were never properly synced with Slack so the buffers would always reappear after restarting WeeChat. Using the mpim API (except for info since it doesn't exist: https://api.slack.com/methods#mpim) seems to fix that.
* | | | Merge pull request #458 from trygveaa/decorator-for-decode-utf8Trygve Aaberge2017-10-222-44/+114
|\ \ \ \ | |/ / / |/| | | Add a decorator for decoding function arguments from UTF-8
| * | | Decode exceptions from utf8Trygve Aaberge2017-10-191-2/+2
| | | | | | | | | | | | | | | | Fixes #407
| * | | Add decoding utf8 to some functions that were missing itTrygve Aaberge2017-10-191-0/+3
| | | |
| * | | Create a decorator for decoding function argumentsTrygve Aaberge2017-10-192-40/+48
| | | |
| * | | Add tests for decode_from_utf8/encode_to_utf8Trygve Aaberge2017-10-191-0/+59
| | | |
| * | | Preserve mapping types in decode_from_utf8/encode_to_utf8Trygve Aaberge2017-10-191-2/+2
|/ / /
* | | Merge pull request #453 from ericdwang/fix-dm-errorsTrygve Aaberge2017-10-111-3/+3
|\ \ \ | | | | | | | | Fix errors when joining DMs and multiparty DMs
| * | | Use True instead of "true" for "return_im" in requestsEric Wang2017-10-111-2/+2
| | | |
| * | | Fix errors when joining DMs and multiparty DMsEric Wang2017-10-101-2/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The DM error was caused by not specifying `return_im` (https://api.slack.com/methods/im.open#arguments) in the request which led to `unread_count_display` not being included in the response and a KeyError in `handle_imopen` - The MPDM error was caused by using "name" instead of "channel" for the channel ID (https://api.slack.com/methods/groups.info#arguments) in the request which led to an error response and a KeyError in `handle_groupsinfo`
* | | Merge pull request #443 from trygveaa/fix/topic-command-refactorTrygve Aaberge2017-10-093-43/+150
|\ \ \ | | | | | | | | fix: Make /topic behave the same way as on IRC
| * | | test: Add tests for topic_command_cbTrygve Aaberge2017-10-081-1/+53
| | | |
| * | | test: Map all weechat return codes in testsTrygve Aaberge2017-10-081-1/+3
| | | | | | | | | | | | | | | | | | | | So we can assert on all of the return values. Since True == 1 in python, this doesn't change the value of WEECHAT_RC_OK.
| * | | fix: Update topic property in channel when topic changesTrygve Aaberge2017-10-081-9/+12
| | | | | | | | | | | | | | | | | | | | I also changed the channel to only store the topic value, since that is the only part of the topic property we get from Slack that we use.
| * | | refactor: Split topic_command_cb and add testsTrygve Aaberge2017-10-082-16/+69
| | | | | | | | | | | | | | | | | | | | | | | | Split out the parts of topic_command_cb that's most interesting and easiest to test into parse_topic_command and add tests for that function.