From: Florian Zeitz Date: Sat, 28 Nov 2009 21:27:21 +0000 (+0100) Subject: /me support X-Git-Url: http://git.babelmonkeys.de/?p=xmppchat.git;a=commitdiff_plain;h=b05a99e9f93f553586cc4210d4cc79caa174f1e0 /me support * Support for the /me command * Fix escaping * New strophe.js version --- 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 + ''; diff --git a/js/strophejs b/js/strophejs index f31e73f..77fd143 160000 --- a/js/strophejs +++ b/js/strophejs @@ -1 +1 @@ -Subproject commit f31e73fd12ca779b6cd93043496eda001e3b1aee +Subproject commit 77fd14321c069bf88d0bf6041af8951c22420cb3