diff mod_mam_muc/mod_mam_muc.lua @ 1616:28411e97db94

mod_mam_muc: support to disable presence logging via muc_log_presences
author Stuart Carnie <stuart.carnie@gmail.com>
date Mon, 23 Feb 2015 16:43:21 -0700
parents eed7db9f3157
children 458c80904525
line wrap: on
line diff
--- 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);