aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c1
-rw-r--r--src/command/cmd_defs.c11
-rw-r--r--src/command/cmd_funcs.c19
-rw-r--r--src/command/cmd_funcs.h1
4 files changed, 28 insertions, 4 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index c700e51b..7b6a865b 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -589,6 +589,7 @@ cmd_ac_init(void)
autocomplete_add(omemo_ac, "trust");
autocomplete_add(omemo_ac, "untrust");
autocomplete_add(omemo_ac, "fingerprint");
+ autocomplete_add(omemo_ac, "clear_device_list");
omemo_log_ac = autocomplete_new();
autocomplete_add(omemo_log_ac, "on");
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 5a3e6873..b1270f63 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2339,7 +2339,8 @@ static struct cmd_t command_defs[] =
{ "end", cmd_omemo_end },
{ "trust", cmd_omemo_trust },
{ "untrust", cmd_omemo_untrust },
- { "fingerprint", cmd_omemo_fingerprint })
+ { "fingerprint", cmd_omemo_fingerprint },
+ { "clear_device_list", cmd_omemo_clear_device_list })
CMD_NOMAINFUNC
CMD_TAGS(
CMD_TAG_CHAT,
@@ -2350,7 +2351,8 @@ static struct cmd_t command_defs[] =
"/omemo start [<contact>]",
"/omemo trust [<contact>] <fingerprint>",
"/omemo end",
- "/omemo fingerprint [<contact>]")
+ "/omemo fingerprint [<contact>]",
+ "/omemo clear_device_list")
CMD_DESC(
"Omemo commands to manage keys, and perform encryption during chat sessions.")
CMD_ARGS(
@@ -2359,12 +2361,13 @@ static struct cmd_t command_defs[] =
{ "end", "End the current OMEMO session," },
{ "log on|off", "Enable or disable plaintext logging of OMEMO encrypted messages." },
{ "log redact", "Log OMEMO encrypted messages, but replace the contents with [redacted]. This is the default." },
- { "fingerprint", "Show contact fingerprints." })
+ { "fingerprint", "Show contact fingerprints." },
+ { "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back."})
CMD_EXAMPLES(
"/omemo gen",
"/omemo start buddy@buddychat.org",
"/omemo trust c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a",
- "/omemo untrust c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a")
+ "/omemo untrust buddy@buddychat.org c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a")
},
};
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 369a992f..c2696c31 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -87,6 +87,7 @@
#ifdef HAVE_OMEMO
#include "omemo/omemo.h"
+#include "xmpp/omemo.h"
#endif
#ifdef HAVE_GTK
@@ -8268,3 +8269,21 @@ cmd_omemo_untrust(ProfWin *window, const char *const command, gchar **args)
return TRUE;
#endif
}
+
+gboolean
+cmd_omemo_clear_device_list(ProfWin *window, const char *const command, gchar **args)
+{
+#ifdef HAVE_OMEMO
+ if (connection_get_status() != JABBER_CONNECTED) {
+ cons_show("You must be connected with an account to initialize OMEMO.");
+ return TRUE;
+ }
+
+ omemo_devicelist_publish(NULL);
+ cons_show("Cleared OMEMO device list");
+ return TRUE;
+#else
+ cons_show("This version of Profanity has not been built with OMEMO support enabled");
+ return TRUE;
+#endif
+}
diff --git a/src/command/cmd_funcs.h b/src/command/cmd_funcs.h
index 3f3385a5..3410075d 100644
--- a/src/command/cmd_funcs.h
+++ b/src/command/cmd_funcs.h
@@ -221,5 +221,6 @@ gboolean cmd_omemo_end(ProfWin *window, const char *const command, gchar **args)
gboolean cmd_omemo_fingerprint(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_trust(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_untrust(ProfWin *window, const char *const command, gchar **args);
+gboolean cmd_omemo_clear_device_list(ProfWin *window, const char *const command, gchar **args);
#endif