Mercurial > prosody-hg
diff util/datamanager.lua @ 84:d0a0bac6815e
Added: Datastore support for hosts and global data in addition to users
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 09 Oct 2008 01:20:43 +0500 |
| parents | 3e3171b59028 |
| children | 059ef1c30844 |
line wrap: on
line diff
--- a/util/datamanager.lua Thu Oct 09 01:18:48 2008 +0500 +++ b/util/datamanager.lua Thu Oct 09 01:20:43 2008 +0500 @@ -56,7 +56,13 @@ ------- API ------------- function getpath(username, host, datastore) - return format("data/%s/%s/%s.dat", encode(host), datastore, encode(username)); + if username then + return format("data/%s/%s/%s.dat", encode(host), datastore, encode(username)); + elseif host then + return format("data/%s/%s.dat", encode(host), datastore); + else + return format("data/%s.dat", datastore); + end end function load(username, host, datastore)
