1 20 21 package org.jivesoftware.smack.filter; 22 23 import org.jivesoftware.smack.packet.Packet; 24 import org.jivesoftware.smack.packet.Message; 25 26 31 public class ThreadFilter implements PacketFilter { 32 33 private String thread; 34 35 40 public ThreadFilter(String thread) { 41 if (thread == null) { 42 throw new IllegalArgumentException ("Thread cannot be null."); 43 } 44 this.thread = thread; 45 } 46 47 public boolean accept(Packet packet) { 48 if (packet instanceof Message) { 49 return thread.equals(((Message)packet).getThread()); 50 } 51 else { 52 return false; 53 } 54 } 55 } 56 | Popular Tags |