pgstath / Sharp.Xmpp

Sharp.Xmpp is looking for a maintainer! Unfortunatelly I do not have currently the time needed to maintain the library. Luckily a small but vibrant community has evolved around Sharp.Xmpp. If you would like to be the project's maintainer please sent an email to pgstath@gmail.com. This should include issues, tickets and commits that you have done for Sharp.Xmpp or other similar project. Sharp.Xmpp is a multiplatform, Windows and Android, .NET XMPP client assembly.Sharp.Xmpp supports IM functionality & a variety of XMPP extensions, is simple and is extensively tested against Android Xamarin. It is a fork of the currently frozen excellent S22.Xmpp project. Sharp.Xmpp will be at the FOSSDEM 2016 Real time DevRoom!
Other
84 stars 51 forks source link

Sending text that includes HTML tags. #20

Open trenki2 opened 8 years ago

trenki2 commented 8 years ago

When i try to send a message with the content <&> nothing is sent. Similarly when I try to send content that includes HTML tags bold the content is not sent verbatim.

When I manually escape the text before calling SendMessage() using HttpUtility.HtmlEncode(xml) it works as expected. I guess the message text would have to be escaped inside the library?

Cakez0r commented 8 years ago

Sorry I can't create a PR for this just yet, but we have a fix for this at https://github.com/REPLDigital/Sharp.Xmpp/commit/4159c0908e096e88132827a4a3394db2b587b7ab which should be quite painless to make

pgstath commented 8 years ago

Yes, text has to escaped manually before using the library. However, @Cakez0r is elegant, thus with his permission I will include it in the library. Please note that this applies only for XMPP messages and not to any custom iq stanzas.

Cakez0r commented 8 years ago

@pgstath Fine with me

Although I just noticed there should be null checks here too.

trenki2 commented 8 years ago

With that patch when I create a message with the body "body" and afterwards access the Body property I get returned the now modified body. This is unexpected, I think in that case I should get the body that I supplied. I would have to either unescape the body in the xmlelement or keep a separate variable with the original.

And when setting the Body property one would have to escape the text too. So i think the logic has to go into the property setter and getter.