about summary refs log tree commit diff stats
path: root/src/command/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/command.c')
-rw-r--r--src/command/command.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index a13687a3..45381b99 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -41,6 +41,7 @@
 #include "jid.h"
 #include "log.h"
 #include "muc.h"
+#include "otr.h"
 #include "profanity.h"
 #include "tools/autocomplete.h"
 #include "tools/parser.h"
@@ -567,6 +568,14 @@ static struct cmd_t command_defs[] =
           "Such as whether you have become inactive, or have closed the chat window.",
           NULL } } },
 
+    { "/otr",
+        cmd_otr, parse_args, 1, 2, NULL,
+        { "/otr gen|start|end|trust|untrust [contact]", "Off The Record encryption commands.",
+        { "/otr gen|start|end|trust|untrust [contact]",
+          "-----------------------------------------",
+          "gen - Load or create private key and fingerprints.",
+          NULL } } },
+
     { "/outtype",
         cmd_outtype, parse_args, 1, 1, cons_outtype_setting,
         { "/outtype on|off", "Send typing notification to recipient.",
@@ -1129,7 +1138,13 @@ cmd_execute_default(const char * const inp)
             if (status != JABBER_CONNECTED) {
                 ui_current_print_line("You are not currently connected.");
             } else {
+#ifdef HAVE_LIBOTR
+                char *encrypted = otr_encrypt_message(recipient, inp);
+                message_send(encrypted, recipient);
+                otr_free_message(encrypted);
+#else
                 message_send(inp, recipient);
+#endif
 
                 if (prefs_get_boolean(PREF_CHLOG)) {
                     const char *jid = jabber_get_fulljid();