找不到SmackAndroid(上下文)用户搜索模块ejabberd
我正在使用windows上的ejabberd-17.01服务器开发基于android的聊天应用程序。在android上使用Smack 4.1。我想使用以下代码搜索用户找不到SmackAndroid(上下文)用户搜索模块ejabberd,android,chat,smack,ejabberd-module,Android,Chat,Smack,Ejabberd Module,我正在使用windows上的ejabberd-17.01服务器开发基于android的聊天应用程序。在android上使用Smack 4.1。我想使用以下代码搜索用户 public void searchUser(){ try { UserSearchManager userSearchManager = new UserSearchManager(connection); Collection<String> services = userS
public void searchUser(){
try {
UserSearchManager userSearchManager = new UserSearchManager(connection);
Collection<String> services = userSearchManager.getSearchServices();
if(services.isEmpty()){
return;
}
Form searchForm = userSearchManager.getSearchForm(services.iterator().next());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Name", true);
answerForm.setAnswer("search", "test"); // here i'm passsing the Text value to search
ReportedData resultData;
resultData = userSearchManager.getSearchResults(answerForm, "search." + connection.getServiceName());
Iterator<ReportedData.Row> it = (Iterator)resultData.getRows();
ReportedData.Row row = null;
while (it.hasNext()) {
String value = it.next().toString();
Log.i("Iteartor values......", " " + value);
System.out.println("Jabber_id :" + row.getValues("jid").toString());
System.out.println("Name :" + row.getValues("Name").toString());
row = it.next();
}
}
catch (SmackException.NoResponseException | SmackException.NotConnectedException | XMPPException.XMPPErrorException | XmppStringprepException e){
Log.w("app" , e.toString());
}
}
我还测试了smack文档中提到的所有依赖项,但找不到此方法。我遗漏了什么,或者是否有其他方法可以在ejabberd中搜索注册用户。另外,我想知道我是否需要将任何模块添加到ejabberd以用于搜索目的,就像在openfire server中手动添加搜索模块一样
compile "org.igniterealtime.smack:smack-im:4.1.0"
compile "org.igniterealtime.smack:smack-android:4.1.0"
compile "org.igniterealtime.smack:smack-tcp:4.1.0"
compile "org.igniterealtime.smack:smack-extensions:4.1.0"