aboutsummaryrefslogtreecommitdiffstats
path: root/server/alias_plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'server/alias_plugin.py')
-rw-r--r--server/alias_plugin.py29
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: