Diff

plugins/mod_saslauth.lua @ 7896:1a2674123c1c

mod_saslauth: Cache logger in local for less typing
author Kim Alvefur <zash@zash.se>
date Wed, 15 Feb 2017 22:59:19 +0100
parent 7784:9f70d35a1602
child 7897:08bde6a6fd56
line wrap: on
line diff
--- a/plugins/mod_saslauth.lua	Wed Feb 15 15:30:34 2017 +0100
+++ b/plugins/mod_saslauth.lua	Wed Feb 15 22:59:19 2017 +0100
@@ -223,6 +223,7 @@
 local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' };
 module:hook("stream-features", function(event)
 	local origin, features = event.origin, event.features;
+	local log = origin.log or log;
 	if not origin.username then
 		if secure_auth_only and not origin.secure then
 			return;
@@ -251,7 +252,7 @@
 		if mechanisms[1] then
 			features:add_child(mechanisms);
 		else
-			(origin.log or log)("warn", "No SASL mechanisms to offer");
+			log("warn", "No SASL mechanisms to offer");
 		end
 	else
 		features:tag("bind", bind_attr):tag("required"):up():up();