From a8c0bbe7c1cc1516bfef617723d70a1e838f9a30 Mon Sep 17 00:00:00 2001
From: Stefan Bethge <stefan@lanpartei.de>
Date: Thu, 12 Oct 2006 03:22:57 +0000
Subject: [PATCH] fix #2555

---
 src/common/zeroconf/zeroconf.py | 2 +-
 src/config.py                   | 2 ++
 src/roster_window.py            | 7 +++++--
 src/systray.py                  | 5 ++++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/common/zeroconf/zeroconf.py b/src/common/zeroconf/zeroconf.py
index f8c4da099f..a487f66c4a 100755
--- a/src/common/zeroconf/zeroconf.py
+++ b/src/common/zeroconf/zeroconf.py
@@ -186,7 +186,7 @@ class Zeroconf:
 	def entrygroup_state_changed_callback(self, state, error):
 		# the name is already present, so recreate
 		if state == avahi.ENTRY_GROUP_COLLISION:
-			self.service_add_fail_callback('Local name collision, recreating.')
+			self.service_add_fail_callback('Local name collision')
 		elif state == avahi.ENTRY_GROUP_FAILURE:
 			print 'zeroconf.py: ENTRY_GROUP_FAILURE reached(that should not happen)'
 
diff --git a/src/config.py b/src/config.py
index b0bf356748..10268a63b3 100644
--- a/src/config.py
+++ b/src/config.py
@@ -2532,6 +2532,8 @@ class ManageBookmarksWindow:
 		for account in gajim.connections:
 			if gajim.connections[account].connected <= 1:
 				continue
+			if gajim.connections[account].is_zeroconf:
+				continue
 			iter = self.treestore.append(None, [None, account,None,
 				None, None, None, None])
 
diff --git a/src/roster_window.py b/src/roster_window.py
index fbe5f790c0..d2e2fa0aaa 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -784,7 +784,9 @@ class RosterWindow:
 				if gajim.connections[account].connected <= 1:
 					# if offline or connecting
 					continue
-				
+				if gajim.config.get_per('accounts', account, 'is_zeroconf'): 
+					continue 	
+
 				# join gc
 				label = gtk.Label()
 				label.set_markup('<u>' + account.upper() +'</u>')
@@ -853,7 +855,8 @@ class RosterWindow:
 					
 					break # No other account connected
 		
-		if connected_accounts == 0:
+		if connected_accounts == 0 or (connected_accounts == 1 and
+				gajim.connections[gajim.connections.keys()[0]].is_zeroconf):
 			# no connected accounts, make the menuitems insensitive
 			new_chat_menuitem.set_sensitive(False)
 			join_gc_menuitem.set_sensitive(False)
diff --git a/src/systray.py b/src/systray.py
index 607739756d..5134d5053b 100644
--- a/src/systray.py
+++ b/src/systray.py
@@ -158,7 +158,8 @@ class Systray:
 		sub_menu.append(item)
 		item.connect('activate', self.on_show_menuitem_activate, 'offline')
 
-		iskey = connected_accounts > 0
+		iskey = connected_accounts > 0 and not (connected_accounts == 1 and
+				gajim.connections[gajim.connections.keys()[0]].is_zeroconf)
 		chat_with_menuitem.set_sensitive(iskey)
 		single_message_menuitem.set_sensitive(iskey)
 		join_gc_menuitem.set_sensitive(iskey)
@@ -176,6 +177,8 @@ class Systray:
 			accounts_list = gajim.contacts.get_accounts()
 			accounts_list.sort()
 			for account in accounts_list:
+				if gajim.connections[account].is_zeroconf:
+					continue
 				if gajim.connections[account].connected > 1:
 					#for chat_with
 					item = gtk.MenuItem(_('using account %s') % account)
-- 
GitLab