aboutsummaryrefslogtreecommitdiffstats
path: root/server/plugin.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2011-04-12 02:13:09 +0200
committerThibaut Horel <thibaut.horel@gmail.com>2011-04-12 02:13:09 +0200
commitf17ec19437c91bdb5e98bdf05723ee8a5f7d698c (patch)
treedb17f0c5a5aa9be98b285bae5d07fa7956492d29 /server/plugin.py
parent15987fa032a86571a0502b91d2b3a00ac4084b53 (diff)
parent544d90e6b6c83b4dbf8d8d8d3e00a21ab1bf0599 (diff)
downloadalias-f17ec19437c91bdb5e98bdf05723ee8a5f7d698c.tar.gz
Merge branch 'master' of alias.fr.nf:alias
Diffstat (limited to 'server/plugin.py')
-rw-r--r--server/plugin.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/server/plugin.py b/server/plugin.py
index 892977e..393e675 100644
--- a/server/plugin.py
+++ b/server/plugin.py
@@ -17,7 +17,7 @@ class AliasQuery(ElementBase):
name = 'query'
plugin_attrib = 'alias'
interfaces = set(('node', 'type', 'content', 'permission', 'key'))
- sub_interfaces = set(('content', 'permission', 'key'))
+ sub_interfaces = set(('content', 'permission', 'key', 'salt'))
def addItem(self, node, key, permission = None):
item = AliasItem(None, self)
@@ -55,11 +55,21 @@ class AliasPlugin(base.base_plugin):
iq.send()
def handle_alias_query(self, iq):
+ caller = iq['from'].bare
+
+ if iq['alias']['type'] == 'keys':
+ key, salt = Object(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)
except TypeError:
logging.error("callee field not base64 encoded")
- caller = iq['from'].bare
+
node = iq['alias']['node']
if not node:
node = hashlib.sha1(callee).hexdigest()