diff options
Diffstat (limited to 'server/plugin.py')
| -rw-r--r-- | server/plugin.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/plugin.py b/server/plugin.py index 80e9863..892977e 100644 --- a/server/plugin.py +++ b/server/plugin.py @@ -9,7 +9,7 @@ from sleekxmpp.xmlstream.handler.callback import Callback from sleekxmpp.xmlstream.matcher.xpath import MatchXPath from sleekxmpp.stanza.iq import Iq -from object import Object +from object import Object, ObjectError from permission import PermissionError class AliasQuery(ElementBase): @@ -17,12 +17,12 @@ class AliasQuery(ElementBase): name = 'query' plugin_attrib = 'alias' interfaces = set(('node', 'type', 'content', 'permission', 'key')) - sub_interfaces = set(('content', 'permission')) + sub_interfaces = set(('content', 'permission', 'key')) def addItem(self, node, key, permission = None): item = AliasItem(None, self) item['node'] = node - item['key']= key + item['key'] = key if permission is not None: item['permission'] = str(permission) @@ -30,7 +30,7 @@ class AliasItem(ElementBase): namespace = 'alias:query' name = 'item' plugin_attrib = 'item' - interfaces = set(('node', 'permission', 'key' )) + interfaces = set(('node', 'permission', 'key')) class AliasPlugin(base.base_plugin): @@ -63,8 +63,9 @@ class AliasPlugin(base.base_plugin): node = iq['alias']['node'] if not node: node = hashlib.sha1(callee).hexdigest() + node = Object(callee, node) - + if iq['alias']['type'] == 'items': try: childs = node.get_child_list(caller) @@ -80,8 +81,7 @@ class AliasPlugin(base.base_plugin): if iq['alias']['type'] == 'content': try: - content = node.get_content(caller) - key = node.get_key(caller) + content, key = node.get_content(caller) except PermissionError: self.send_permission_error(iq, 'Permission') else: |
