X-Git-Url: http://git.babelmonkeys.de/?p=xmppchat.git;a=blobdiff_plain;f=js%2Fmain.js;h=6072c6704f404a13ae48428c9fb0aefe1e5a5e6c;hp=c64776da37ac3b9bcffbce38cf17703797323adb;hb=b05a99e9f93f553586cc4210d4cc79caa174f1e0;hpb=b0c2de16a64172c6a7760f62428e4c785c381edf diff --git a/js/main.js b/js/main.js index c64776d..6072c67 100644 --- a/js/main.js +++ b/js/main.js @@ -72,16 +72,23 @@ function addBubble(nick) { function handleMessage(msg) { var html = ''; - var sender = Strophe.getResourceFromJid(msg.getAttribute('from')); + var sender = Strophe.xmlescape(Strophe.getResourceFromJid(msg.getAttribute('from'))); var type = msg.getAttribute('type'); - var body = Strophe.getText(msg.getElementsByTagName('body')[0]); + var body = Strophe.xmlescape(Strophe.getText(msg.getElementsByTagName('body')[0])); html += '
'; if (sender) { - html += ''; - html += sender; - html += ': '; - html += body + '
'; + if (body.search(/^\/me/) == 0) { + body = body.replace(/^\/me/, sender); + html += ''; + html += body; + html += ''; + } else { + html += ''; + html += sender; + html += ': '; + html += body + ''; + } } else { html += ''; html += body + '';