From da76c935fb3b0c2fef97a78c1cce8df02a25bf76 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Fri, 14 Feb 2014 14:44:59 +0100 Subject: [PATCH] --- mod_post_msg.lua.diff | 24 ++++++++++++++++++++++++ phork1.txt | 27 --------------------------- 2 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 mod_post_msg.lua.diff delete mode 100644 phork1.txt diff --git a/mod_post_msg.lua.diff b/mod_post_msg.lua.diff new file mode 100644 index 0000000..513248a --- /dev/null +++ b/mod_post_msg.lua.diff @@ -0,0 +1,24 @@ +diff -r 9700c89f7bf6 mod_post_msg/mod_post_msg.lua +--- a/mod_post_msg/mod_post_msg.lua Thu Jan 23 20:27:14 2014 +0000 ++++ b/mod_post_msg/mod_post_msg.lua Fri Feb 14 14:43:54 2014 +0100 +@@ -6,6 +6,7 @@ + local test_password = require "core.usermanager".test_password; + local b64_decode = require "util.encodings".base64.decode; + local formdecode = require "net.http".formdecode; ++local xml = require"util.xml" + + local function require_valid_user(f) + return function(event, path) +@@ -46,8 +48,11 @@ + end + elseif body_type == "application/x-www-form-urlencoded" then + local post_body = formdecode(request.body); +- message = msg({ to = post_body.to or to, from = authed_user, ++ message = msg({ to = post_body.to or to, from = authed_user, + type = post_body.type or "chat"}, post_body.body); ++ if post_body.html then ++ message:tag("html", {xmlns="http://jabber.org/protocol/xhtml-im"}):add_child(xml.parse(post_body.html)):up(); ++ end + else + return 415; + end diff --git a/phork1.txt b/phork1.txt deleted file mode 100644 index a9634b1..0000000 --- a/phork1.txt +++ /dev/null @@ -1,27 +0,0 @@ -lua code: -message:tag("html", "http://jabber.org/protocol/xhtml-im"):add_child(xml.parse(post_body.html)):up(); - -error log: -Feb 14 14:29:54 http.server error Traceback[httpserver]: /usr/lib/prosody/util/stanza.lua:214: bad argument #1 to 'pairs' (table expected, got string) -stack traceback: - [C]: in function 'pairs' - /usr/lib/prosody/util/stanza.lua:214: in function 'self' - /usr/lib/prosody/util/stanza.lua:231: in function '_dostring' - /usr/lib/prosody/util/stanza.lua:241: in function - [C]: in function 'tostring' - /usr/lib/prosody/modules/mod_post_msg.lua:62: in function - (tail call): ? - (tail call): ? - /usr/lib/prosody/util/events.lua:67: in function 'fire_event' - /usr/lib/prosody/net/http/server.lua:217: in function - ... - /usr/lib/prosody/net/http/server.lua:108: in function 'process_next' - /usr/lib/prosody/net/http/server.lua:124: in function 'success_cb' - /usr/lib/prosody/net/http/parser.lua:150: in function 'feed' - /usr/lib/prosody/net/http/server.lua:146: in function - (tail call): ? - /usr/lib/prosody/net/server_select.lua:847: in function - [C]: in function 'xpcall' - /usr/bin/prosody:372: in function 'loop' - /usr/bin/prosody:402: in main chunk - [C]: ? -- 2.30.2