Software / code / prosody
Comparison
plugins/mod_register.lua @ 85:a115b99419ad
Added: mod_register now replies with an error stanza when file write fails
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 09 Oct 2008 02:08:33 +0500 |
| parent | 63:4c27740fdeff |
| child | 311:513bd52e8e19 |
comparison
equal
deleted
inserted
replaced
| 84:d0a0bac6815e | 85:a115b99419ad |
|---|---|
| 27 password = table.concat(password); | 27 password = table.concat(password); |
| 28 if username == session.username then | 28 if username == session.username then |
| 29 if usermanager_create_user(username, password, session.host) then -- password change -- TODO is this the right way? | 29 if usermanager_create_user(username, password, session.host) then -- password change -- TODO is this the right way? |
| 30 send(session, st.reply(stanza)); | 30 send(session, st.reply(stanza)); |
| 31 else | 31 else |
| 32 -- TODO internal error, unable to write file, file may be locked, etc | 32 -- TODO unable to write file, file may be locked, etc, what's the correct error? |
| 33 send(session, st.error_reply(stanza, "wait", "internal-server-error")); | |
| 33 end | 34 end |
| 34 else | 35 else |
| 35 send(session, st.error_reply(stanza, "modify", "bad-request")); | 36 send(session, st.error_reply(stanza, "modify", "bad-request")); |
| 36 end | 37 end |
| 37 else | 38 else |
| 68 send(session, st.error_reply(stanza, "cancel", "conflict")); | 69 send(session, st.error_reply(stanza, "cancel", "conflict")); |
| 69 else | 70 else |
| 70 if usermanager_create_user(username, password, session.host) then | 71 if usermanager_create_user(username, password, session.host) then |
| 71 send(session, st.reply(stanza)); -- user created! | 72 send(session, st.reply(stanza)); -- user created! |
| 72 else | 73 else |
| 73 -- TODO internal error, unable to write file, file may be locked, etc | 74 -- TODO unable to write file, file may be locked, etc, what's the correct error? |
| 75 send(session, st.error_reply(stanza, "wait", "internal-server-error")); | |
| 74 end | 76 end |
| 75 end | 77 end |
| 76 else | 78 else |
| 77 send(session, st.error_reply(stanza, "modify", "not-acceptable")); | 79 send(session, st.error_reply(stanza, "modify", "not-acceptable")); |
| 78 end | 80 end |