about summary refs log tree commit diff stats
path: root/src/command/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/commands.c')
-rw-r--r--src/command/commands.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 9c16ef81..7943bfad 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1838,8 +1838,40 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
         if (tiny != NULL) {
             if (win_type == WIN_CHAT) {
                 char *recipient = ui_current_recipient();
-                message_send(tiny, recipient);
+#ifdef HAVE_LIBOTR
+                if (otr_is_secure(recipient)) {
+                    char *encrypted = otr_encrypt_message(recipient, tiny);
+                    if (encrypted != NULL) {
+                        message_send(encrypted, recipient);
+                        otr_free_message(encrypted);
+                        if (prefs_get_boolean(PREF_CHLOG)) {
+                            const char *jid = jabber_get_fulljid();
+                            Jid *jidp = jid_create(jid);
+                            if (strcmp(prefs_get_string(PREF_OTR_LOG), "on") == 0) {
+                                chat_log_chat(jidp->barejid, recipient, tiny, PROF_OUT_LOG, NULL);
+                            } else if (strcmp(prefs_get_string(PREF_OTR_LOG), "redact") == 0) {
+                                chat_log_chat(jidp->barejid, recipient, "[redacted]", PROF_OUT_LOG, NULL);
+                            }
+                            jid_destroy(jidp);
+                        }
+
+                        ui_outgoing_msg("me", recipient, tiny);
+                    } else {
+                        cons_show_error("Failed to send message.");
+                    }
+                } else {
+                    message_send(tiny, recipient);
+                    if (prefs_get_boolean(PREF_CHLOG)) {
+                        const char *jid = jabber_get_fulljid();
+                        Jid *jidp = jid_create(jid);
+                        chat_log_chat(jidp->barejid, recipient, tiny, PROF_OUT_LOG, NULL);
+                        jid_destroy(jidp);
+                    }
 
+                    ui_outgoing_msg("me", recipient, tiny);
+                }
+#else
+                message_send(tiny, recipient);
                 if (prefs_get_boolean(PREF_CHLOG)) {
                     const char *jid = jabber_get_fulljid();
                     Jid *jidp = jid_create(jid);
@@ -1848,6 +1880,7 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
                 }
 
                 ui_outgoing_msg("me", recipient, tiny);
+#endif
             } else if (win_type == WIN_PRIVATE) {
                 char *recipient = ui_current_recipient();
                 message_send(tiny, recipient);
0548'>^
ec75b5e0 ^
bfd7362e ^


55282e06 ^
bfd7362e ^


55282e06 ^
bfd7362e ^

b4ea35d4 ^

bfd7362e ^

527e739a ^
bfd7362e ^
62b89a4d ^
bfd7362e ^



49676e3f ^
bfd7362e ^
49676e3f ^

17757c86 ^








ba11e88d ^
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70