mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Update
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@8378 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
BIN
build/lib/dist/smack.jar
vendored
BIN
build/lib/dist/smack.jar
vendored
Binary file not shown.
BIN
build/lib/dist/smackx-debug.jar
vendored
BIN
build/lib/dist/smackx-debug.jar
vendored
Binary file not shown.
BIN
build/lib/dist/smackx.jar
vendored
BIN
build/lib/dist/smackx.jar
vendored
Binary file not shown.
44
src/java/org/jivesoftware/spark/ui/FromJIDFilter.java
Normal file
44
src/java/org/jivesoftware/spark/ui/FromJIDFilter.java
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* $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;
|
||||
|
||||
|
||||
/**
|
||||
* 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 = from.toLowerCase();
|
||||
}
|
||||
|
||||
public boolean accept(Packet packet) {
|
||||
if (packet.getFrom() == null) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return packet.getFrom().toLowerCase().startsWith(from);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,6 @@ import org.jivesoftware.smack.Roster;
|
||||
import org.jivesoftware.smack.RosterEntry;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.filter.AndFilter;
|
||||
import org.jivesoftware.smack.filter.FromContainsFilter;
|
||||
import org.jivesoftware.smack.filter.OrFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||
@ -34,6 +33,7 @@ import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.ChatRoomButton;
|
||||
import org.jivesoftware.spark.ui.ContactItem;
|
||||
import org.jivesoftware.spark.ui.ContactList;
|
||||
import org.jivesoftware.spark.ui.FromJIDFilter;
|
||||
import org.jivesoftware.spark.ui.MessageEventListener;
|
||||
import org.jivesoftware.spark.ui.RosterDialog;
|
||||
import org.jivesoftware.spark.ui.VCardPanel;
|
||||
@ -47,6 +47,10 @@ import org.jivesoftware.sparkimpl.profile.VCardManager;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
@ -59,10 +63,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
|
||||
/**
|
||||
* This is the Person to Person implementation of <code>ChatRoom</code>
|
||||
* This room only allows for 1 to 1 conversations.
|
||||
@ -109,7 +109,7 @@ public class ChatRoomImpl extends ChatRoom {
|
||||
loadHistory();
|
||||
|
||||
// Register PacketListeners
|
||||
PacketFilter fromFilter = new FromContainsFilter(participantJID);
|
||||
PacketFilter fromFilter = new FromJIDFilter(participantJID);
|
||||
PacketFilter orFilter = new OrFilter(new PacketTypeFilter(Presence.class), new PacketTypeFilter(Message.class));
|
||||
PacketFilter andFilter = new AndFilter(orFilter, fromFilter);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user