Changeset

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
parents 3369:fca95f1b8870
children 3371:68842409f4e7
files mod_measure_message_e2ee/mod_measure_message_e2ee.lua
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
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