views:

52

answers:

2

Hi all,

client1 can send txt message to client2 using

connection.getChatManager().createChat(to, this).sendMessage(message);

How to send other kind of message: like INFO message ? (client1 to client2) ?

Because I want, INFO message should not be displayed in the chat window....is it possible ? using smack, smackx library.

Many Thanks.

+1  A: 

What you want do do here is to add an extension to your text message. Here is a rough guide.

Chat chat = connection.getChatManager().createChat(to, this);
Message message = new Message(to, Message.Type.chat);
message.setBody("hello");
message.setProperty(prop0, val0);
message.setProperty(prop1, val1);
chat.sendMessage(message)

The properties are carried in a separate namespace (use toXML() to look at it) and will not appear in the chat window. On the 'other side', the applications uses getProperty() to retrieve the value.

If you do not want key/value pairs, but structured data, use addExtension() in the message body. This is a little more complicated because you basically have to extend PacketExtension, provide your own namespace. You might even have to write a PacketExtensionProvider.

Chuk Lee
A: 

i am creating a chat client for facebook...i've accessed server..all datas are transferring & receiving quite fine..problem is roster is not showing anybody available..m also unable to send & receive masseges

dibosh