当前位置: 首页>>代码示例>>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;未经允许,请勿转载。