mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-12 19:02:06 +01:00
Return delivery receipts with the same type as the request
Message delivery receipts now use the same message type as the corresponding message with the delivery receipt request.
This commit is contained in:
parent
18d9be0099
commit
b813e3aa9e
1 changed files with 15 additions and 2 deletions
|
@ -156,8 +156,8 @@ public class DeliveryReceiptManager extends Manager {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Message ack = new Message(from, Message.Type.normal);
|
final Message messageWithReceiptRequest = (Message) packet;
|
||||||
ack.addExtension(new DeliveryReceipt(packet.getStanzaId()));
|
Message ack = receiptMessageFor(messageWithReceiptRequest);
|
||||||
connection.sendPacket(ack);
|
connection.sendPacket(ack);
|
||||||
}
|
}
|
||||||
}, MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST);
|
}, MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST);
|
||||||
|
@ -286,4 +286,17 @@ public class DeliveryReceiptManager extends Manager {
|
||||||
public static String addDeliveryReceiptRequest(Message m) {
|
public static String addDeliveryReceiptRequest(Message m) {
|
||||||
return DeliveryReceiptRequest.addTo(m);
|
return DeliveryReceiptRequest.addTo(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and return a new message including a delivery receipt extension for the given message.
|
||||||
|
*
|
||||||
|
* @param messageWithReceiptRequest the given message with a receipt request extension.
|
||||||
|
* @return a new message with a receipt.
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
public static Message receiptMessageFor(Message messageWithReceiptRequest) {
|
||||||
|
Message message = new Message(messageWithReceiptRequest.getFrom(), messageWithReceiptRequest.getType());
|
||||||
|
message.addExtension(new DeliveryReceipt(messageWithReceiptRequest.getStanzaId()));
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue