aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #439 from trygveaa/fix/multiline-prefix-bugTrygve Aaberge2017-09-271-7/+19
|\ | | | | Ensure that all lines printed to weechat specifies a prefix
| * fix: Ensure that all lines printed to weechat specifies a prefixTrygve Aaberge2017-09-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we print a message with multiple lines to weechat, we want the nick/prefix to appear on the first line, and no prefix on the subsequent lines. When this message is handled by weechat, it processes each line of the message separately, and applies a prefix for each line. It seems to me that if the line doesn't contain any tab characters, it should end up with an empty prefix, and this is what happens for me. However, some users are having issues where both the prefix and the message ends up incorrect (issue #274, #385 and #421), which seems to be related to this. Additionally, if the message contains a tab character on any of the lines after the first, the part before the tab character would be the prefix for that line, which is completely wrong. I haven't seen that happen, as it seems that slack replaces tab characters with spaces, but we should handle it correctly nevertheless. The weechat documentation states that you should use a space followed by a tab character to disable the prefix. This patch inserts this after each newline, so the prefix is disabled for each line except the first. I can't reproduce the issue, so I can't verify if this fixes the issue. As far as I can see, for me the behavior is the same with this patch. Hopefully, this fixes #274.
| * refactor: Split en/decoding helper into a separate methodTrygve Aaberge2017-09-221-7/+13
| | | | | | | | | | | | | | Separate the code for wrapping a method so arguments and return values are encoded/decoded into a new method in WeechatWrapper. This allowes us to use it outside of __getattr__ as well, so we can handle some specific methods differently.
* | Merge pull request #430 from trygveaa/send-multiline-messagesTrygve Aaberge2017-09-271-0/+14
|\ \ | |/ |/| Add support for sending multiline messages
| * Add support for sending multiline messagesTrygve Aaberge2017-09-051-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While weechat plugins like multiline.pl and edit.py allow you to compose multiline messages, wee-slack normally receives them line by line, so it ends up as separate messages. There isn't any direct support for receiving the complete message from weechat, but it can be done with sort of a workaround. There is a callback you can hook on to which allows you to intercept and edit messages before they are sent to the buffer. This callback receives the complete message with all the lines. By using this we can process the whole message, and return an empty string from the callback which means that the message will not be processed further. Note that when this happens, weechat commands are not processed, which is why we only use the callback for messages that contain a newline and does not start with slash. Otherwise, we are returning the string sent to the callback, which would be the same as the callback not being hooked in. I've also opened a PR in weechat for supporting multiline input properly[0]. If that is merged, that can be used for newer weechat versions instead of this. [0]: https://github.com/weechat/weechat/pull/1063 Fixes #118
* | Merge pull request #387 from dbarrosop/unwrap_attachmentsTrygve Aaberge2017-09-201-7/+9
|\ \ | | | | | | When expanding attachments avoid rendering same link multiple times
| * | When unfurling attachments avoid rendering same link multiple timesDavid Barroso2017-09-201-7/+9
| | |
* | | Merge pull request #436 from trygveaa/update-weemoji-listTrygve Aaberge2017-09-191-1/+1348
|\ \ \ | | | | | | | | Update list of emoji completions
| * | | Update list of emojisTrygve Aaberge2017-09-161-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done using the following command. It is not an API call and pretty fragile to changes, so we can't use it to automatically load the list from wee_slack.py. curl -s 'https://cfr.slack-edge.com/bv1-1/emoji.84b5140d201ea94c81b4.min.js' | \ sed -e 's/.*emoji.prototype.data = \({[^}]*}\).*/\1/' \ -e 's/\\n/\n/g' -e 's/\\t/\t/g' -e 's/\\'/'/g' | \ jq '{emoji: [to_entries | .[].value[3]] | flatten | sort}'
| * | | Sort and format weemoji.jsonTrygve Aaberge2017-09-161-1/+1304
| | |/ | |/| | | | | | | This makes it easier to see what is changed when we update the list.
* | | Merge pull request #435 from trygveaa/login-failure-messageTrygve Aaberge2017-09-191-65/+53
|\ \ \ | | | | | | | | Print error message when initial connection fails
| * | | Remove commented out code in handle_rtmstartTrygve Aaberge2017-09-181-15/+0
| | | | | | | | | | | | | | | | | | | | No point in keeping commented out code, especially since this code has never been active.
| * | | Return early from handle_rtmstart on failureTrygve Aaberge2017-09-181-68/+68
| | | | | | | | | | | | | | | | This makes the error case a bit clearer and easier to read.
| * | | Print error message when initial connection failsTrygve Aaberge2017-09-161-3/+6
| |/ / | | | | | | | | | | | | | | | | | | I chose to print this instead of using dbg since it's a rather critical error message. Fixes #432
* | | Merge pull request #434 from trygveaa/test/fix-broken-testsTollef Fog Heen2017-09-188-9/+10
|\ \ \ | | | | | | | | Fix broken tests
| * | | test: Remove monkeypatch dependencyTrygve Aaberge2017-09-156-6/+6
| | | | | | | | | | | | | | | | As far as I can see, this isn't used anywhere.
| * | | test: Fix two incorrect test namesTrygve Aaberge2017-09-152-2/+2
| | | |
| * | | test: Empty eventrouter queue when initializing itTrygve Aaberge2017-09-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit 6718e2f added some more events to the queue when a buffer is created. This made some tests fail as it would process these events instead of the ones added in the tests. Fix it by processing all events in the queue when setting up the eventrouter for the tests.
| * | | test: Make mock_weechat a dependency of realish_eventrouterTrygve Aaberge2017-09-152-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting up the eventrouter for the tests involves code that requires the config object to be set, so it has to depend on mock_weechat. This didn't cause a problem when all the tests were run since the first test depends on mock_weechat so it would be set up. However, if you tried to run a single test that depended on realish_eventrouter, but not mock_weechat, it would fail.
* | | Merge pull request #401 from ToxicFrog/toxicfrog/unfurlTrygve Aaberge2017-09-172-21/+19
|\ \ \ | |/ / |/| | Fix overzealous regex in unfurl_refs
| * | test: Add a unfurl test case for messages containing >Trygve Aaberge2017-09-171-0/+4
| | | | | | | | | | | | | | | | | | This tests the bug that was fixed in commit c667bf6, where a message that first has an url and then a > character would try to unfurl everything up to the last >.
| * | test: Fix and enable the tests for unfurl_refsTrygve Aaberge2017-09-171-19/+13
| | |
| * | Fix overzealous regex in unfurl_refsBen Kelly2017-07-221-2/+2
| | | | | | | | | | | | Signed-off-by: Ben Kelly <btk@google.com>
* | | Merge pull request #414 from trygveaa/improve-rendering-of-multiline-editsTollef Fog Heen2017-08-271-8/+39
|\ \ \ | | | | | | | | Improve rendering of changes in multiline messages
| * | | Prevent lines being broken in bare display modeTrygve Aaberge2017-08-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you update a line with hdata_update and pass a string containing newlines, the buffer will become a bit broken when bare display mode is activated (alt+l). It seems that the newlines are printed in bare mode, but extra lines are not inserted, so the lines are overlapping with each other. Fixes #306
| * | | Abort modification of message if encountering line without dataTrygve Aaberge2017-07-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Not sure if this can happen. The weechat documentation doesn't state that it can, but since the if condition was there, maybe it can. If it can and does happen, abort the modification, which is better than something unexpected happening.
| * | | Improve rendering of changes in multiline messagesTrygve Aaberge2017-07-301-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a multiline message was edited or reacted to, all of the new message would be crammed into the last line of the already printed message. This change updates each line separately, so if the number of lines in the message doesn't change, the message will still be rendered correctly after edits or reactions. If the number of lines change, the rendering is still improved, however I don't know if it is possible to insert or delete lines in a weechat buffer without re-rendering the whole buffer, so it won't be perfect. If the number of lines of a message decreases after an edit, the extra lines will still be present, but they will be blanked. If the number of lines increases, the first lines will be set as normally, but the last line will contain all of the rest of the lines.
| * | | Set correct id on all the lines of a messageTrygve Aaberge2017-07-291-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of only updating the last line printed with the id of the message (ts.minor, set in the date_printed field), update all of the lines that is printed for that message. This is necessary for updating all of the lines on changes, instead of only the last. This will be implemented in the next commit. This assumes that the lines after the first in messages always has an empty prefix, and that the first line of a message always has a prefix. This holds for the messages I have seen (single-line, multi-line as well as me-messages and joins/quits). Other approaches I considered was to count the number of newlines in the message and update the same number of lines, or to check the existing date_printed field of the messages and update the ones that had 10 digits or more (since current timestamps has that, and the slack id currently has 6 digits). However, I dropped them in favor of the prefix solution which seems better.
* | | | Merge pull request #423 from trygveaa/ignore-unknown-bot-idsTollef Fog Heen2017-08-171-1/+1
|\ \ \ \ | | | | | | | | | | Check that the bot_id exists before using it
| * | | | Check that the bot_id exists before using itTrygve Aaberge2017-08-171-1/+1
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of just checking that bot_id is not None, check that it exists in the list of bots. This prevents a KeyError when trying to access a bot that doesn't exist in the list. This KeyError would happen if you use a reminder. The message from slackbot then has bot_id B01 which is not in the list of bots from rtm.start and gives bot_not_found if trying to look it up with the bots.info API endpoint. By ignoring the bot_id we fall back to the user/username, which in the case of reminders is slackbot, so the name appears just as the other messages from slackbot. Fixes #420
* | | | Merge pull request #417 from trygveaa/fix-html-entity-encodingTollef Fog Heen2017-08-012-4/+13
|\ \ \ \ | |/ / / |/| | | Fix HTML entity-encoding of outgoing messages
| * | | Fix HTML entity-encoding of outgoing messagesTrygve Aaberge2017-08-012-4/+13
|/ / / | | | | | | | | | | | | | | | We have to replace the & before we replace < and >, otherwise the & in &lt; and &gt; are going to be replaced. Additionally, we need to end the sequences with ; which was missing.
* | | Merge remote-tracking branch 'origin/nicklist-presence-groups'Tollef Fog Heen2017-07-281-1/+12
|\ \ \
| * \ \ Merge pull request #403 from marceldev89/nicklist-presence-groupsTollef Fog Heen2017-07-281-1/+12
| |\ \ \ | | | | | | | | | | Update nicklist when team member presence changes
| | * | | Move presence change to a SlackTeam methodMarcel de Vries2017-07-241-6/+9
| | | | |
| | * | | Update nicklist when team member presence changesMarcel de Vries2017-07-231-1/+9
| |/ / /
* | | | Remove /slack join command from README.mdTollef Fog Heen2017-07-281-1/+0
| | | | | | | | | | | | | | | | Fixes: #362
* | | | Decode the basic HTML entities in topic handlingTollef Fog Heen2017-07-281-6/+9
| | | | | | | | | | | | | | | | Closes: #315
* | | | Merge pull request #399 from wee-slack/nicklist-presence-groupsTollef Fog Heen2017-07-281-11/+15
|\| | | | | | | | | | | Put users in groups according to presence
| * | | Put users in groups according to presenceTollef Fog Heen2017-07-191-11/+15
| | | | | | | | | | | | | | | | Fixes #398
* | | | Merge pull request #408 from auscompgeek/fix-status-cmdTollef Fog Heen2017-07-281-1/+1
|\ \ \ \ | | | | | | | | | | Fix AttributeError on /slack status in team buffer
| * | | | Fix AttributeError on /slack status in team bufferDavid Vo2017-07-271-1/+1
| | |/ / | |/| |
* | | | Merge pull request #412 from trygveaa/set-correct-unread-countTollef Fog Heen2017-07-281-1/+1
|\ \ \ \ | | | | | | | | | | Set correct number of unread messages in hotlist
| * | | | Set correct number of unread messages in hotlistTrygve Aaberge2017-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While the commit 6718e2f fixed buffers not appearing in the hotlist, after it the number of new messages for each buffer was gone. This makes the number of messages for each buffer shown again.
* | | | | Merge pull request #411 from auscompgeek/fix-open-threadTollef Fog Heen2017-07-281-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Fix opening thread buffers
| * | | | | Fix opening thread buffersDavid Vo2017-07-281-1/+1
| |/ / / /
* | | | | Add support for editing other messages than just the last oneTollef Fog Heen2017-07-282-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar syntax as for adding reactions: 3s/foo/bar/ Fixes: #153
* | | | | Fix return codes in buffer_input_callbackTollef Fog Heen2017-07-281-2/+2
|/ / / / | | | | | | | | | | | | Not sure this actually matters as weechat seemed happy with the wrong return codes too
* | | | Merge pull request #406 from ToxicFrog/toxicfrog/escapeBen Kelly2017-07-261-0/+7
|\ \ \ \ | |/ / / |/| | | Properly escape <&> when sending messages to Slack.
| * | | Properly escape <&> when sending messages to Slack.Ben Kelly2017-07-251-0/+7
|/ / / | | | | | | | | | | | | Signed-off-by: Ben Kelly <bk@ancilla.ca> Signed-off-by: Ben Kelly <btk@google.com>