mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-29 07:22:07 +01:00
Make receipts id optional
(SMACK-815) Remove @author and change javadoc
This commit is contained in:
parent
f69cd55970
commit
95534da53f
2 changed files with 10 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2013-2015 the original author or authors
|
||||
* Copyright 2013-2018 the original author or authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -22,7 +22,6 @@ import java.util.Map;
|
|||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
/**
|
||||
|
@ -41,9 +40,14 @@ public class DeliveryReceipt implements ExtensionElement {
|
|||
private final String id;
|
||||
|
||||
public DeliveryReceipt(String id) {
|
||||
this.id = StringUtils.requireNotNullOrEmpty(id, "id must not be null");
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the id of the message that has been delivered.
|
||||
*
|
||||
* @return id of the delivered message or {@code null}.
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -61,7 +65,7 @@ public class DeliveryReceipt implements ExtensionElement {
|
|||
@Override
|
||||
public XmlStringBuilder toXML() {
|
||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||
xml.attribute("id", id);
|
||||
xml.optAttribute("id", id);
|
||||
xml.closeEmptyElement();
|
||||
return xml;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ public interface ReceiptReceivedListener {
|
|||
*
|
||||
* @param fromJid the jid that send this receipt
|
||||
* @param toJid the jid which received this receipt
|
||||
* @param receiptId the message ID of the stanza which has been received and this receipt is for
|
||||
* @param receiptId the message ID of the stanza which has been received and this receipt is for.
|
||||
* This might be {@code null}.
|
||||
* @param receipt the receipt
|
||||
*/
|
||||
void onReceiptReceived(Jid fromJid, Jid toJid, String receiptId, Stanza receipt);
|
||||
|
|
Loading…
Reference in a new issue