mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 13:32:07 +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;
|
||||
}
|
||||
|
||||
Message ack = new Message(from, Message.Type.normal);
|
||||
ack.addExtension(new DeliveryReceipt(packet.getStanzaId()));
|
||||
final Message messageWithReceiptRequest = (Message) packet;
|
||||
Message ack = receiptMessageFor(messageWithReceiptRequest);
|
||||
connection.sendPacket(ack);
|
||||
}
|
||||
}, MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST);
|
||||
|
@ -286,4 +286,17 @@ public class DeliveryReceiptManager extends Manager {
|
|||
public static String addDeliveryReceiptRequest(Message 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