diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2011-05-04 21:27:50 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2011-05-04 21:27:50 -0400 |
| commit | 9901679f2bc1e6972b6ec5d354a54814fba097eb (patch) | |
| tree | 4e6e125d16512b835c5edcebbd2ddbe41df89863 /server/user.py | |
| parent | e85fffabbb61ca964f35561e00c382a180166f64 (diff) | |
| download | alias-9901679f2bc1e6972b6ec5d354a54814fba097eb.tar.gz | |
Various fixes.
- store the registration object using base64 encoding of the
jid instead of hash, so that it's reversible
- fix the namespace of the registration form
Diffstat (limited to 'server/user.py')
| -rw-r--r-- | server/user.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/server/user.py b/server/user.py index a818005..d63e659 100644 --- a/server/user.py +++ b/server/user.py @@ -5,13 +5,14 @@ import hashlib import logging logger = logging.getLogger(__name__) from object import * - +import base64 class User: def __init__(self, jid): self.jid = jid - self.hash = hashlib.sha1(jid).hexdigest() + #self.hash = hashlib.sha1(jid).hexdigest() + self.hash = base64.encodestring(jid) def register(self, registration): ObjectWriter(self.hash).create_root_object(self.jid, registration) @@ -33,4 +34,11 @@ class UserHandler: self.root = root def get_user_list(self): - return os.listdir(self.root) + result = [] + for stem in os.listdir(self.root): + for leaf in os.listdir(os.path.join(self.root, stem)): + result.append(base64.decodestring(stem + leaf)) + return result + +if __name__ == '__main__': + print UserHandler('/var/lib/alias').get_user_list()
\ No newline at end of file |
