about summary refs log tree commit diff stats
path: root/src/otr
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-08-18 22:51:06 +0100
committerJames Booth <boothj5@gmail.com>2016-08-18 22:53:23 +0100
commita978bb12bf0235be9e57e0e08b6328acc88add8b (patch)
treef5245c813a82bcbcf5d403ceed2c9ec189abc3e0 /src/otr
parent71dcb2e427ec3e7e15f2131f18d64b84fc6230f8 (diff)
downloadprofani-tty-a978bb12bf0235be9e57e0e08b6328acc88add8b.tar.gz
Send receipt request only when receiver supports feature
issue #829
Diffstat (limited to 'src/otr')
-rw-r--r--src/otr/otr.c16
-rw-r--r--src/otr/otr.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/src/otr/otr.c b/src/otr/otr.c
index 8aa3bac1..158e6d27 100644
--- a/src/otr/otr.c
+++ b/src/otr/otr.c
@@ -117,7 +117,7 @@ static void
 cb_inject_message(void *opdata, const char *accountname,
     const char *protocol, const char *recipient, const char *message)
 {
-    char *id = message_send_chat_otr(recipient, message);
+    char *id = message_send_chat_otr(recipient, message, FALSE);
     free(id);
 }
 
@@ -314,7 +314,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
                 memmove(whitespace_base, whitespace_base+tag_length, tag_length);
                 char *otr_query_message = otr_start_query();
                 cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
-                char *id = message_send_chat_otr(barejid, otr_query_message);
+                char *id = message_send_chat_otr(barejid, otr_query_message, FALSE);
                 free(id);
             }
         }
@@ -328,7 +328,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
     if (policy == PROF_OTRPOLICY_ALWAYS && *decrypted == FALSE && !whitespace_base) {
         char *otr_query_message = otr_start_query();
         cons_show("Attempting to start OTR session...");
-        char *id = message_send_chat_otr(barejid, otr_query_message);
+        char *id = message_send_chat_otr(barejid, otr_query_message, FALSE);
         free(id);
     }
 
@@ -336,7 +336,7 @@ otr_on_message_recv(const char *const barejid, const char *const resource, const
 }
 
 gboolean
-otr_on_message_send(ProfChatWin *chatwin, const char *const message)
+otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt)
 {
     char *id = NULL;
     prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid);
@@ -345,9 +345,9 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message)
     if (otr_is_secure(chatwin->barejid)) {
         char *encrypted = otr_encrypt_message(chatwin->barejid, message);
         if (encrypted) {
-            id = message_send_chat_otr(chatwin->barejid, encrypted);
+            id = message_send_chat_otr(chatwin->barejid, encrypted, request_receipt);
             chat_log_otr_msg_out(chatwin->barejid, message);
-            chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_OTR);
+            chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_OTR, request_receipt);
             otr_free_message(encrypted);
             free(id);
             return TRUE;
@@ -366,8 +366,8 @@ otr_on_message_send(ProfChatWin *chatwin, const char *const message)
     // tag and send for policy opportunistic
     if (policy == PROF_OTRPOLICY_OPPORTUNISTIC) {
         char *otr_tagged_msg = otr_tag_message(message);
-        id = message_send_chat_otr(chatwin->barejid, otr_tagged_msg);
-        chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_PLAIN);
+        id = message_send_chat_otr(chatwin->barejid, otr_tagged_msg, request_receipt);
+        chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_PLAIN, request_receipt);
         chat_log_msg_out(chatwin->barejid, message);
         free(otr_tagged_msg);
         free(id);
diff --git a/src/otr/otr.h b/src/otr/otr.h
index 0853f4fc..a50503af 100644
--- a/src/otr/otr.h
+++ b/src/otr/otr.h
@@ -72,7 +72,7 @@ void otr_poll(void);
 void otr_on_connect(ProfAccount *account);
 
 char* otr_on_message_recv(const char *const barejid, const char *const resource, const char *const message, gboolean *decrypted);
-gboolean otr_on_message_send(ProfChatWin *chatwin, const char *const message);
+gboolean otr_on_message_send(ProfChatWin *chatwin, const char *const message, gboolean request_receipt);
 
 void otr_keygen(ProfAccount *account);