aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_defs.c20
-rw-r--r--src/command/cmd_funcs.c23
-rw-r--r--src/command/cmd_funcs.h2
3 files changed, 44 insertions, 1 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index 4447020b..23ab2ebf 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2328,7 +2328,25 @@ static struct cmd_t command_defs[] =
CMD_EXAMPLES(
"/cmd list",
"/cmd exec ping")
- }
+ },
+
+ { "/omemo",
+ parse_args, 1, 3, NULL,
+ CMD_SUBFUNCS(
+ { "init", cmd_omemo_init })
+ CMD_NOMAINFUNC
+ CMD_TAGS(
+ CMD_TAG_CHAT,
+ CMD_TAG_UI)
+ CMD_SYN(
+ "/omemo init")
+ CMD_DESC(
+ "Omemo commands to manage keys, and perform encryption during chat sessions.")
+ CMD_ARGS(
+ { "init", "Initialize omemo" })
+ CMD_EXAMPLES(
+ "/omemo init")
+ },
};
static GHashTable *search_index;
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index b2f0ee7f..97ce2025 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -85,6 +85,10 @@
#include "pgp/gpg.h"
#endif
+#ifdef HAVE_LIBSIGNAL_PROTOCOL
+#include "omemo/omemo.h"
+#endif
+
#ifdef HAVE_GTK
#include "ui/tray.h"
#endif
@@ -7872,3 +7876,22 @@ _cmd_set_boolean_preference(gchar *arg, const char *const command,
g_string_free(enabled, TRUE);
g_string_free(disabled, TRUE);
}
+
+gboolean
+cmd_omemo_init(ProfWin *window, const char *const command, gchar **args)
+{
+#ifdef HAVE_LIBSIGNAL_PROTOCOL
+ if (connection_get_status() != JABBER_CONNECTED) {
+ cons_show("You must be connected with an account to initialize omemo");
+ return TRUE;
+ }
+
+ ProfAccount *account = accounts_get_account(session_get_account_name());
+ omemo_init(account);
+ cons_show("Initialized omemo");
+ 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 89166ba1..fb81721d 100644
--- a/src/command/cmd_funcs.h
+++ b/src/command/cmd_funcs.h
@@ -214,4 +214,6 @@ gboolean cmd_wins_swap(ProfWin *window, const char *const command, gchar **args)
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
+gboolean cmd_omemo_init(ProfWin *window, const char *const command, gchar **args);
+
#endif