mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 18:59:41 +02:00
Implement XEP-0184 delivery notifications
This patch provides three components required to implement XEP-0184: * DeliveryReceiptRequest is a PacketExtension to request a receipt * DeliveryReceipt is a PacketExtension that contains the receipt * DeliveryReceiptManager to handle sending/receiving of requests and receipts. Implementation: For requesting a receipt, just add a new DeliveryReceiptRequest() to your message or use the helper function: DeliveryReceiptManager.addDeliveryReceiptRequest(packet); Register a ReceiptReceivedListener to find out if your packet arrived: DeliveryReceiptManager.getInstanceFor(myConnection) .registerReceiptReceivedListener(new ReceiptReceivedListener() { @Override public void onReceiptReceived(String fromJid, String toJid, String receiptId) { // receipt received for packet id receiptId } To answer a receipt request, you can either check incoming packets manually: if (DeliveryReceiptManager.hasDeliveryReceiptRequest(packet)) { // send receipt } Or you can enable automatic receipt transmission with: DeliveryReceiptManager.getInstanceFor(myConnection) .setAutoReceiptsEnabled(true); Signed-Off-By: Georg Lukas <georg@op-co.de> git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13431 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
f0cd048635
commit
bfefbdb777
5 changed files with 497 additions and 0 deletions
|
@ -666,4 +666,16 @@
|
|||
<namespace>urn:xmpp:ping</namespace>
|
||||
<className>org.jivesoftware.smackx.ping.provider.PingProvider</className>
|
||||
</iqProvider>
|
||||
|
||||
<!-- XEP-0184 Message Delivery Receipts -->
|
||||
<extensionProvider>
|
||||
<elementName>received</elementName>
|
||||
<namespace>urn:xmpp:receipts</namespace>
|
||||
<className>org.jivesoftware.smackx.receipts.DeliveryReceipt$Provider</className>
|
||||
</extensionProvider>
|
||||
<extensionProvider>
|
||||
<elementName>request</elementName>
|
||||
<namespace>urn:xmpp:receipts</namespace>
|
||||
<className>org.jivesoftware.smackx.receipts.DeliveryReceiptRequest$Provider</className>
|
||||
</extensionProvider>
|
||||
</smackProviders>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue