ask and show os info from each resource

This commit is contained in:
Yann Leboulanger 2005-04-24 22:58:41 +00:00
parent e2b6b84694
commit a2b6a44079
3 changed files with 30 additions and 7 deletions

View File

@ -400,7 +400,8 @@ class Connection:
if qp.getTag('os'):
os_info += qp.getTag('os').getData()
jid = iq_obj.getFrom().getStripped()
self.dispatch('OS_INFO', (jid, client_info, os_info))
resource = iq_obj.getFrom().getResource()
self.dispatch('OS_INFO', (jid, resource, client_info, os_info))
def _MucOwnerCB(self, con, iq_obj):
gajim.log.debug('MucOwnerCB')

View File

@ -407,7 +407,7 @@ class Interface:
def handle_event_os_info(self, account, array):
if self.windows[account]['infos'].has_key(array[0]):
self.windows[account]['infos'][array[0]].set_os_info(array[1], \
array[2])
array[2], array[3])
def handle_event_gc_msg(self, account, array):
#('GC_MSG', account, (jid, msg, time))

View File

@ -87,9 +87,23 @@ class Vcard_window:
else:
self.set_value(i + '_entry', vcard[i])
def set_os_info(self, client_info, os_info):
self.xml.get_widget('client_name_version_label').set_text(client_info)
self.xml.get_widget('platform_label').set_text(os_info)
def set_os_info(self, resource, client_info, os_info):
i = 0
client = ''
platform = ''
while self.os_info.has_key(i):
if self.os_info[i]['resource'] == resource:
self.os_info[i]['client'] = client_info
self.os_info[i]['platform'] = os_info
if i > 0:
client += '\n'
platform += '\n'
client += self.os_info[i]['client']
platform += self.os_info[i]['platform']
i += 1
self.xml.get_widget('client_name_version_label').set_text(client)
self.xml.get_widget('platform_label').set_text(platform)
def fill_jabber_page(self):
self.xml.get_widget('nickname_label').set_text(self.user.name)
@ -110,17 +124,25 @@ class Vcard_window:
if not self.user.status:
self.user.status = ''
stats = self.user.show + ': ' + self.user.status
gajim.connections[self.account].request_os_info(self.user.jid, \
self.user.resource)
self.os_info = {0: {'resource': self.user.resource, 'client': '',
'platform': ''}}
i = 1
for u in self.plugin.roster.contacts[self.account][self.user.jid]:
if u.resource != self.user.resource:
resources += '\n' + u.resource + ' (' + str(u.priority) + ')'
if not u.status:
u.status = ''
stats += '\n' + u.show + ': ' + u.status
gajim.connections[self.account].request_os_info(self.user.jid, \
u.resource)
self.os_info[i] = {'resource': u.resource, 'client': '',
'platform': ''}
i += 1
self.xml.get_widget('resource_label').set_text(resources)
self.xml.get_widget('status_label').set_text(stats)
gajim.connections[self.account].request_vcard(self.user.jid)
gajim.connections[self.account].request_os_info(self.user.jid, \
self.user.resource)
def add_to_vcard(self, vcard, entry, txt):
'''Add an information to the vCard dictionary'''