Diff

plugins/mod_legacyauth.lua @ 1689:5eb806590525

mod_legacyauth: Refactored a bit
author Waqas Hussain <waqas20@gmail.com>
date Thu, 13 Aug 2009 16:51:35 +0500
parent 1688:a39a253b5b89
child 1690:b675ae5b4c91
line wrap: on
line diff
--- a/plugins/mod_legacyauth.lua	Thu Aug 13 16:46:08 2009 +0500
+++ b/plugins/mod_legacyauth.lua	Thu Aug 13 16:51:35 2009 +0500
@@ -42,7 +42,6 @@
 					:tag("username"):up()
 					:tag("password"):up()
 					:tag("resource"):up());
-				return true;			
 			else
 				username, password, resource = t_concat(username), t_concat(password), t_concat(resource);
 				local reply = st.reply(stanza);
@@ -58,15 +57,9 @@
 						end
 					end
 					session.send(st.reply(stanza));
-					return true;
 				else
-					local reply = st.reply(stanza);
-					reply.attr.type = "error";
-					reply:tag("error", { code = "401", type = "auth" })
-						:tag("not-authorized", { xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas" });
-					session.send(reply);
-					return true;
+					session.send(st.error_reply(stanza, "auth", "not-authorized"));
 				end
 			end
-			
+			return true;
 		end);