Browse Source

Make receipts id optional

(SMACK-815)

Remove @author and change javadoc
tags/4.3.0
Paul Schaub 2 years ago
parent
commit
95534da53f
No known key found for this signature in database GPG Key ID: 62BEE9264BF17311
2 changed files with 10 additions and 5 deletions
  1. +8
    -4
      smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceipt.java
  2. +2
    -1
      smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/ReceiptReceivedListener.java

+ 8
- 4
smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceipt.java View File

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


+ 2
- 1
smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/ReceiptReceivedListener.java View File

@@ -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…
Cancel
Save