Hi,
Here's what I'm using:
Openfire 3.10.2
Smack 4.1.2
Environment: Android
I'm trying to search for a registered user, but I kept failing to do so. I've tried so many different combinations. I also tried on an older version of smack.
Here's my lastest modified code:
UserSearchManager manager = new UserSearchManager(connection); try { String searchFormString = "search." + connection.getServiceName(); Log.d("***", "SearchForm: " + searchFormString); Form searchForm = manager.getSearchForm(searchFormString); Form answerForm = searchForm.createAnswerForm(); UserSearch userSearch = new UserSearch(); answerForm.setAnswer("Username", true); answerForm.setAnswer("search", user); ReportedData results = userSearch.sendSearchForm(connection, answerForm, searchFormString); if (results != null) { List<ReportedData.Row> rows = results.getRows(); for (ReportedData.Row row : rows) { Log.d("***", "row: " + row.getValues("Username").toString()); } } else { Log.d("***", "No result found"); } } catch (XMPPException e) { e.printStackTrace(); } catch (SmackException.NotConnectedException e) { e.printStackTrace(); } catch (SmackException.NoResponseException e) { e.printStackTrace(); }
I would get this error
org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: remote-server-not-found - cancel
on line 5, Form searchForm = manager.getSearchForm(searchFormString);
I don't know if I missed configure something on openfire server, or do I need to setup something before I start searching.
My workaround idea was to get the full list of registered users and then search from there, but I'm not sure how to achieve that.
Once I logged in, the roster only consists of my friends and groups.
Could someone point me to the right direction?
Thanks,