aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-05-24 16:01:03 +0200
committerfiaxh <git@lightrise.org>2020-05-24 16:01:03 +0200
commitd39128ffd7ae67bdd6a41b143d8799c4ddd79a55 (patch)
tree3c4578f0c550be3119e8fa9b16a2e24d55e9146b
parentbbbd9eda00bd428f3404a60644431c97bac99c8d (diff)
downloaddino-d39128ffd7ae67bdd6a41b143d8799c4ddd79a55.tar.gz
dino-d39128ffd7ae67bdd6a41b143d8799c4ddd79a55.zip
Store current resource for sent message (if server didn't give us the resource we asked for)
Some servers give out random resources. Then, we didn't deduplicate own messages afterwards because we saved the wrong resource.
-rw-r--r--libdino/src/service/message_processor.vala6
1 files changed, 6 insertions, 0 deletions
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala
index 266482ac..0e390540 100644
--- a/libdino/src/service/message_processor.vala
+++ b/libdino/src/service/message_processor.vala
@@ -627,6 +627,12 @@ public class MessageProcessor : StreamInteractionModule, Object {
stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, new_message, (_, res) => {
try {
stream.get_module(MessageModule.IDENTITY).send_message.end(res);
+
+ // The server might not have given us the resource we asked for. In that case, store the actual resource the message was sent with. Relevant for deduplication.
+ Jid? current_own_jid = stream.get_flag(Bind.Flag.IDENTITY).my_jid;
+ if (!conversation.type_.is_muc_semantic() && current_own_jid != null && !current_own_jid.equals(message.ourpart)) {
+ message.ourpart = current_own_jid;
+ }
} catch (IOStreamError e) {
message.marked = Entities.Message.Marked.UNSENT;
}