comparison mod_post_msg/mod_post_msg.lua @ 1418:a0375f84d65a

mod_post_msg: Add <body> wrapper tag with namespace in module so the client doesn't have to
author Kim Alvefur <zash@zash.se>
date Wed, 28 May 2014 21:20:51 +0200
parents 9b6fbababb8c
children 926aaaeb0d21
comparison
equal deleted inserted replaced
1417:9b6fbababb8c 1418:a0375f84d65a
48 elseif body_type == "application/x-www-form-urlencoded" then 48 elseif body_type == "application/x-www-form-urlencoded" then
49 local post_body = formdecode(request.body); 49 local post_body = formdecode(request.body);
50 message = msg({ to = post_body.to or to, from = authed_user, 50 message = msg({ to = post_body.to or to, from = authed_user,
51 type = post_body.type or "chat"}, post_body.body); 51 type = post_body.type or "chat"}, post_body.body);
52 if post_body.html then 52 if post_body.html then
53 local html, err = xml.parse(post_body.html); 53 local html, err = xml.parse([[<body xmlns="http://www.w3.org/1999/xhtml">]]..post_body.html..[[</body>]]);
54 if not html then 54 if not html then
55 module:log("warn", "mod_post_msg: invalid XML: %s", err); 55 module:log("warn", "mod_post_msg: invalid XML: %s", err);
56 return 400; 56 return 400;
57 end 57 end
58 message:tag("html", {xmlns="http://jabber.org/protocol/xhtml-im"}):add_child(html):up(); 58 message:tag("html", {xmlns="http://jabber.org/protocol/xhtml-im"}):add_child(html):up();