diff options
author | Simon Schampijer <simon@schampijer.de> | 2011-03-29 19:42:00 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2011-03-31 14:34:12 (GMT) |
commit | 7e87273279df4498a4b994f63eeed210f29d0578 (patch) | |
tree | 81e6d17e048be64f7e71d57d133ba5851403d680 | |
parent | a887db4d517f833e1cf3db56e7844dbc96e88ec8 (diff) |
Construct the published name based on the public key OLPC #10737
Limit the name to be only 8 characters maximum. The avahi
service name has a 64 character limit. It consists of
the room name, the published name and the host name.
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r-- | src/jarabe/model/neighborhood.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py index ca4c5bf..aea3aa3 100644 --- a/src/jarabe/model/neighborhood.py +++ b/src/jarabe/model/neighborhood.py @@ -695,6 +695,17 @@ class Neighborhood(gobject.GObject): if account == self._server_account: self._link_local_account.enable() + def _get_published_name(self): + """Construct the published name based on the public key + + Limit the name to be only 8 characters maximum. The avahi + service name has a 64 character limit. It consists of + the room name, the published name and the host name. + + """ + public_key_hash = sha1(get_profile().pubkey).hexdigest() + return public_key_hash[:8] + def _ensure_link_local_account(self, account_paths): for account_path in account_paths: if 'salut' in account_path: @@ -713,7 +724,7 @@ class Neighborhood(gobject.GObject): 'first-name': '', 'last-name': '', 'jid': self._get_jabber_account_id(), - 'published-name': nick, + 'published-name': self._get_published_name(), } properties = { |