mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-16 10:01:08 +01:00
Rename 'Packet' class to 'Stanza'
Smack still uses the term 'Packet' in some places. This is just the first step towards using correct XMPP terms in Smack.
This commit is contained in:
parent
9fc26f1d83
commit
4698805a34
142 changed files with 595 additions and 572 deletions
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.receipts;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
|
@ -76,10 +76,10 @@ public class DeliveryReceipt implements PacketExtension
|
|||
*
|
||||
* @param p the packet
|
||||
* @return the {@link DeliveryReceipt} extension or {@code null}
|
||||
* @deprecated use {@link #from(Packet)} instead
|
||||
* @deprecated use {@link #from(Stanza)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static DeliveryReceipt getFrom(Packet p) {
|
||||
public static DeliveryReceipt getFrom(Stanza p) {
|
||||
return from(p);
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ public class DeliveryReceipt implements PacketExtension
|
|||
* @param packet the packet
|
||||
* @return the {@link DeliveryReceipt} extension or {@code null}
|
||||
*/
|
||||
public static DeliveryReceipt from(Packet packet) {
|
||||
public static DeliveryReceipt from(Stanza packet) {
|
||||
return packet.getExtension(ELEMENT, NAMESPACE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smack.filter.PacketExtensionFilter;
|
|||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.roster.Roster;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ public class DeliveryReceiptManager extends Manager {
|
|||
// Add the packet listener to handling incoming delivery receipts
|
||||
connection.addAsyncPacketListener(new PacketListener() {
|
||||
@Override
|
||||
public void processPacket(Packet packet) throws NotConnectedException {
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
DeliveryReceipt dr = DeliveryReceipt.from(packet);
|
||||
// notify listeners of incoming receipt
|
||||
for (ReceiptReceivedListener l : receiptReceivedListeners) {
|
||||
|
|
@ -141,7 +141,7 @@ public class DeliveryReceiptManager extends Manager {
|
|||
// Add the packet listener to handle incoming delivery receipt requests
|
||||
connection.addAsyncPacketListener(new PacketListener() {
|
||||
@Override
|
||||
public void processPacket(Packet packet) throws NotConnectedException {
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
final String from = packet.getFrom();
|
||||
final XMPPConnection connection = connection();
|
||||
switch (autoReceiptMode) {
|
||||
|
|
@ -157,7 +157,7 @@ public class DeliveryReceiptManager extends Manager {
|
|||
}
|
||||
|
||||
Message ack = new Message(from, Message.Type.normal);
|
||||
ack.addExtension(new DeliveryReceipt(packet.getPacketID()));
|
||||
ack.addExtension(new DeliveryReceipt(packet.getStanzaId()));
|
||||
connection.sendPacket(ack);
|
||||
}
|
||||
}, MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST);
|
||||
|
|
@ -234,7 +234,7 @@ public class DeliveryReceiptManager extends Manager {
|
|||
|
||||
private static final PacketListener AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER = new PacketListener() {
|
||||
@Override
|
||||
public void processPacket(Packet packet) throws NotConnectedException {
|
||||
public void processPacket(Stanza packet) throws NotConnectedException {
|
||||
Message message = (Message) packet;
|
||||
DeliveryReceiptRequest.addTo(message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.receipts;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.id.StanzaIdUtil;
|
||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||
|
|
@ -56,10 +56,10 @@ public class DeliveryReceiptRequest implements PacketExtension
|
|||
*
|
||||
* @param p the packet
|
||||
* @return the {@link DeliveryReceiptRequest} extension or {@code null}
|
||||
* @deprecated use {@link #from(Packet)} instead
|
||||
* @deprecated use {@link #from(Stanza)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static DeliveryReceiptRequest getFrom(Packet p) {
|
||||
public static DeliveryReceiptRequest getFrom(Stanza p) {
|
||||
return from(p);
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ public class DeliveryReceiptRequest implements PacketExtension
|
|||
* @param packet the packet
|
||||
* @return the {@link DeliveryReceiptRequest} extension or {@code null}
|
||||
*/
|
||||
public static DeliveryReceiptRequest from(Packet packet) {
|
||||
public static DeliveryReceiptRequest from(Stanza packet) {
|
||||
return packet.getExtension(ELEMENT, DeliveryReceipt.NAMESPACE);
|
||||
}
|
||||
|
||||
|
|
@ -83,11 +83,11 @@ public class DeliveryReceiptRequest implements PacketExtension
|
|||
* @return the Message ID which will be used as receipt ID
|
||||
*/
|
||||
public static String addTo(Message message) {
|
||||
if (message.getPacketID() == null) {
|
||||
message.setPacketID(StanzaIdUtil.newStanzaId());
|
||||
if (message.getStanzaId() == null) {
|
||||
message.setStanzaId(StanzaIdUtil.newStanzaId());
|
||||
}
|
||||
message.addExtension(new DeliveryReceiptRequest());
|
||||
return message.getPacketID();
|
||||
return message.getStanzaId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.receipts;
|
||||
|
||||
import org.jivesoftware.smack.packet.Packet;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
/**
|
||||
* Interface for received receipt notifications.
|
||||
|
|
@ -28,7 +28,7 @@ public interface ReceiptReceivedListener {
|
|||
* Callback invoked when a new receipt got received.
|
||||
* <p>
|
||||
* {@code receiptId} correspondents to the message ID, which can be obtained with
|
||||
* {@link org.jivesoftware.smack.packet.Packet#getPacketID()}.
|
||||
* {@link org.jivesoftware.smack.packet.Stanza#getStanzaId()}.
|
||||
* </p>
|
||||
*
|
||||
* @param fromJid the jid that send this receipt
|
||||
|
|
@ -36,5 +36,5 @@ public interface ReceiptReceivedListener {
|
|||
* @param receiptId the message ID of the packet which has been received and this receipt is for
|
||||
* @param receipt the receipt
|
||||
*/
|
||||
void onReceiptReceived(String fromJid, String toJid, String receiptId, Packet receipt);
|
||||
void onReceiptReceived(String fromJid, String toJid, String receiptId, Stanza receipt);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue