changeset 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 7c90e8a67a4f
children df696c8d5282
files mod_invite/mod_invite.lua
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
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)