mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-12 02:29:38 +02:00
Adding multiple IQ for JEP 55 handling.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2830 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
3e60826296
commit
23bc043dc1
4 changed files with 211 additions and 10 deletions
70
source/org/jivesoftware/smackx/search/UserSearchManager.java
Normal file
70
source/org/jivesoftware/smackx/search/UserSearchManager.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* $RCSfile: ,v $
|
||||
* $Revision: $
|
||||
* $Date: $
|
||||
*
|
||||
* Copyright (C) 1999-2005 Jive Software. All rights reserved.
|
||||
*
|
||||
* This software is the proprietary information of Jive Software.
|
||||
* Use is subject to license terms.
|
||||
*/
|
||||
package org.jivesoftware.smackx.search;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.Form;
|
||||
import org.jivesoftware.smackx.ReportedData;
|
||||
|
||||
public class UserSearchManager {
|
||||
|
||||
private XMPPConnection con;
|
||||
private String serviceName;
|
||||
private UserSearch userSearch;
|
||||
|
||||
public UserSearchManager(XMPPConnection con, String serviceName) {
|
||||
this.con = con;
|
||||
this.serviceName = serviceName;
|
||||
|
||||
userSearch = new UserSearch();
|
||||
}
|
||||
|
||||
public Form getSearchForm() {
|
||||
try {
|
||||
return userSearch.getSearchForm(con, serviceName);
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ReportedData sendSearchForm(Form searchForm) {
|
||||
ReportedData data = null;
|
||||
try {
|
||||
data = userSearch.sendSearchForm(con, searchForm, serviceName);
|
||||
}
|
||||
catch (XMPPException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
XMPPConnection.DEBUG_ENABLED = true;
|
||||
XMPPConnection con = new XMPPConnection("jabber.org");
|
||||
con.login("ddman", "whocares");
|
||||
|
||||
UserSearchManager manager = new UserSearchManager(con, "users.jabber.org");
|
||||
Form f = manager.getSearchForm();
|
||||
|
||||
Form answers = f.createAnswerForm();
|
||||
answers.setAnswer("first", "Matt");
|
||||
|
||||
ReportedData data = manager.sendSearchForm(answers);
|
||||
System.out.println(data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue