mod_mam_muc: support to disable presence logging via muc_log_presences
authorStuart Carnie <stuart.carnie@gmail.com>
Mon, 23 Feb 2015 16:43:21 -0700
changeset 1620 28411e97db94
parent 1619 d0fd8a29b724
child 1621 e0d8caffa209
mod_mam_muc: support to disable presence logging via muc_log_presences
mod_mam_muc/mod_mam_muc.lua
--- a/mod_mam_muc/mod_mam_muc.lua	Mon Feb 23 15:45:11 2015 +0100
+++ b/mod_mam_muc/mod_mam_muc.lua	Mon Feb 23 16:43:21 2015 -0700
@@ -345,12 +345,14 @@
 	end
 end);
 
-module:hook("muc-occupant-joined", function (event)
-	save_to_history(event.room, st.stanza("presence", { from = event.nick }));
-end);
-module:hook("muc-occupant-left", function (event)
-	save_to_history(event.room, st.stanza("presence", { type = "unavailable", from = event.nick }));
-end);
+if module:get_option_boolean("muc_log_presences", true) then
+	module:hook("muc-occupant-joined", function (event)
+		save_to_history(event.room, st.stanza("presence", { from = event.nick }));
+	end);
+	module:hook("muc-occupant-left", function (event)
+		save_to_history(event.room, st.stanza("presence", { type = "unavailable", from = event.nick }));
+	end);
+end
 
 module:hook("muc-room-destroyed", function(event)
 	local username = jid_split(event.room.jid);