diff mod_invite/mod_invite.lua @ 2238:dc4e77824318

mod_invite: Use XML/HTML entity escaping from util.stanza
author Kim Alvefur <zash@zash.se>
date Fri, 08 Jul 2016 23:56:42 +0200
parents 4b3037c7af62
children df696c8d5282
line wrap: on
line diff
--- a/mod_invite/mod_invite.lua	Fri Jul 08 23:42:30 2016 +0200
+++ b/mod_invite/mod_invite.lua	Fri Jul 08 23:56:42 2016 +0200
@@ -6,6 +6,7 @@
 local http_urlencode = require "net.http".urlencode;
 local usermanager = require "core.usermanager";
 local rostermanager = require "core.rostermanager";
+local tohtml = require "util.stanza".xml_escape
 local nodeprep = require "util.encodings".stringprep.nodeprep;
 local tostring = tostring;
 
@@ -16,15 +17,6 @@
 
 module:depends"http";
 
-local entities = {
-	["<"] = "&lt;", [">"] = "&gt;", ["&"] = "&amp;",
-	["'"] = "&apos;", ["\""] = "&quot;", ["\n"] = "<br/>",
-};
-
-local function tohtml(plain)
-	return (plain:gsub("[<>&'\"\n]", entities));
-end
-
 local function apply_template(template, args)
 	return
 		template:gsub("{{([^}]*)}}", function (k)