private static SearchFields processFieldsResults(final XmppURI from, final XMLPacket query) { final SearchFields fields = new SearchFields(); for (final XMLPacket child : query.getChildren()) { if (!child.getTagName().equals("instructions")) { fields.add(child.getTagName()); } else { fields.setInstructions(child.getText()); } } return fields; }
private void searchGeneric(final List<XMLPacket> queryChilds, final IQCallback callback) { if (SessionStatus.ready.equals(session.getStatus())) { final IQ iq = new IQ(IQ.Type.set); iq.setTo(host); iq.getXML().setAttribute("xml:lang", "en"); final XMLPacket queryPacket = iq.addQuery(XmppNamespaces.SEARCH); for (final XMLPacket child : queryChilds) { queryPacket.addChild(child); } session.sendIQ("search", iq, callback); } else throw new RuntimeException(SHOULD_BE_CONNECTED); }
protected static List<SearchResultItem> processResults( final XmppURI from, final XMLPacket query) { final List<SearchResultItem> result = new ArrayList<SearchResultItem>(); for (final XMLPacket child : query.getChildren("item")) { final SearchResultItem searchResultItem = SearchResultItem.parse(child); result.add(searchResultItem); } return result; }