about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-08-17 18:45:51 +0100
committerJames Booth <boothj5@gmail.com>2013-11-08 00:17:27 +0000
commit599bee2ce8ddc7974dc4e0592e0c84f9b243a007 (patch)
treea5da3bd7e4a0c03b136ec47e0160f5f280c0a60d /src/command
parent3fce5572eaa3af0a1caeb05ec5783cd40134e0e0 (diff)
downloadprofani-tty-599bee2ce8ddc7974dc4e0592e0c84f9b243a007.tar.gz
Create fingerprints file, callbacks, and message send
Diffstat (limited to 'src/command')
-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 f7737464..7a74f394 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -39,6 +39,7 @@
 #include "jid.h"
 #include "log.h"
 #include "muc.h"
+#include "otr.h"
 #include "profanity.h"
 #include "tools/autocomplete.h"
 #include "tools/parser.h"
@@ -1176,7 +1177,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();
@@ -2230,7 +2237,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)) {
@@ -3015,7 +3029,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();