AGENT_INFO_INFO now send the node
This commit is contained in:
parent
b77173fc1b
commit
544bbb1206
3 changed files with 27 additions and 31 deletions
|
@ -371,7 +371,7 @@ class Connection:
|
||||||
if not identities:
|
if not identities:
|
||||||
self.connection.browseAgents(jid, node)
|
self.connection.browseAgents(jid, node)
|
||||||
else:
|
else:
|
||||||
self.dispatch('AGENT_INFO_INFO', (jid, identities, features))
|
self.dispatch('AGENT_INFO_INFO', (jid, node, identities, features))
|
||||||
self.connection.discoverItems(jid, node)
|
self.connection.discoverItems(jid, node)
|
||||||
|
|
||||||
def _VersionCB(self, con, iq_obj):
|
def _VersionCB(self, con, iq_obj):
|
||||||
|
|
|
@ -1628,9 +1628,29 @@ class Service_discovery_window:
|
||||||
self.browse(child_jid, child_node)
|
self.browse(child_jid, child_node)
|
||||||
child = model.iter_next(child)
|
child = model.iter_next(child)
|
||||||
|
|
||||||
def agent_info_info(self, agent, identities, features):
|
def agent_info_info(self, agent, node, identities, features):
|
||||||
'''When we recieve informations about an agent, but not its items'''
|
'''When we recieve informations about an agent, but not its items'''
|
||||||
self.agent_info(agent, identities, features, [])
|
model = self.services_treeview.get_model()
|
||||||
|
iter = model.get_iter_root()
|
||||||
|
# We look if this agent is in the treeview
|
||||||
|
while (iter):
|
||||||
|
if agent == model.get_value(iter, 1) and node == model.get_value(
|
||||||
|
iter, 2):
|
||||||
|
break
|
||||||
|
if model.iter_has_child(iter):
|
||||||
|
iter = model.iter_children(iter)
|
||||||
|
else:
|
||||||
|
if not model.iter_next(iter):
|
||||||
|
iter = model.iter_parent(iter)
|
||||||
|
if iter:
|
||||||
|
iter = model.iter_next(iter)
|
||||||
|
if not iter: #If it is not we stop
|
||||||
|
return
|
||||||
|
self.agent_infos[agent + node]['features'] = features
|
||||||
|
if len(identities):
|
||||||
|
self.agent_infos[agent + node]['identities'] = identities
|
||||||
|
if identities[0].has_key('name'):
|
||||||
|
model.set_value(iter, 0, identities[0]['name'])
|
||||||
|
|
||||||
def agent_info_items(self, agent, node, items):
|
def agent_info_items(self, agent, node, items):
|
||||||
'''When we recieve items about an agent'''
|
'''When we recieve items about an agent'''
|
||||||
|
@ -1677,32 +1697,8 @@ class Service_discovery_window:
|
||||||
|
|
||||||
def agent_info(self, agent, identities, features, items):
|
def agent_info(self, agent, identities, features, items):
|
||||||
'''When we recieve informations about an agent'''
|
'''When we recieve informations about an agent'''
|
||||||
model = self.services_treeview.get_model()
|
self.agent_info_info(agent, '', identities, features)
|
||||||
iter = model.get_iter_root()
|
self.agent_info_items(agent, '', items)
|
||||||
node = ''
|
|
||||||
if len(identities):
|
|
||||||
if identities[0].has_key('node'):
|
|
||||||
node = identities[0]['node']
|
|
||||||
# We look if this agent is in the treeview
|
|
||||||
while (iter):
|
|
||||||
if agent == model.get_value(iter, 1) and node == model.get_value(
|
|
||||||
iter, 2):
|
|
||||||
break
|
|
||||||
if model.iter_has_child(iter):
|
|
||||||
iter = model.iter_children(iter)
|
|
||||||
else:
|
|
||||||
if not model.iter_next(iter):
|
|
||||||
iter = model.iter_parent(iter)
|
|
||||||
if iter:
|
|
||||||
iter = model.iter_next(iter)
|
|
||||||
if not iter: #If it is not we stop
|
|
||||||
return
|
|
||||||
self.agent_infos[agent + node]['features'] = features
|
|
||||||
if len(identities):
|
|
||||||
self.agent_infos[agent + node]['identities'] = identities
|
|
||||||
if identities[0].has_key('name'):
|
|
||||||
model.set_value(iter, 0, identities[0]['name'])
|
|
||||||
self.agent_info_items(agent, node, items)
|
|
||||||
|
|
||||||
def on_refresh_button_clicked(self, widget):
|
def on_refresh_button_clicked(self, widget):
|
||||||
'''When refresh button is clicked: refresh list: clear and rerequest it'''
|
'''When refresh button is clicked: refresh list: clear and rerequest it'''
|
||||||
|
|
|
@ -356,10 +356,10 @@ class Interface:
|
||||||
array[2])
|
array[2])
|
||||||
|
|
||||||
def handle_event_agent_info_info(self, account, array):
|
def handle_event_agent_info_info(self, account, array):
|
||||||
#('AGENT_INFO_INFO', account, (agent, identities, features))
|
#('AGENT_INFO_INFO', account, (agent, node, identities, features))
|
||||||
if self.windows[account].has_key('disco'):
|
if self.windows[account].has_key('disco'):
|
||||||
self.windows[account]['disco'].agent_info_info(array[0], array[1], \
|
self.windows[account]['disco'].agent_info_info(array[0], array[1], \
|
||||||
array[2])
|
array[2], array[3])
|
||||||
|
|
||||||
def handle_event_acc_ok(self, account, array):
|
def handle_event_acc_ok(self, account, array):
|
||||||
#('ACC_OK', account, (hostname, login, pasword, name, resource, prio,
|
#('ACC_OK', account, (hostname, login, pasword, name, resource, prio,
|
||||||
|
|
Loading…
Add table
Reference in a new issue