2

嗨,我需要从 xmpp 服务器(openfire)获取所有注册用户。

尝试 {

                    UserSearchManager search = new UserSearchManager(connection);
                    Form searchForm = search.getSearchForm("search."+connection.getServiceName());
                    Form answerForm = searchForm.createAnswerForm();
                    answerForm.setAnswer("Username", true);
                    answerForm.setAnswer("search", "anbu");
                    ReportedData data = search.getSearchResults(answerForm, "search." + connection.getServiceName());
                    if (data.getRows() != null) {
                        Iterator<ReportedData.Row> it = data.getRows();
                        while (it.hasNext()) {
                            ReportedData.Row row = it.next();
                            Iterator iterator = row.getValues("jid");
                            if (iterator.hasNext()) {
                                String value = iterator.next().toString();
                                Log.i("Iteartor values......", " " + value);
                            }
                        }
                    }
                } catch (XMPPException e2) {
                    e2.printStackTrace();
                }

我已经在管理面板中安装了 search.jar。我仍然得到(未找到远程服务器)。但是聊天对我有用。

4

1 回答 1

0

为什么不使用 Openfire 的 REST API 插件呢?

https://www.igniterealtime.org/projects/openfire/plugins/restapi/readme.html#retrieve-users

于 2015-11-30T17:57:38.287 回答