Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
deepak #1
Member since Dec 2005 · 26 posts
Group memberships: Members
Show profile · Link to this post
Subject: RTF messages
How can I send rtf messages... I mean message text with Bold/Italics/Underline, colored text and varient font size.
Can anyone pls provide me some VB.NET code??

Thanks.
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

the way to send formatted messages in XMPP is to use XHTML
see: http://www.jabber.org/jeps/jep-0071.html

If you use a RTF Control for creating the messages, then you have to create a RTF -> XHTML converter. Or you have to create your own XMPP extension which allows you to send RTF text.

JEP-0071 is supported by the library.

Alex
Avatar
deepak #3
Member since Dec 2005 · 26 posts
Group memberships: Members
Show profile · Link to this post
Yes I am using rtf control. JEP's... I always stuck at this point, Alex can u pls tell me any example or can u tell me how to use JEP's.

Thanks.
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi deepak,

This JEP is already build in in agsXMPP. If you want to use it then look at the HTML property of the message class. Here you can set the X-HTML of a formatted message.

Here is a small sample how to create the following X-HTML Message of the JEP:

XML-Message
  1. <message>
  2.  <body>hi!</body>
  3.  <html xmlns='http://jabber.org/protocol/xhtml-im'>
  4.     <body xmlns='http://www.w3.org/1999/xhtml'>
  5.       <p style='font-weight:bold'>hi!</p>
  6.     </body>
  7.  </html>
  8. </message>

C# Source code
  1. agsXMPP.protocol.client.Message msg = new agsXMPP.protocol.client.Message();
  2. msg.Body = "hi!";           
  3. msg.Htmlnew agsXMPP.protocol.extensions.html.Html();
  4. msg.Html.InnerXml = "<body xmlns='http://www.w3.org/1999/xhtml'><p style='font-weight:bold'>hi!</p></body>";

Alex
Avatar
deepak #5
Member since Dec 2005 · 26 posts
Group memberships: Members
Show profile · Link to this post
Thank you for the code Alex... I have two more doubts..

1. Do you know any rtf to xhtml converter ?
2. How can we display xhtml message in rtf control.... Is there any xhtml to rtf converter ?
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no i don't know a rtf -> xhtml converter or vice verca.
I also would not use rtf controls here, i would use a webbrowser.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS