Comparison

plugins/mod_saslauth.lua @ 3524:d206b4e0a9f3

mod_saslauth: Improved logging a bit.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 16 Oct 2010 05:16:45 +0500
parent 3523:32a0c3816d73
child 3535:b953b0c0f203
comparison
equal deleted inserted replaced
3523:32a0c3816d73 3524:d206b4e0a9f3
140 features:tag("session", xmpp_session_attr):tag("optional"):up():up(); 140 features:tag("session", xmpp_session_attr):tag("optional"):up():up();
141 end 141 end
142 end); 142 end);
143 143
144 module:hook("iq/self/urn:ietf:params:xml:ns:xmpp-bind:bind", function(event) 144 module:hook("iq/self/urn:ietf:params:xml:ns:xmpp-bind:bind", function(event)
145 log("debug", "Client requesting a resource bind");
146 local origin, stanza = event.origin, event.stanza; 145 local origin, stanza = event.origin, event.stanza;
147 local resource; 146 local resource;
148 if stanza.attr.type == "set" then 147 if stanza.attr.type == "set" then
149 local bind = stanza.tags[1]; 148 local bind = stanza.tags[1];
150 resource = bind:child_with_name("resource"); 149 resource = bind:child_with_name("resource");
153 local success, err_type, err, err_msg = sm_bind_resource(origin, resource); 152 local success, err_type, err, err_msg = sm_bind_resource(origin, resource);
154 if success then 153 if success then
155 origin.send(st.reply(stanza) 154 origin.send(st.reply(stanza)
156 :tag("bind", { xmlns = xmlns_bind }) 155 :tag("bind", { xmlns = xmlns_bind })
157 :tag("jid"):text(origin.full_jid)); 156 :tag("jid"):text(origin.full_jid));
157 origin.log("debug", "Resource bound: %s", origin.full_jid);
158 else 158 else
159 origin.send(st.error_reply(stanza, err_type, err, err_msg)); 159 origin.send(st.error_reply(stanza, err_type, err, err_msg));
160 origin.log("debug", "Resource bind failed: %s", err_msg or err);
160 end 161 end
161 return true; 162 return true;
162 end); 163 end);
163 164
164 module:hook("iq/self/urn:ietf:params:xml:ns:xmpp-session:session", function(event) 165 module:hook("iq/self/urn:ietf:params:xml:ns:xmpp-session:session", function(event)
165 log("debug", "Client requesting a session");
166 event.origin.send(st.reply(event.stanza)); 166 event.origin.send(st.reply(event.stanza));
167 return true; 167 return true;
168 end); 168 end);