Strange Message Behaviour

I''ve come across rather a strange problem so as per usual was hoping someone else has come across it and can provide a solution.

I have written a little chat client. If I run two instances of the program locally and send message between them the behaviour is as expected.

i.e each message is displayed to the user once in a chat window. However if I login to another Jabber client and send messages to a user logged into my program the method message.getBody() returns the body of the message twice!

Even stranger is it only starts doing this once my progam has sent a message to the other Jabber client.

On examing the Debug window the packet I receive looks like this.

Looks like you get this twice ????? Looks like you get this twice ????? megapack777u70

Inside the tag it does appear there are two body tags!!. Is this normal?? Is this something I have to catch in my packet processing.

Any help would be appreciated

Jon

Message was edited by:

Jon@Home

Message was edited by:

Jon@Home

Jon,

What you’‘re seeing is a normal body plus an XHTML body. Notice that the XHTML body is in a special namespace. You don’‘t need to do anything special to handle this, but if you’'d like to use the XHTML body, you can use the XHTML support built-in to Smack.

Regards,

Matt

Gosh, thanks for the speedy response Matt.

I dont really want to use the XHTML body. So I suppose my next question would be, how do I stop message.getBody() from returning the XHTML body. I only really need to display each body once tbh :slight_smile:

Thanks again for your help

Jon

Jon,

I’'m pretty sure that message.getBody should return the normal body and not XHTML. Is that not the case?

Regards,

Matt

Matt, I just been doing some tests to output the body to Standard output and it appears that the problem is one of my own making. Yet to track it down yet though :frowning:

I think message.getBody() only does return the normal message body but somewhere in my code I seem to be grabbing an extra copy of it each time a message gets sent :open_mouth:

Oh well,back to the debugging \o/

Thanks again for your help

Jon