diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2011-06-01 01:22:16 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2011-06-01 01:22:16 -0400 |
| commit | d4ecf728109619d34c1781a069793a37c8d9b8e7 (patch) | |
| tree | 8abd81609001b3305d20d4be2c6b27cf2742394b /server/alias_plugin.py | |
| parent | cdc4ec8d31b826222d970fb37e3e101cd4f86a77 (diff) | |
| download | alias-d4ecf728109619d34c1781a069793a37c8d9b8e7.tar.gz | |
Fixes to handle alias queries on the server side
should work with code fixed by zaran,
just need to build an user directory with
the right objects.
Diffstat (limited to 'server/alias_plugin.py')
| -rw-r--r-- | server/alias_plugin.py | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/server/alias_plugin.py b/server/alias_plugin.py index 2001b1b..0b56438 100644 --- a/server/alias_plugin.py +++ b/server/alias_plugin.py @@ -14,11 +14,11 @@ from object import ObjectReader, ObjectError from permission import PermissionError class AliasQuery(ElementBase): - namespace = 'alias:query' + namespace = 'alias:iq:object' name = 'query' plugin_attrib = 'alias' interfaces = set(('node', 'type', 'content', 'permission', 'key')) - sub_interfaces = set(('content', 'permission', 'key', 'salt')) + sub_interfaces = set(('content', 'permission', 'key')) def addItem(self, node, key, permission = None): item = AliasItem(None, self) @@ -57,14 +57,6 @@ class AliasPlugin(base.base_plugin): def handle_alias_query(self, iq): caller = iq['from'].bare - - if iq['alias']['type'] == 'keys': - key, salt = ObjectReader(caller).get_private_key(); - iq.reply() - iq['alias']['type'] = 'keys' - iq['alias']['key'] = key - iq['alias']['salt'] = salt - iq.send() try: callee = base64.b64decode(iq['to'].user) @@ -72,24 +64,23 @@ class AliasPlugin(base.base_plugin): logger.error("callee field not base64 encoded") node = iq['alias']['node'] - node = ObjectReader(callee, node) - - if iq['alias']['type'] == 'items': + node = ObjectReader(node, callee) + if iq['alias']['type'] == 'get': try: - childs = node.get_child_list(caller) + content, key = node.get_content(caller) except PermissionError: self.send_permission_error(iq, 'Permission') else: iq.reply() - iq['alias']['type'] = 'items' + iq['alias']['type'] = 'get' iq['alias']['node'] = node.hash - for name, perm, key in childs: - iq['alias'].addItem(name, key, perm) + iq['alias']['content'] = content + iq['alias']['key'] = key iq.send() - if iq['alias']['type'] == 'content': + if iq['alias']['type'] == 'list': try: - content, key = node.get_content(caller) + list = node.get_children_list(caller) except PermissionError: self.send_permission_error(iq, 'Permission') else: |
