From 3175c9113a6fe7b23afe2ccf14e30d5d3e6b5355 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Mon, 21 Aug 2006 19:54:09 +0000
Subject: [PATCH] don't ask os info when we are invisible. For #1964

---
 src/common/connection.py | 4 ++++
 src/vcard.py             | 7 ++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/common/connection.py b/src/common/connection.py
index e512ba612e..968244981d 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -880,6 +880,10 @@ class Connection(ConnectionHandlers):
 	def request_os_info(self, jid, resource):
 		if not self.connection:
 			return
+		# If we are invisible, do not request
+		if self.connected == gajim.SHOW_LIST.index('invisible'):
+			self.dispatch('OS_INFO', (jid, resource, _('Not fetched because of invisible status'), _('Not fetched because of invisible status')))
+			return
 		to_whom_jid = jid
 		if resource:
 			to_whom_jid += '/' + resource
diff --git a/src/vcard.py b/src/vcard.py
index f9decf5e67..2708ac7e25 100644
--- a/src/vcard.py
+++ b/src/vcard.py
@@ -372,8 +372,8 @@ class VcardWindow:
 
 		# Request os info in contact is connected
 		if self.contact.show not in ('offline', 'error'):
-			gajim.connections[self.account].request_os_info(self.contact.jid,
-				self.contact.resource)
+			gobject.idle_add(gajim.connections[self.account].request_os_info,
+				self.contact.jid, self.contact.resource)
 		self.os_info = {0: {'resource': self.contact.resource, 'client': '',
 			'os': ''}}
 		i = 1
@@ -386,7 +386,8 @@ class VcardWindow:
 					uf_resources += '\n' + c.resource + \
 						_(' resource with priority ') + unicode(c.priority)
 					if c.show not in ('offline', 'error'):
-						gajim.connections[self.account].request_os_info(c.jid,
+						gobject.idle_add(
+							gajim.connections[self.account].request_os_info, c.jid,
 							c.resource)
 					gajim.connections[self.account].request_last_status_time(c.jid,
 						c.resource)
-- 
GitLab