简体   繁体   中英

smack UserSearchManager with ejabberd

i'm trying to build a chat on android with ejabberd (15.11) and smack (4.1.5).

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:

    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.

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? I searched a lot but couldn't find any help.

Jabber User directory is based on Vcard. Users that do not have a Vcard will not be searchable through User directory. It means that indeed, registering a user is not enough to make it appear in Jabber Search directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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