From b05a99e9f93f553586cc4210d4cc79caa174f1e0 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Sat, 28 Nov 2009 22:27:21 +0100 Subject: [PATCH] /me support * Support for the /me command * Fix escaping * New strophe.js version --- js/main.js | 19 +++++++++++++------ js/strophejs | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) 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 -- 2.39.5