PacketExtension question

Hey, I’‘m having trouble getting a packet extension working (or maybe I’'m just using it incorrectly). I am processing a Message packet in my packet listener, and trying to read a packet extension like this:

DefaultPacketExtension extension =  DefaultPacketExtension)packet.getExtension(
        "html", "http://jabber.org/protocol/xhtml-im");

and I recieve a packet that looks like this:

<message id="Wgvja-13" to="synic@netmindz.net/home"
from="jones@jabber.org/jbother" type="chat">
<body>test test</body>
<html xmlns="http://jabber.org/protocol/xhtml-im">
<body>test </body>
<font>test</font>
</html>
</message>

The extension is not null, but extension.getValue( “body” ) is. Am I using the DefaultPacketExtension incorrectly?

Thanks,

Adam

The default packet extension class isn’‘t sophisticated enough to handle XHTML like you’'re trying to use it. However, Gato is working on an XHTML Smack extension and will likely have it ready in a week or two.

Regards,

Matt

Hi Adam,

I just checked JBother and it looks nice. Good work! As you may know Smack now provides several extensions that you could add to JBother like request the Time of the other client, detect/generate message events (eg. when somebody is composing a reply), exchange roster entries with other clients and store private data in the server.

Regarding the XHTML, as Matt said, I’‘m in the middle of the development and hopefully I’'ll finish it in a couple of weeks (1 or 2). With this new extension you will be able to compose a message with XHTML bodies and receive messages with XHTML bodies (note that the message can hold several bodies). You will also be able to detect if the other party can manage XHTML or not.

Regards,

– Gato