Skip to content

Instantly share code, notes, and snippets.

@protoss1010
Created July 15, 2016 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save protoss1010/e0474be6f624e28f3cf30771754cb1e2 to your computer and use it in GitHub Desktop.
Save protoss1010/e0474be6f624e28f3cf30771754cb1e2 to your computer and use it in GitHub Desktop.
package tw.com.fet.ecs.xmpp.level1.listener;
import com.fetnet.libfetnet.Log;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;
import tw.com.fet.ecs.xmpp.history.ChatHistory;
public class EmmaDisplayedMessageListener implements PacketListener {
private static final String TAG = EmmaDisplayedMessageListener.class.getSimpleName();
public void processPacket(Packet packet) {
Message message = (Message) packet;
if (message.getType().equals(Message.Type.chat)) {
ChatHistory.getEmmaDisplayedMessages().add(message);
Log.d(TAG, "get emma chat message! " + packet.toXML() + "Size=" + ChatHistory.getEmmaDisplayedMessages().size());
}
Log.d(TAG, "get emma message! " + packet.toXML());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment