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.
This commit is contained in:
parent
bbbd9eda00
commit
d39128ffd7
|
@ -627,6 +627,12 @@ public class MessageProcessor : StreamInteractionModule, Object {
|
||||||
stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, new_message, (_, res) => {
|
stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, new_message, (_, res) => {
|
||||||
try {
|
try {
|
||||||
stream.get_module(MessageModule.IDENTITY).send_message.end(res);
|
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) {
|
} catch (IOStreamError e) {
|
||||||
message.marked = Entities.Message.Marked.UNSENT;
|
message.marked = Entities.Message.Marked.UNSENT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue