From 4c990ccb1ee2922578dd0fe0d8856b3659aea2eb Mon Sep 17 00:00:00 2001
From: Alex Mauer <hawke@hawkesnest.net>
Date: Tue, 13 Sep 2005 18:46:21 +0000
Subject: [PATCH] Tooltip for account line in roster

---
 src/common/connection.py |  3 +++
 src/gajim.py             |  5 ++++-
 src/roster_window.py     | 12 ++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/common/connection.py b/src/common/connection.py
index 8293531f88..f773096876 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -1566,6 +1566,9 @@ class Connection:
 			if self.connection:
 				self.connection.send(p)
 			self.dispatch('STATUS', show)
+	
+	def get_status(self):
+		return STATUS_LIST[self.connected]
 
 	def send_motd(self, jid, subject = '', msg = ''):
 		if not self.connection:
diff --git a/src/gajim.py b/src/gajim.py
index 9398adc10c..5072cf1120 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -294,6 +294,9 @@ class Interface:
 			if gajim.contacts[account].has_key(ji):
 				#Update existing iter
 				self.roster.draw_contact(ji, account)
+		elif jid == gajim.get_jid_from_account(account):
+			#It's another of our resources.  We don't need to see that!
+			return
 		elif gajim.contacts[account].has_key(ji):
 			#It isn't an agent
 			self.roster.chg_contact_status(user1, array[1], array[2], account)
@@ -344,7 +347,7 @@ class Interface:
 				if self.remote and self.remote.is_enabled():
 					self.remote.raise_signal('ContactAbsence', (account, array))
 				# stop non active file transfers
-				
+		
 		elif self.windows[account]['gc'].has_key(ji): # ji is then room_jid
 			#it is a groupchat presence
 			#FIXME: upgrade the chat instances (for pm)
diff --git a/src/roster_window.py b/src/roster_window.py
index 4765806a1d..fbfd3d2505 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -670,6 +670,18 @@ class RosterWindow:
 					self.tooltip.id = row
 					self.tooltip.timeout = gobject.timeout_add(500,
 						self.show_tooltip, gajim.contacts[account][jid])
+			if model[iter][C_TYPE] == 'account':
+				account = model[iter][C_NAME].decode('utf-8')
+				jid = gajim.get_jid_from_account(account)
+				self_contact = Contact(jid=jid, name=account, show = gajim.connections[account].get_status(), status=gajim.connections[account].status, resource=gajim.config.get_per('accounts', gajim.connections[account].name, 'resource'), keyID = gajim.config.get_per('accounts', gajim.connections[account].name, 'keyid'))
+				contacts = [self_contact]
+				if gajim.contacts[account].has_key(jid):
+					for contact in gajim.contacts[account][jid]:
+						contacts = [contact]
+				if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
+					self.tooltip.id = row
+					self.tooltip.timeout = gobject.timeout_add(500,
+						self.show_tooltip, contacts)
 
 	def on_agent_logging(self, widget, jid, state, account):
 		'''When an agent is requested to log in or off'''
-- 
GitLab