about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDebXWoody <stefan@debxwoody.de>2021-07-10 10:55:29 +0200
committerDebXWoody <stefan@debxwoody.de>2021-07-10 10:55:29 +0200
commit11476c3e902c92ba3ff81abbbab65dc120208b9d (patch)
tree38db72900f4540f3a9ccdd0533a9a49db967f55c
parent49a0d97a433da21fa6cd3c85401f76523471c115 (diff)
downloadprofani-tty-11476c3e902c92ba3ff81abbbab65dc120208b9d.tar.gz
OMEMO autocomplete untrust
Just a copy-past of autocomplete trust implementation.
-rw-r--r--src/command/cmd_ac.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 6b46d079..12c61c97 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -2588,6 +2588,33 @@ _omemo_autocomplete(ProfWin* window, const char* const input, gboolean previous)
                 }
             }
         }
+
+        if (window->type == WIN_CHAT) {
+            ProfChatWin* chatwin = (ProfChatWin*)window;
+            assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+            found = autocomplete_param_with_func(input, "/omemo untrust", omemo_fingerprint_autocomplete, previous, chatwin->barejid);
+            if (found) {
+                return found;
+            }
+        } else {
+            found = autocomplete_param_with_func(input, "/omemo untrust", roster_contact_autocomplete, previous, NULL);
+            if (found) {
+                return found;
+            }
+
+            int num_tokens = count_tokens(input);
+            if (num_tokens == 4) {
+                gboolean result;
+                gchar** args = parse_args(input, 2, 3, &result);
+                if (result) {
+                    gchar* jid = g_strdup(args[1]);
+                    found = autocomplete_param_no_with_func(input, "/omemo untrust", 4, omemo_fingerprint_autocomplete, previous, jid);
+                    if (found) {
+                        return found;
+                    }
+                }
+            }
+        }
     }
 
     found = autocomplete_param_with_ac(input, "/omemo", omemo_ac, TRUE, previous);