/** * Sends the filled out answer form to be sent and queried by the search service. * * @param con the current XMPPConnection. * @param searchForm the <code>Form</code> to send for querying. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return ReportedData the data found from the query. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { UserSearch search = new UserSearch(); search.setType(IQ.Type.set); search.setTo(searchService); search.addExtension(searchForm.getDataFormToSend()); IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow(); return ReportedData.getReportedDataFrom(response); }
/** * Submits a search form to the server and returns the resulting information * in the form of <code>ReportedData</code>. * * @param searchForm the <code>Form</code> to submit for searching. * @param searchService the name of the search service to use. * @return the ReportedData returned by the server. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public ReportedData getSearchResults(Form searchForm, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return userSearch.sendSearchForm(con, searchForm, searchService); }
/** * Returns the form to fill out to perform a search. * * @param searchService the search service to query. * @return the form to fill out to perform a search. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public Form getSearchForm(DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return userSearch.getSearchForm(con, searchService); }
/** * Returns the form for all search fields supported by the search service. * * @param con the current XMPPConnection. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return the search form received by the server. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public Form getSearchForm(XMPPConnection con, DomainBareJid searchService) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { UserSearch search = new UserSearch(); search.setType(IQ.Type.get); search.setTo(searchService); IQ response = con.createStanzaCollectorAndSend(search).nextResultOrThrow(); return Form.getFormFrom(response); }
/** * Sends the filled out answer form to be sent and queried by the search service. * * @param con the current Connection. * @param searchForm the <code>Form</code> to send for querying. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return ReportedData the data found from the query. * @throws XMPPException * thrown if a server error has occurred. */ public ReportedData sendSearchForm(Connection con, Form searchForm, String searchService) throws XMPPException { UserSearch search = new UserSearch(); search.setType(Type.SET); search.setTo(searchService); search.addExtension(searchForm.getDataFormToSend()); PacketCollector collector = con.createPacketCollector(new PacketIDFilter(search.getPacketID())); con.sendPacket(search); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { return sendSimpleSearchForm(con, searchForm, searchService); } return ReportedData.getReportedDataFrom(response); }
/** * Returns the form for all search fields supported by the search service. * * @param con the current Connection. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return the search form received by the server. * @throws org.jivesoftware.smack.XMPPException * thrown if a server error has occurred. */ public Form getSearchForm(Connection con, String searchService) throws XMPPException { UserSearch search = new UserSearch(); search.setType(IQ.Type.GET); search.setTo(searchService); PacketCollector collector = con.createPacketCollector(new PacketIDFilter(search.getPacketID())); con.sendPacket(search); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return Form.getFormFrom(response); }
search = new UserSearch(); search.addExtension(PacketParserUtils.parsePacketExtension(parser.getName(), parser.getNamespace(), parser));
UserSearch userSearch = new UserSearch(); answerForm.setAnswer("Username", true); ReportedData data = userSearch.sendSearchForm(connection, answerForm, "search." + connection.getServiceName());
/** * Creates a new UserSearchManager. * * @param con the XMPPConnection to use. */ public UserSearchManager(XMPPConnection con) { this.con = con; userSearch = new UserSearch(); }
public String getChildElementXML() { StringBuilder buf = new StringBuilder(); buf.append("<query xmlns=\"jabber:iq:search\">"); buf.append(getExtensionsXML()); buf.append("</query>"); return buf.toString(); }
/** * Sends the filled out answer form to be sent and queried by the search service. * * @param con the current Connection. * @param searchForm the <code>Form</code> to send for querying. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return ReportedData the data found from the query. * @throws org.jivesoftware.smack.XMPPException * thrown if a server error has occurred. */ public ReportedData sendSearchForm(Connection con, Form searchForm, String searchService) throws XMPPException { UserSearch search = new UserSearch(); search.setType(IQ.Type.SET); search.setTo(searchService); search.addExtension(searchForm.getDataFormToSend()); PacketCollector collector = con.createPacketCollector(new PacketIDFilter(search.getPacketID())); con.sendPacket(search); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { return sendSimpleSearchForm(con, searchForm, searchService); } return ReportedData.getReportedDataFrom(response); }
/** * Returns the form for all search fields supported by the search service. * * @param con the current Connection. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return the search form received by the server. * @throws org.jivesoftware.smack.XMPPException * thrown if a server error has occurred. */ public Form getSearchForm(Connection con, String searchService) throws XMPPException { UserSearch search = new UserSearch(); search.setType(IQ.Type.GET); search.setTo(searchService); PacketCollector collector = con.createPacketCollector(new PacketIDFilter(search.getPacketID())); con.sendPacket(search); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return Form.getFormFrom(response); }
search = new UserSearch(); search.addExtension(PacketParserUtils.parsePacketExtension(parser.getName(), parser.getNamespace(), parser));
UserSearch userSearch = new UserSearch(); answerForm.setAnswer("Username", true); answerForm.setAnswer("search", "*"); ReportedData results = userSearch.sendSearchForm(Utils.getConnection(), answerForm, searchFormString); if (results != null) { List<ReportedData.Row> rows = results.getRows();
search = new UserSearch(); PacketParserUtils.addExtensionElement(search, parser);
public String getChildElementXML() { StringBuffer buf = new StringBuffer(); buf.append("<query xmlns=\"jabber:iq:search\">"); buf.append(getExtensionsXML()); buf.append("</query>"); return buf.toString(); }
/** * Sends the filled out answer form to be sent and queried by the search service. * * @param con the current XMPPConnection. * @param searchForm the <code>Form</code> to send for querying. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return ReportedData the data found from the query. * @throws org.jivesoftware.smack.XMPPException * thrown if a server error has occurred. */ public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws XMPPException { UserSearch search = new UserSearch(); search.setType(IQ.Type.SET); search.setTo(searchService); search.addExtension(searchForm.getDataFormToSend()); PacketCollector collector = con.createPacketCollector(new PacketIDFilter(search.getPacketID())); con.sendPacket(search); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { return sendSimpleSearchForm(con, searchForm, searchService); } return ReportedData.getReportedDataFrom(response); }
/** * Returns the form for all search fields supported by the search service. * * @param con the current Connection. * @param searchService the search service to use. (ex. search.jivesoftware.com) * @return the search form received by the server. * @throws XMPPException * thrown if a server error has occurred. */ public Form getSearchForm(Connection con, String searchService) throws XMPPException { UserSearch search = new UserSearch(); search.setType(Type.GET); search.setTo(searchService); PacketCollector collector = con.createPacketCollector(new PacketIDFilter(search.getPacketID())); con.sendPacket(search); IQ response = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Cancel the collector. collector.cancel(); if (response == null) { throw new XMPPException("No response from server on status set."); } if (response.getError() != null) { throw new XMPPException(response.getError()); } return Form.getFormFrom(response); }
search = new UserSearch(); search.addExtension(PacketParserUtils.parsePacketExtension(parser.getName(), parser.getNamespace(), parser));
/** * Creates a new UserSearchManager. * * @param con the Connection to use. */ public UserSearchManager(Connection con) { this.con = con; userSearch = new UserSearch(); }