0
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-07-26 12:14:28 -04:00

Add /omemo char command

This commit is contained in:
Paul Fariello 2019-04-10 06:49:20 +03:20
parent 0bc660400b
commit 277e8dc901
3 changed files with 25 additions and 1 deletions

View File

@ -2341,6 +2341,7 @@ static struct cmd_t command_defs[] =
{ "trust", cmd_omemo_trust }, { "trust", cmd_omemo_trust },
{ "untrust", cmd_omemo_untrust }, { "untrust", cmd_omemo_untrust },
{ "fingerprint", cmd_omemo_fingerprint }, { "fingerprint", cmd_omemo_fingerprint },
{ "char", cmd_omemo_char },
{ "clear_device_list", cmd_omemo_clear_device_list }) { "clear_device_list", cmd_omemo_clear_device_list })
CMD_NOMAINFUNC CMD_NOMAINFUNC
CMD_TAGS( CMD_TAGS(
@ -2353,6 +2354,7 @@ static struct cmd_t command_defs[] =
"/omemo trust [<contact>] <fingerprint>", "/omemo trust [<contact>] <fingerprint>",
"/omemo end", "/omemo end",
"/omemo fingerprint [<contact>]", "/omemo fingerprint [<contact>]",
"/omemo char <char>",
"/omemo clear_device_list") "/omemo clear_device_list")
CMD_DESC( CMD_DESC(
"Omemo commands to manage keys, and perform encryption during chat sessions.") "Omemo commands to manage keys, and perform encryption during chat sessions.")
@ -2363,12 +2365,14 @@ static struct cmd_t command_defs[] =
{ "log on|off", "Enable or disable plaintext logging of OMEMO encrypted messages." }, { "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." }, { "log redact", "Log OMEMO encrypted messages, but replace the contents with [redacted]. This is the default." },
{ "fingerprint", "Show contact fingerprints." }, { "fingerprint", "Show contact fingerprints." },
{ "char <char>", "Set the character to be displayed next to OMEMO encrypted messages." },
{ "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back."}) { "clear_device_list", "Clear your own device list on server side. Each client will reannounce itself when connected back."})
CMD_EXAMPLES( CMD_EXAMPLES(
"/omemo gen", "/omemo gen",
"/omemo start buddy@buddychat.org", "/omemo start buddy@buddychat.org",
"/omemo trust c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a", "/omemo trust c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a",
"/omemo untrust buddy@buddychat.org c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a") "/omemo untrust buddy@buddychat.org c4f9c875-144d7a3b-0c4a05b6-ca3be51a-a037f329-0bd3ae62-07f99719-55559d2a",
"/omemo char *")
}, },
}; };

View File

@ -8050,6 +8050,25 @@ cmd_omemo_start(ProfWin *window, const char *const command, gchar **args)
#endif #endif
} }
gboolean
cmd_omemo_char(ProfWin *window, const char *const command, gchar **args)
{
#ifdef HAVE_OMEMO
if (args[1] == NULL) {
cons_bad_cmd_usage(command);
} else if (strlen(args[1]) != 1) {
cons_bad_cmd_usage(command);
} else {
prefs_set_omemo_char(args[1][0]);
cons_show("OMEMO char set to %c.", args[1][0]);
}
return TRUE;
#else
cons_show("This version of Profanity has not been built with OMEMO support enabled");
return TRUE;
#endif
}
gboolean gboolean
cmd_omemo_log(ProfWin *window, const char *const command, gchar **args) cmd_omemo_log(ProfWin *window, const char *const command, gchar **args)
{ {

View File

@ -215,6 +215,7 @@ gboolean cmd_wins_swap(ProfWin *window, const char *const command, gchar **args)
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args); gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
gboolean cmd_omemo_gen(ProfWin *window, const char *const command, gchar **args); gboolean cmd_omemo_gen(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_char(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_log(ProfWin *window, const char *const command, gchar **args); gboolean cmd_omemo_log(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_start(ProfWin *window, const char *const command, gchar **args); gboolean cmd_omemo_start(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_omemo_end(ProfWin *window, const char *const command, gchar **args); gboolean cmd_omemo_end(ProfWin *window, const char *const command, gchar **args);