Hello!
After updating to OTR 4.0 I came across the problem that the first
message sent to a contact which has "Require private messaging" set
gets lost. This happens without any warning or error message, giving
the false impression that the contact has received the message. :( The
private conversation gets started, though.
The attached patch fixes this for me, at least as far as I can tell. :)
Greetings
Andreas
>From ddde568cbd1df8ce5ffcd59c5adce2ca61eb4e1b Mon Sep 17 00:00:00 2001
From: Andreas Schlick <[email protected]>
Date: Tue, 18 Dec 2012 17:55:24 +0100
Subject: [PATCH] Copy lastmessage to the newly created context.
This fixes a case where the first user message
gets lost when OTRL_POLICY_REQUIRE_ENCRYPTION
policy is set because after establishing the
encryption lastmessage remains with the master
context and will not be resent.
---
src/message.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/message.c b/src/message.c
index 7c39529..b9348cf 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1078,10 +1078,14 @@ int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
/* Copy information from m_context to the new instance context */
context->auth.protocol_version = 3;
context->protocol_version = 3;
-
- if (context_added) {
- context->msgstate = m_context->msgstate;
- }
+ context->msgstate = m_context->msgstate;
+
+ if (m_context->context_priv->may_retransmit) {
+ context->context_priv->lastmessage = m_context->context_priv->lastmessage;
+ m_context->context_priv->lastmessage = NULL;
+ context->context_priv->may_retransmit = m_context->context_priv->may_retransmit;
+ m_context->context_priv->may_retransmit = 0;
+ }
if (msgtype == OTRL_MSGTYPE_DH_KEY) {
otrl_auth_copy_on_key(&(m_context->auth), &(context->auth));
--
1.8.0.2
_______________________________________________
OTR-dev mailing list
[email protected]
http://lists.cypherpunks.ca/mailman/listinfo/otr-dev