about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-03-11 23:47:11 +0000
committerJames Booth <boothj5@gmail.com>2015-03-11 23:47:11 +0000
commit57c7564445bb9b3034be895a709d8ec777188a74 (patch)
treebc1d30407978e03e48978ccd512e0608e0b12f1d /src/command
parent78becceedb19b1a793fcd3465363501f5468a83d (diff)
downloadprofani-tty-57c7564445bb9b3034be895a709d8ec777188a74.tar.gz
Show message received text for receipts
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c12
-rw-r--r--src/command/commands.c19
2 files changed, 16 insertions, 15 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 2186d224..806a75f2 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1945,7 +1945,7 @@ _cmd_execute_default(const char * inp)
                 if (otr_is_secure(chatwin->barejid)) {
                     char *encrypted = otr_encrypt_message(chatwin->barejid, inp);
                     if (encrypted != NULL) {
-                        message_send_chat_encrypted(chatwin->barejid, encrypted);
+                        char *id = message_send_chat_encrypted(chatwin->barejid, encrypted);
                         otr_free_message(encrypted);
                         if (prefs_get_boolean(PREF_CHLOG)) {
                             const char *jid = jabber_get_fulljid();
@@ -1960,12 +1960,12 @@ _cmd_execute_default(const char * inp)
                             jid_destroy(jidp);
                         }
 
-                        ui_outgoing_chat_msg("me", chatwin->barejid, inp);
+                        ui_outgoing_chat_msg("me", chatwin->barejid, inp, id);
                     } else {
                         cons_show_error("Failed to send message.");
                     }
                 } else {
-                    message_send_chat(chatwin->barejid, inp);
+                    char *id = message_send_chat(chatwin->barejid, inp);
                     if (prefs_get_boolean(PREF_CHLOG)) {
                         const char *jid = jabber_get_fulljid();
                         Jid *jidp = jid_create(jid);
@@ -1973,10 +1973,10 @@ _cmd_execute_default(const char * inp)
                         jid_destroy(jidp);
                     }
 
-                    ui_outgoing_chat_msg("me", chatwin->barejid, inp);
+                    ui_outgoing_chat_msg("me", chatwin->barejid, inp, id);
                 }
 #else
-                message_send_chat(chatwin->barejid, inp);
+                char *id = message_send_chat(chatwin->barejid, inp);
                 if (prefs_get_boolean(PREF_CHLOG)) {
                     const char *jid = jabber_get_fulljid();
                     Jid *jidp = jid_create(jid);
@@ -1984,7 +1984,7 @@ _cmd_execute_default(const char * inp)
                     jid_destroy(jidp);
                 }
 
-                ui_outgoing_chat_msg("me", chatwin->barejid, inp);
+                ui_outgoing_chat_msg("me", chatwin->barejid, inp, id);
 #endif
             }
             break;
diff --git a/src/command/commands.c b/src/command/commands.c
index 1851a3f4..dd63b25f 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1265,9 +1265,9 @@ cmd_msg(gchar **args, struct cmd_help_t help)
             if (otr_is_secure(barejid)) {
                 char *encrypted = otr_encrypt_message(barejid, msg);
                 if (encrypted != NULL) {
-                    message_send_chat_encrypted(barejid, encrypted);
+                    char *id = message_send_chat_encrypted(barejid, encrypted);
                     otr_free_message(encrypted);
-                    ui_outgoing_chat_msg("me", barejid, msg);
+                    ui_outgoing_chat_msg("me", barejid, msg, id);
 
                     if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
                         const char *jid = jabber_get_fulljid();
@@ -1286,6 +1286,7 @@ cmd_msg(gchar **args, struct cmd_help_t help)
                 }
             } else {
                 prof_otrpolicy_t policy = otr_get_policy(barejid);
+                char *id = NULL;
 
                 if (policy == PROF_OTRPOLICY_ALWAYS) {
                     cons_show_error("Failed to send message. Please check OTR policy");
@@ -1294,13 +1295,13 @@ cmd_msg(gchar **args, struct cmd_help_t help)
                     GString *otr_message = g_string_new(msg);
                     g_string_append(otr_message, OTRL_MESSAGE_TAG_BASE);
                     g_string_append(otr_message, OTRL_MESSAGE_TAG_V2);
-                    message_send_chat_encrypted(barejid, otr_message->str);
+                    id = message_send_chat_encrypted(barejid, otr_message->str);
 
                     g_string_free(otr_message, TRUE);
                 } else {
-                    message_send_chat(barejid, msg);
+                    id = message_send_chat(barejid, msg);
                 }
-                ui_outgoing_chat_msg("me", barejid, msg);
+                ui_outgoing_chat_msg("me", barejid, msg, id);
 
                 if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
                     const char *jid = jabber_get_fulljid();
@@ -3073,7 +3074,7 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
                 if (otr_is_secure(chatwin->barejid)) {
                     char *encrypted = otr_encrypt_message(chatwin->barejid, tiny);
                     if (encrypted != NULL) {
-                        message_send_chat_encrypted(chatwin->barejid, encrypted);
+                        char *id = message_send_chat_encrypted(chatwin->barejid, encrypted);
                         otr_free_message(encrypted);
                         if (prefs_get_boolean(PREF_CHLOG)) {
                             const char *jid = jabber_get_fulljid();
@@ -3088,12 +3089,12 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
                             jid_destroy(jidp);
                         }
 
-                        ui_outgoing_chat_msg("me", chatwin->barejid, tiny);
+                        ui_outgoing_chat_msg("me", chatwin->barejid, tiny, id);
                     } else {
                         cons_show_error("Failed to send message.");
                     }
                 } else {
-                    message_send_chat(chatwin->barejid, tiny);
+                    char *id = message_send_chat(chatwin->barejid, tiny);
                     if (prefs_get_boolean(PREF_CHLOG)) {
                         const char *jid = jabber_get_fulljid();
                         Jid *jidp = jid_create(jid);
@@ -3101,7 +3102,7 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
                         jid_destroy(jidp);
                     }
 
-                    ui_outgoing_chat_msg("me", chatwin->barejid, tiny);
+                    ui_outgoing_chat_msg("me", chatwin->barejid, tiny, id);
                 }
 #else
                 message_send_chat(chatwin->barejid, tiny);