简体   繁体   English

与ejabberd一起使用UserSearchManager

[英]smack UserSearchManager with ejabberd

i'm trying to build a chat on android with ejabberd (15.11) and smack (4.1.5). 我正在尝试使用ejabberd(15.11)和smack(4.1.5)在android上建立聊天。

Before sending a subscribe Stanza i would like to check if this user exists on my server by checking if the jid is already in use: 在发送订阅节之前,我想通过检查jid是否已经在使用该服务器来检查该用户是否存在:

    UserSearchManager userSearchManager = new UserSearchManager(connection);
    Form searchForm = userSearchManager.getSearchForm("vjud." + connection.getServiceName());       
    Form answerForm = searchForm.createAnswerForm();
    answerForm.setAnswer("user", userName + "@" + connection.getServiceName());
    ReportedData data = userSearchManager.getSearchResults(answerForm, "vjud." + connection.getServiceName());

I get multiple columns from my server, but no rows - means no data. 我从服务器获取多列,但没有行-意味着没有数据。 Doesn't matter if I just take the userName or Jid. 我只接受userName还是Jid都没关系。

I do nothing else than register a user with a password, so firstname or something like this is not set. 除了使用密码注册用户外,我什么也不做,因此不会设置名字或类似名称。

Can anybody tell me what I'm doing wrong or where the best place is to look up the set Answer parameters? 谁能告诉我我做错了什么,或者哪里是查找设置的Answer参数的最佳位置? I searched a lot but couldn't find any help. 我进行了很多搜索,但找不到任何帮助。

Jabber User directory is based on Vcard. Jabber用户目录基于Vcard。 Users that do not have a Vcard will not be searchable through User directory. 没有Vcard的用户将无法通过User目录进行搜索。 It means that indeed, registering a user is not enough to make it appear in Jabber Search directory. 这意味着确实,注册用户不足以使其出现在Jabber Search目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM