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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index d8b955a2..1d87b7c9 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -38,6 +38,7 @@
 #include "jid.h"
 #include "log.h"
 #include "muc.h"
+#include "otr.h"
 #include "profanity.h"
 #include "tools/autocomplete.h"
 #include "tools/parser.h"
@@ -1129,7 +1130,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();
@@ -2151,7 +2158,14 @@ _cmd_msg(gchar **args, struct cmd_help_t help)
             usr_jid = usr;
         }
         if (msg != NULL) {
+#ifdef HAVE_LIBOTR
+            cons_debug("HAVE_LIBOTR, user_jid: %sm msg: %s", usr_jid, msg);
+            char *encrypted = otr_encrypt_message(usr_jid, msg);
+            message_send(encrypted, usr_jid);
+            otr_free_message(encrypted);
+#else
             message_send(msg, usr_jid);
+#endif
             ui_outgoing_msg("me", usr_jid, msg);
 
             if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
@@ -2874,7 +2888,13 @@ _cmd_tiny(gchar **args, struct cmd_help_t help)
         if (tiny != NULL) {
             if (win_type == WIN_CHAT) {
                 char *recipient = ui_current_recipient();
+#ifdef HAVE_LIBOTR
+                char *encrypted = otr_encrypt_message(recipient, tiny);
+                message_send(encrypted, recipient);
+                otr_free_message(encrypted);
+#else
                 message_send(tiny, recipient);
+#endif
 
                 if (prefs_get_boolean(PREF_CHLOG)) {
                     const char *jid = jabber_get_fulljid();
/commit/050_write.subx?h=hlt&id=333525360b22f3d3ea31db46a4d2f1b4edbfebdb'>33352536 ^
ee9a9237 ^
33352536 ^



6030d7e2 ^
71eb22a5 ^
33352536 ^
71eb22a5 ^
33352536 ^

71eb22a5 ^
33352536 ^

ee9a9237 ^
7dac9ade ^
33352536 ^

6070c23e ^
cf02c20b ^
ee9a9237 ^
33352536 ^



7a583220 ^
33352536 ^

6030d7e2 ^
4224ec81 ^
e59a74ab ^


33352536 ^
7dac9ade ^
e59a74ab ^

ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53