本文整理匯總了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);
}
}