Make receipts id optional

(SMACK-815)

Remove @author and change javadoc
This commit is contained in:
Paul Schaub 2018-04-28 13:24:46 +02:00
父節點 f69cd55970
當前提交 95534da53f
簽署人: vanitasvitae
GPG 金鑰 ID: 62BEE9264BF17311
共有 2 個檔案被更改,包括 10 行新增5 行删除

查看文件

@ -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);