simple-xmpp / node-simple-xmpp

Simple High Level NodeJS XMPP Client
300 stars 90 forks source link

How to send styled messages? #34

Open AndrewRayCode opened 11 years ago

AndrewRayCode commented 11 years ago

I'm trying things like

'<html xmlns="http://www.w3.org/1999/xhtml"><body>'+res+'</body></html>' 

but I just get the html in a chat room. How to send formatted messages?

silverbucket commented 11 years ago

I'm not sure I understand your question, could you give some more information as to what you're trying to do, and how you're trying to achieve it?

AndrewRayCode commented 11 years ago

You can send rich text messages using simple HTML, because jabber is disgusting

http://xmpp.org/extensions/xep-0071.html

but when I send html like in their examples, it spits out the actual html

cescopag commented 9 years ago

I'm afraid it's not possible with simple-xmpp. The "send" method automatically creates the element without the html namespace:

this.send = function(to, message, group) {

    $.ready(function() {
        var stanza = new xmpp.Element('message', { to: to, type: (group ? 'groupchat' : 'chat') });
        stanza.c('body').t(message);
        conn.send(stanza);
    });
};