we now show the os informations in the vcard_information_window
This commit is contained in:
parent
eb5ae0d4ce
commit
85527841a2
4 changed files with 41 additions and 4 deletions
23
Core/core.py
23
Core/core.py
|
@ -639,6 +639,20 @@ class GajimCore:
|
|||
qp.insertTag('os').insertData(get_os_info())
|
||||
con.send(iq_obj)
|
||||
|
||||
def VersionResultCB(self, con, iq_obj):
|
||||
client_info = ''
|
||||
os_info = ''
|
||||
qp = iq_obj.getTag('query')
|
||||
if qp.getTag('name'):
|
||||
client_info += qp.getTag('name').getData()
|
||||
if qp.getTag('version'):
|
||||
client_info += qp.getTag('version').getData()
|
||||
if qp.getTag('os'):
|
||||
os_info += qp.getTag('os').getData()
|
||||
jid = iq_obj.getFrom().getStripped()
|
||||
self.hub.sendPlugin('OS_INFO', self.connections[con],\
|
||||
(jid, client_info, os_info))
|
||||
|
||||
def connect(self, account):
|
||||
"""Connect and authentificate to the Jabber server"""
|
||||
hostname = self.cfgParser.tab[account]['hostname']
|
||||
|
@ -690,6 +704,8 @@ class GajimCore:
|
|||
common.jabber.NS_P_DISC_INFO)
|
||||
con.registerHandler('iq',self.VersionCB,'get', \
|
||||
common.jabber.NS_VERSION)
|
||||
con.registerHandler('iq',self.VersionResultCB,'result', \
|
||||
common.jabber.NS_VERSION)
|
||||
try:
|
||||
con.connect()
|
||||
except IOError, e:
|
||||
|
@ -1006,6 +1022,13 @@ class GajimCore:
|
|||
del self.gpg[ev[1]]
|
||||
if con:
|
||||
self.connections[con] = ev[2]
|
||||
#('ASK_OS_INFO', account, (jid, resource))
|
||||
elif ev[0] == 'ASK_OS_INFO':
|
||||
if con:
|
||||
iq = common.jabber.Iq(to=ev[2][0]+'/'+ev[2][1], type="get", \
|
||||
query=common.jabber.NS_VERSION)
|
||||
iq.setID(con.getAnID())
|
||||
con.send(iq)
|
||||
#('ASK_VCARD', account, jid)
|
||||
elif ev[0] == 'ASK_VCARD':
|
||||
if con:
|
||||
|
|
|
@ -88,6 +88,10 @@ class vcard_information_window:
|
|||
set_text(vcard[i], 0)
|
||||
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 fill_jabber_page(self):
|
||||
self.xml.get_widget('nickname_label').set_text(self.user.name)
|
||||
|
@ -117,6 +121,7 @@ class vcard_information_window:
|
|||
self.xml.get_widget('resource_label').set_text(resources)
|
||||
self.xml.get_widget('status_label').set_text(stats)
|
||||
self.plugin.send('ASK_VCARD', self.account, self.user.jid)
|
||||
self.plugin.send('ASK_OS_INFO', self.account, (self.user.jid, self.user.resource))
|
||||
|
||||
def add_to_vcard(self, vcard, entry, txt):
|
||||
"""Add an information to the vCard dictionary"""
|
||||
|
@ -212,7 +217,7 @@ class vcard_information_window:
|
|||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'vcard_information_window', APP)
|
||||
self.window = self.xml.get_widget('vcard_information_window')
|
||||
self.plugin = plugin
|
||||
self.user = user #don't use it is vcard is true
|
||||
self.user = user #don't use it if vcard is true
|
||||
self.account = account
|
||||
self.vcard = vcard
|
||||
|
||||
|
|
|
@ -373,6 +373,8 @@ class Groupchat_window(Chat):
|
|||
self.plugin.windows[self.account]['infos'][jid] = \
|
||||
vcard_information_window(jid, self.plugin, self.account, True)
|
||||
self.plugin.send('ASK_VCARD', self.account, jid)
|
||||
#FIXME: we need the resource but it's not saved
|
||||
#self.plugin.send('ASK_OS_INFO', self.account, jid, resource)
|
||||
|
||||
def mk_menu(self, room_jid, event, iter):
|
||||
"""Make user's popup menu"""
|
||||
|
|
|
@ -550,6 +550,11 @@ class plugin:
|
|||
if self.windows[account]['infos'].has_key(array['jid']):
|
||||
self.windows[account]['infos'][array['jid']].set_values(array)
|
||||
|
||||
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])
|
||||
|
||||
def handle_event_log_nb_line(self, account, array):
|
||||
#('LOG_NB_LINE', account, (jid, nb_line))
|
||||
if self.windows['logs'].has_key(array[0]):
|
||||
|
@ -663,6 +668,8 @@ class plugin:
|
|||
self.handle_event_quit(ev[1], ev[2])
|
||||
elif ev[0] == 'MYVCARD':
|
||||
self.handle_event_myvcard(ev[1], ev[2])
|
||||
elif ev[0] == 'OS_INFO':
|
||||
self.handle_event_os_info(ev[1], ev[2])
|
||||
elif ev[0] == 'VCARD':
|
||||
self.handle_event_vcard(ev[1], ev[2])
|
||||
elif ev[0] == 'LOG_NB_LINE':
|
||||
|
@ -825,9 +832,9 @@ class plugin:
|
|||
'STATUS', 'NOTIFY', 'MSG', 'MSGERROR', 'SUBSCRIBED', 'UNSUBSCRIBED', \
|
||||
'SUBSCRIBE', 'AGENTS', 'AGENT_INFO', 'AGENT_INFO_ITEMS', \
|
||||
'AGENT_INFO_INFO', 'REG_AGENT_INFO', 'QUIT', 'ACC_OK', 'CONFIG', \
|
||||
'MYVCARD', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE', 'VISUAL', 'GC_MSG', \
|
||||
'GC_SUBJECT', 'BAD_PASSPHRASE', 'GPG_SECRETE_KEYS', 'ROSTER_INFO', \
|
||||
'MSGSENT'])
|
||||
'MYVCARD', 'OS_INFO', 'VCARD', 'LOG_NB_LINE', 'LOG_LINE', 'VISUAL', \
|
||||
'GC_MSG', 'GC_SUBJECT', 'BAD_PASSPHRASE', 'GPG_SECRETE_KEYS', \
|
||||
'ROSTER_INFO', 'MSGSENT'])
|
||||
self.default_config = {'autopopup':0,\
|
||||
'autopopupaway':0,\
|
||||
'ignore_unknown_contacts':0,\
|
||||
|
|
Loading…
Add table
Reference in a new issue