def _disco_info_results(self, results, iq, room = None): info = [] for i in results: info.extend(i[1]) # a better fix to the twisted bug is just create a new iq riq = xsIQ(self.xmlstream, 'result') riq['id'] = iq['id'] riq['to'] = iq['from'] riq['from'] = iq['to'] riq.addElement('query', DISCO_NS_INFO) if room and not info: return error.error_from_iq(iq, 'item-not-found') else: for item in info: item.parent = riq.query riq.query.addChild(item) iq.handled = True return riq
def _disco_items_result(self, results, iq, room = None, node = None): # a better fix to the twisted bug is just create a new iq riq = xsIQ(self.xmlstream, "result") riq['id'] = iq['id'] riq['to'] = iq['from'] riq['from'] = iq['to'] riq.addElement('query', DISCO_NS_ITEMS) if node: riq.query['node'] = node items = [] for i in results: if len(i[1])>0: if i[1][0].name == 'error': riq['type'] = 'error' riq.addChild(i[1][0]) continue items.extend(i[1]) riq.query.children = items iq.handled = True return riq