plugin XEP-0055: display the search results using XMLUI JidsListWidget
This commit is contained in:
parent
9dad292328
commit
c00b54a04a
1 changed files with 12 additions and 1 deletions
|
|
@ -261,7 +261,18 @@ class XEP_0055(object):
|
|||
@param elt (domish.Element): form result element
|
||||
"""
|
||||
if [child for child in elt.children if child.name == "item"]:
|
||||
xml_tools.dataFormResult2AdvancedList(main_ui, elt)
|
||||
headers, xmlui_data = xml_tools.dataFormResult2XMLUIData(elt)
|
||||
if "jid" in headers: # use XMLUI JidsListWidget to display the results
|
||||
values = {}
|
||||
for i in range(len(xmlui_data)):
|
||||
header = headers.keys()[i % len(headers)]
|
||||
widget_type, widget_args, widget_kwargs = xmlui_data[i]
|
||||
value = widget_args[0]
|
||||
values.setdefault(header, []).append(jid.JID(value) if header == "jid" else value)
|
||||
main_ui.addJidsList(jids=values["jid"], name=D_(u"Search results"))
|
||||
# TODO: also display the values other than JID
|
||||
else:
|
||||
xml_tools.XMLUIData2AdvancedList(main_ui, headers, xmlui_data)
|
||||
else:
|
||||
main_ui.addText(D_("The search gave no result"))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue