Diff

mod_measure_message_e2ee/mod_measure_message_e2ee.lua @ 3370:c414a7e884b3

mod_measure_message_e2ee: Count OTR messages too.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 06 Nov 2018 20:05:09 +0100
parent 3137:178ebea5097c
child 3782:70e5bab388d8
line wrap: on
line diff
--- a/mod_measure_message_e2ee/mod_measure_message_e2ee.lua	Tue Nov 06 14:44:11 2018 +0100
+++ b/mod_measure_message_e2ee/mod_measure_message_e2ee.lua	Tue Nov 06 20:05:09 2018 +0100
@@ -34,10 +34,9 @@
 		return;
 	end
 
-	local body = stanza:get_child("body");
-	if body ~= nil then
-		local otr_index = body:find("?OTR", 1, true);
-		if otr_index == 1 then
+	local body = stanza:get_child_text("body");
+	if body then
+		if body:sub(1,4) == "?OTR" then
 			count_otr();
 			return;
 		end