On Tuesday February 26 2008, lerosua wrote:
> hi.
>
> i want to use XHtmlIM in my client.
> now i use gloox 1.0 alpha2
> but i have no idea for use the sub class
> StanzaExtension<http://camaya.net/api/gloox-trunk/classgloox_1_1StanzaExten
>sion.html> .
> i can't understand the class XHtmlIM.
> can you give me some example for it . or tell me the important point ?
>
>
> i hope someone can help me. thanks .
To display an XHTML-IM message:
in handleMessage():
const XHtmlIM* x = msg.findExtension<XHtmlIM>( ExtXHtmlIM );
if( x )
{
fancy_func_to_display_xhtml_from_gloox_tag( x->xhtml() );
}
To send an XHTML-IM message:
- prepare your XHTML message according to XEP-0071, i.e. including both the
<html> and <body> wrapper elements [1].
Tag* html = new Tag( "html" );
html->setXmlns( XMLNS_XHTML_IM );
Tag* body = new Tag( html, "body" );
body->setXmlns( ... );
// ...
- prepare a Message and send it off:
Message msg( ... );
msg.addExtension( new XHtmlIM( html ) );
m_client->send( msg );
I just made a couple fixes to the XHtmlIM class in svn. You might want to pull
it from there.
cheers,
Jakob
[1] http://www.xmpp.org/extensions/xep-0071.html#wrapper
Attachment:
signature.asc
Description: This is a digitally signed message part.