Rich text (xhtml) messages

I’'m unsure how to send rich text versions of the message bodies using XIFF. Here is what I have tried:

var message:Message = new Message(jid, null, body, htmlBody, “chat”, null);

connection.send(message);

The contents of htmlBody in this case is:

hi!

This is taken from the first example in the RFC, at:
http://www.xmpp.org/extensions/xep-0071.html

I have also tried just putting “<p style=’‘font-weight:bold’’>hi!

” as well as “test” in there, which doesn’'t work either.

The exception I get is:

TypeError: Error #1034: Type Coercion failed: cannot convert org.jivesoftware.xiff.data.xhtml::XHTMLExtension@27d2d119 to org.jivesoftware.xiff.data.ISerializable.

at org.jivesoftware.xiff.data::XMPPStanza/serialize()

at org.jivesoftware.xiff.data::Message/serialize()

at org.jivesoftware.xiff.core::XMPPConnection/send()

at com.bullhorn::IncomingEvents/sendMessage()

 at Function/http://adobe.com/AS3/2006/builtin::apply()

at ()

at flash.external::ExternalInterface$/flash.external:ExternalInterface::_callIn()

at ()

Message was edited by: cseibert

Forgot - I’'m using xiff_as3_flexlib_beta2.swc

Tried the lated revision of XIFF as well. Can anyone confirm that xhtml actually works in XIFF, and that this isn’'t just a placeholder parameter?

FYI - I tracked this down. It looks like at some point Extensions were mandated to implement ISerializable, but the XHTMLExtension was never converted.

Simply implementing that interface with dummy methods works:

public class XHTMLExtension extends Extension implements IExtension, ISerializable

public function serialize( parent:XMLNode ):Boolean

{

return true;

}

public function deserialize( node:XMLNode ):Boolean

{

return true;

}

I’'ll submit it.

Thanks Chase. You saved me a lot of trouble :slight_smile:

I committed that change (plus some other cleanups/optimizations) in r10703. Let me know if it’s working now

I dont have r10703 code and i made these changes in my xiff version xiff_3_0_0-beta1 (I downloaded it from this website). But I have one issue currently - I’m using XMPP for my chat client. I want the text formatting support in my chat window. Lke - bold, Italic, Underline, Mutilple Fonts etc. I’m using textArea for both composing and displaying the messages in UI. For some reason i cannot use native RichtextEditor component for the same. For achieving the text formatting I’m using TextFormat, TextRange classes I want to know how can I create XEP-0071 standards compliant (i.e. XHTML complaint) message stanza when i type a formatted text in chat window?

For ex- if I type “Hi. How are u?” in chat window then the message stanza should be this

Hi. How are you?Hi. How are you?

Right now the htmltext generated after my implementation is this

Hi. How are

you?