| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
- 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`
|
|\
| |
| | |
fix: Make /topic behave the same way as on IRC
|
| | |
|
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This refactors the topic command, and makes it behave the same way as it
does on IRC. The fixes include:
- `/topic` prints the topic instead of clearing it
- `/topic #channel` prints the topic for that channel in that channels
buffer instead of setting the topic to #channel
- `/topic #channel [...]` for a channel that doesn't exist gives a
proper error message
The patch also removes some unused code, refactors the logic and removes
the `/slack topic` command, since using `/topic` should suffice.
The reason it returs WEECHAT_RC_OK_EAT when the channel isn't found, is
so weechat doesn't print an error message such as:
irc: command "topic" must be executed on irc buffer (server or channel)
Fixes #405
|
|\ \
| | |
| | | |
Switch to thread buffer on open if configured
|
|/ /
| |
| |
| | |
Obeys the switch_buffer_on_join setting on /thread.
|
|\ \
| | |
| | | |
Update documentation on enabling debug mode
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| |
| |
| | |
This command has been removed. To mark all channels as read you can now
run `/input set_unread` instead (note that since this isn't a command
specific for wee-slack, it will move the unread markers for all buffers
to the bottom, including buffers not belonging to wee-slack).
|
| |
| |
| |
| | |
Since startswith is faster than in, it's better to check that first.
|
|\ \
| | |
| | | |
Make groups and MPDMs distinguishable by prefix
|
| | | |
|
| | | |
|
| | | |
|
|\ \ \
| |/ /
|/| | |
Support `/input set unread` and `/input set_unread_current_buffer`
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This hooks into the weechat commands `/input set_unread` and `/input
set_unread_current_buffer` and implements them. For set_unread we
iterate over all the channels and mark them as read. For
set_unread_current_buffer we mark the current buffer as read.
Fixes #323
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This changes the signature of mark_read in SlackTeam to match the one in
SlackChannel. This is done so we can call mark_read on all the items in
the list of buffers (which has both teams and channels), without
checking if the items are channels.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The new_messages property is used by mark_read to determine if it should
excecute. When a channel is initially loaded, new_messages is set to
False, and unread_count_display is set to the number of unread messages.
new_messages is not set to True until a new message arrives.
This means that if you call mark_read after loading a channel, but
before a new message has arrived, it won't do anything, even if the
channel had unread messages when it was loaded. By setting new_messages
in set_unread_count_display, this is fixed.
|
|\ \
| | |
| | | |
Ensure that all lines printed to weechat specifies a prefix
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |/
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/
|/| |
Add support for sending multiline messages
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| | |
| | | |
When expanding attachments avoid rendering same link multiple times
|
| | | |
|
|\ \ \
| | | |
| | | | |
Update list of emoji completions
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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}'
|
| | |/
| |/|
| | |
| | | |
This makes it easier to see what is changed when we update the list.
|
|\ \ \
| | | |
| | | | |
Print error message when initial connection fails
|
| | | |
| | | |
| | | |
| | | |
| | | | |
No point in keeping commented out code, especially since this code has
never been active.
|
| | | |
| | | |
| | | |
| | | | |
This makes the error case a bit clearer and easier to read.
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | | |
I chose to print this instead of using dbg since it's a rather critical
error message.
Fixes #432
|
|\ \ \
| | | |
| | | | |
Fix broken tests
|
| | | |
| | | |
| | | |
| | | | |
As far as I can see, this isn't used anywhere.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|\ \ \
| |/ /
|/| | |
Fix overzealous regex in unfurl_refs
|
| | |
| | |
| | |
| | |
| | |
| | | |
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 >.
|
| | | |
|
| | |
| | |
| | |
| | | |
Signed-off-by: Ben Kelly <btk@google.com>
|
|\ \ \
| | | |
| | | | |
Improve rendering of changes in multiline messages
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|