當前位置: 首頁>>代碼示例>>Java>>正文


Java Packet.getFrom方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:CJC-ivotten,項目名稱:androidPN-client.,代碼行數:24,代碼來源:DeliveryReceiptManager.java

示例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());
    }
}
 
開發者ID:ice-coffee,項目名稱:EIM,代碼行數:14,代碼來源:FromMatchesFilter.java

示例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;
    }
}
 
開發者ID:ice-coffee,項目名稱:EIM,代碼行數:9,代碼來源:FromContainsFilter.java

示例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());
}
 
開發者ID:ice-coffee,項目名稱:EIM,代碼行數:8,代碼來源:RoomListenerMultiplexor.java

示例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);
    }
}
 
開發者ID:ice-coffee,項目名稱:EIM,代碼行數:14,代碼來源:RoomListenerMultiplexor.java


注:本文中的org.jivesoftware.smack.packet.Packet.getFrom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。