Mercurial > prosody-hg
comparison util/prosodyctl.lua @ 3833:f1833a3e0b4e
util.prosodyctl: Prep JIDs before checking whether they exist (thanks tja)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 07 Dec 2010 19:26:38 +0000 |
| parents | 9e62937c9757 |
| children | 428882c438bf |
comparison
equal
deleted
inserted
replaced
| 3832:8eff6e82570d | 3833:f1833a3e0b4e |
|---|---|
| 45 end | 45 end |
| 46 return true; | 46 return true; |
| 47 end | 47 end |
| 48 | 48 |
| 49 function user_exists(params) | 49 function user_exists(params) |
| 50 local provider = prosody.hosts[params.host].users; | 50 local user, host, password = nodeprep(params.user), nameprep(params.host), params.password; |
| 51 local provider = prosody.hosts[host].users; | |
| 51 if not(provider) or provider.name == "null" then | 52 if not(provider) or provider.name == "null" then |
| 52 usermanager.initialize_host(params.host); | 53 usermanager.initialize_host(host); |
| 53 end | 54 end |
| 54 | 55 |
| 55 return usermanager.user_exists(params.user, params.host); | 56 return usermanager.user_exists(user, host); |
| 56 end | 57 end |
| 57 | 58 |
| 58 function passwd(params) | 59 function passwd(params) |
| 59 if not _M.user_exists(params) then | 60 if not _M.user_exists(params) then |
| 60 return false, "no-such-user"; | 61 return false, "no-such-user"; |
