1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-16 21:35:24 +00:00

Add clear_device_list command

This commit is contained in:
Paul Fariello 2019-04-01 13:14:46 +02:00
parent 5cd2b8dc9d
commit 898302243e
4 changed files with 28 additions and 4 deletions

View File

@ -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");

View File

@ -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")
},
};

View File

@ -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
}

View File

@ -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