fromjidfilter.java
来自「开源项目openfire的完整源程序」· Java 代码 · 共 46 行
JAVA
46 行
/** * $Revision$ * $Date$ * * Copyright (C) 1999-2005 Jive Software. All rights reserved. * This software is the proprietary information of Jive Software. Use is subject to license terms. */package org.jivesoftware.spark.ui;import org.jivesoftware.smack.filter.PacketFilter;import org.jivesoftware.smack.packet.Packet;import org.jivesoftware.smack.util.StringUtils;/** * Filters for packets where the "from" field contains a specified value. * * @author Matt Tucker */public class FromJIDFilter implements PacketFilter { private String from; /** * Creates a "from" contains filter using the "from" field part. * * @param from the from field value the packet must contain. */ public FromJIDFilter(String from) { if (from == null) { throw new IllegalArgumentException("Parameter cannot be null."); } this.from = StringUtils.parseBareAddress(from.toLowerCase()); } public boolean accept(Packet packet) { if (packet.getFrom() == null) { return false; } else { return packet.getFrom().toLowerCase().startsWith(from); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?