本文整理汇总了Java中org.jivesoftware.smack.packet.Packet.getFrom方法的典型用法代码示例。如果您正苦于以下问题:Java Packet.getFrom方法的具体用法?Java Packet.getFrom怎么用?Java Packet.getFrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smack.packet.Packet
的用法示例。
在下文中一共展示了Packet.getFrom方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processPacket
import org.jivesoftware.smack.packet.Packet; //导入方法依赖的package包/类
@Override
public void processPacket(Packet packet) {
DeliveryReceipt dr = (DeliveryReceipt)packet.getExtension(
DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE);
if (dr != null) {
// notify listeners of incoming receipt
for (ReceiptReceivedListener l : receiptReceivedListeners) {
l.onReceiptReceived(packet.getFrom(), packet.getTo(), dr.getId());
}
}
// if enabled, automatically send a receipt
if (auto_receipts_enabled) {
DeliveryReceiptRequest drr = (DeliveryReceiptRequest)packet.getExtension(
DeliveryReceiptRequest.ELEMENT, DeliveryReceipt.NAMESPACE);
if (drr != null) {
Message ack = new Message(packet.getFrom(), Message.Type.normal);
ack.addExtension(new DeliveryReceipt(packet.getPacketID()));
connection.sendPacket(ack);
}
}
}
示例2: accept
import org.jivesoftware.smack.packet.Packet; //导入方法依赖的package包/类
public boolean accept(Packet packet) {
if (packet.getFrom() == null) {
return false;
}
else if (matchBareJID) {
// Check if the bare JID of the sender of the packet matches the specified JID
return packet.getFrom().toLowerCase().startsWith(address);
}
else {
// Check if the full JID of the sender of the packet matches the specified JID
return address.equals(packet.getFrom().toLowerCase());
}
}
示例3: accept
import org.jivesoftware.smack.packet.Packet; //导入方法依赖的package包/类
public boolean accept(Packet packet) {
if (packet.getFrom() == null) {
return false;
}
else {
return packet.getFrom().toLowerCase().indexOf(from) != -1;
}
}
示例4: accept
import org.jivesoftware.smack.packet.Packet; //导入方法依赖的package包/类
public boolean accept(Packet p) {
String from = p.getFrom();
if (from == null) {
return false;
}
return roomAddressTable.containsKey(StringUtils.parseBareAddress(from).toLowerCase());
}
示例5: processPacket
import org.jivesoftware.smack.packet.Packet; //导入方法依赖的package包/类
public void processPacket(Packet p) {
String from = p.getFrom();
if (from == null) {
return;
}
PacketMultiplexListener listener =
roomListenersByAddress.get(StringUtils.parseBareAddress(from).toLowerCase());
if (listener != null) {
listener.processPacket(p);
}
}