Changeset

11795:41af102c7190

mod_mam: Reduce line count using new util.stanza attr method Since this stanza-id was generated elsewhere in mod_mam, there should be no need for normalization.
author Kim Alvefur <zash@zash.se>
date Sun, 12 Sep 2021 20:17:26 +0200
parents 11794:5d925f340ae6
children 11796:71c20650a0b4
files plugins/mod_mam/mod_mam.lua
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Sun Sep 12 17:03:02 2021 +0200
+++ b/plugins/mod_mam/mod_mam.lua	Sun Sep 12 20:17:26 2021 +0200
@@ -481,10 +481,8 @@
 module:hook("message/offline/handle", function(event)
 	local stanza = event.stanza;
 	local user = event.username .. "@" .. host;
-	for st_id in stanza:childtags("stanza-id", xmlns_st_id) do
-		if st_id.attr.by == user then
-			return true;
-		end
+	if stanza:get_child_with_attr("stanza-id", xmlns_st_id, "by", user) then
+		return true;
 	end
 end, -2);