[Sugar-devel] [PATCH sugar] Limit the nick name to be only 8 characters maximum #10737

Simon Schampijer simon at schampijer.de
Wed Mar 23 10:26:39 EDT 2011


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 at laptop.org>
---
 src/jarabe/model/neighborhood.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index ca4c5bf..f0b3923 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -695,6 +695,15 @@ class Neighborhood(gobject.GObject):
         if account == self._server_account:
             self._link_local_account.enable()
 
+    def _limit_published_name(self, nick):
+        """ Limit the nick 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.
+
+        """
+        return nick[:8]
+
     def _ensure_link_local_account(self, account_paths):
         for account_path in account_paths:
             if 'salut' in account_path:
@@ -713,7 +722,7 @@ class Neighborhood(gobject.GObject):
                 'first-name': '',
                 'last-name': '',
                 'jid': self._get_jabber_account_id(),
-                'published-name': nick,
+                'published-name': self._limit_published_name(nick),
                 }
 
         properties = {
-- 
1.7.4



More information about the Sugar-devel mailing list