aboutsummaryrefslogtreecommitdiffstats
path: root/slack/register.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-19 23:05:25 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commitd2bb9263f0062275b92024ccdba68d5439521b5d (patch)
treedd9b46727d5a3fc8e1b1c232419504772305e928 /slack/register.py
parentd6b4f505d53e69ecb39d518a89d8d0013e22ad51 (diff)
downloadwee-slack-d2bb9263f0062275b92024ccdba68d5439521b5d.tar.gz
Add support for completing nicks
This uses Slacks edgeapi which only works for session tokens, but has the benefit of being able to complete nicks without all users being loaded. So need to add some completion for the loaded users for when using OAuth tokens as well.
Diffstat (limited to 'slack/register.py')
-rw-r--r--slack/register.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/slack/register.py b/slack/register.py
index c390362..fd38956 100644
--- a/slack/register.py
+++ b/slack/register.py
@@ -30,6 +30,14 @@ def signal_buffer_switch_cb(data: str, signal: str, buffer_pointer: str) -> int:
return weechat.WEECHAT_RC_OK
+def input_text_changed_cb(data: str, signal: str, buffer_pointer: str) -> int:
+ conversation = get_conversation_from_buffer_pointer(buffer_pointer)
+ if conversation:
+ if not conversation.is_completing and conversation.completion_context:
+ conversation.completion_context = 0
+ return weechat.WEECHAT_RC_OK
+
+
def modifier_input_text_display_with_cursor_cb(
data: str, modifier: str, buffer_pointer: str, string: str
) -> str:
@@ -100,6 +108,9 @@ def register():
weechat.hook_signal(
"window_switch", get_callback_name(signal_buffer_switch_cb), ""
)
+ weechat.hook_signal(
+ "input_text_changed", get_callback_name(input_text_changed_cb), ""
+ )
weechat.hook_modifier(
"input_text_display_with_cursor",
get_callback_name(modifier_input_text_display_with_cursor_cb),