changeset 211:b25d03403898

plugin file sharing: fixed name for service devices
author Goffi <goffi@goffi.org>
date Fri, 25 May 2018 14:17:17 +0200
parents f1ee7a8cf77c
children 38b43ed18bb5
files cagou/plugins/plugin_wid_file_sharing.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_file_sharing.py	Fri May 25 13:29:28 2018 +0200
+++ b/cagou/plugins/plugin_wid_file_sharing.py	Fri May 25 14:17:17 2018 +0200
@@ -212,8 +212,17 @@
     def __init__(self, sharing_wid, entity_jid, identities):
         self.entity_jid = entity_jid
         self.identities = identities
-        self.own_device = entity_jid.bare == next(G.host.profiles.itervalues()).whoami
-        name = self.identities.name if self.own_device else self.entity_jid.node
+        own_jid = next(G.host.profiles.itervalues()).whoami
+        self.own_device = entity_jid.bare == own_jid
+        if self.own_device:
+            name = self.identities.name
+        elif self.entity_jid.node:
+            name = self.entity_jid.node
+        elif self.entity_jid.domain == own_jid.domain:
+            name = _(u"your server")
+        else:
+            name = _(u"sharing component")
+
         super(DeviceWidget, self).__init__(sharing_wid, name)
 
     def getSymbol(self):