powered by Jive Software

How do I listen for "User is typing a new message" events?

As in the subject, which kind of listener should I use to obtain this information?

Neither PacketListeners or Interceptors seem useful for this purpose.

BTW, my compliments for a so very well designed (and implemented) xmpp library

Have a look at the MessageEventManager, MessageEventNotificationListener, and MessageEventRequestListener classes, also take a look at the Smack Extended Documentation

http://www.jivesoftware.org/builds/smack/docs/latest/documentation/extensions/in dex.html

You should be able to find what your looking for there

hth

Jon

// create filter to get messages with event extensions for this chat

PacketFilter fromFilter = new FromMatchesFilter(jid);

PacketFilter typeFilter = new MessageTypeFilter(Message.Type.NORMAL);

PacketFilter extensionFilter = new PacketExtensionFilter(“x”, “jabber:x:event”);

AndFilter eventFilter = new AndFilter(fromFilter, typeFilter);

eventFilter.addFilter(extensionFilter);

connection.addPacketListener(this, eventFilter);

public void processPacket(Packet packet) {

MessageEvent evt = (MessageEvent)packet.getExtension(“x”,

“jabber:x:event”);

// according to filter, evt should never be null, but just to be safe

if (evt != null) {

if (evt.isComposing()) {

//your logic here

}

}

}

Thank you very much It was a little difficult but luclikly the docs are pretty good.

Now I’‘m able to send and receive composing notifications from other jabber clients like “kopete”. With Gaim I’‘ve still some problems (it receives my notification, but I don’‘t get his)… BTW it’'s a good step forward

Davide