Changeset

7890:9e4de27e8e08

mod_mam: Move stanza ID namespace to a common variable
author Kim Alvefur <zash@zash.se>
date Tue, 14 Feb 2017 18:51:20 +0100
parents 7889:b8d694646597
children 7891:01d2a2af3146
files plugins/mod_mam/mod_mam.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Sun Feb 12 16:42:29 2017 +0100
+++ b/plugins/mod_mam/mod_mam.lua	Tue Feb 14 18:51:20 2017 +0100
@@ -12,6 +12,7 @@
 local xmlns_mam     = "urn:xmpp:mam:1";
 local xmlns_delay   = "urn:xmpp:delay";
 local xmlns_forward = "urn:xmpp:forward:0";
+local xmlns_st_id   = "urn:xmpp:sid:0";
 
 local um = require "core.usermanager";
 local st = require "util.stanza";
@@ -248,7 +249,7 @@
 
 	-- Filter out <stanza-id> that claim to be from us
 	stanza:maptags(function (tag)
-		if tag.name == "stanza-id" and tag.attr.xmlns == "urn:xmpp:sid:0" then
+		if tag.name == "stanza-id" and tag.attr.xmlns == xmlns_st_id then
 			local by_user, by_host, res = jid_prepped_split(tag.attr.by);
 			if not res and by_host == module.host and by_user == store_user then
 				return nil;
@@ -293,7 +294,7 @@
 		-- And stash it
 		local ok, id = archive:append(store_user, nil, stanza, time_now(), with);
 		if ok then
-			stanza:tag("stanza-id", { xmlns = "urn:xmpp:sid:0", by = store_user.."@"..host, id = id }):up();
+			stanza:tag("stanza-id", { xmlns = xmlns_st_id, by = store_user.."@"..host, id = id }):up();
 			if cleanup then cleanup[store_user] = true; end
 			module:fire_event("archive-message-added", { origin = origin, stanza = stanza, for_user = store_user, id = id });
 		end