Fix processing of XEP-0184 delivery receipts

This commit is contained in:
fiaxh 2021-04-11 15:24:21 +02:00
parent aeeda76c92
commit 1b92a1f774
2 changed files with 6 additions and 6 deletions

View file

@ -67,8 +67,8 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
stream_interactor.module_manager.get_module(account, Xep.ChatMarkers.Module.IDENTITY).marker_received.connect( (stream, jid, marker, id, message_stanza) => {
on_chat_marker_received.begin(account, jid, marker, id, message_stanza);
});
stream_interactor.module_manager.get_module(account, Xep.MessageDeliveryReceipts.Module.IDENTITY).receipt_received.connect((stream, jid, id) => {
on_receipt_received(account, jid, id);
stream_interactor.module_manager.get_module(account, Xep.MessageDeliveryReceipts.Module.IDENTITY).receipt_received.connect((stream, jid, id, stanza) => {
on_receipt_received(account, jid, id, stanza);
});
stream_interactor.module_manager.get_module(account, Xep.ChatStateNotifications.Module.IDENTITY).chat_state_received.connect((stream, jid, state, stanza) => {
on_chat_state_received.begin(account, jid, state, stanza);
@ -198,8 +198,8 @@ public class CounterpartInteractionManager : StreamInteractionModule, Object {
}
}
private void on_receipt_received(Account account, Jid jid, string id) {
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account, Conversation.Type.CHAT);
private void on_receipt_received(Account account, Jid jid, string id, MessageStanza stanza) {
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).approx_conversation_for_stanza(stanza.from, stanza.to, account, stanza.type_);
if (conversation == null) return;
handle_chat_marker(conversation, jid,Xep.ChatMarkers.MARKER_RECEIVED, id);
}

View file

@ -4,7 +4,7 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "0184_message_delivery_receipts");
public signal void receipt_received(XmppStream stream, Jid jid, string id);
public signal void receipt_received(XmppStream stream, Jid jid, string id, MessageStanza stanza);
private SendPipelineListener send_pipeline_listener = new SendPipelineListener();
@ -37,7 +37,7 @@ namespace Xmpp.Xep.MessageDeliveryReceipts {
private void received_message(XmppStream stream, MessageStanza message) {
StanzaNode? received_node = message.stanza.get_subnode("received", NS_URI);
if (received_node != null) {
receipt_received(stream, message.from, received_node.get_attribute("id", NS_URI));
receipt_received(stream, message.from, received_node.get_attribute("id", NS_URI), message);
}
}
}