user2897257
user2897257

Reputation:

Search for user on openfire server

I am working on a chat app. I Need to search for a user registered on the server.I am using following code to achieve this

   UserSearchManager search = new UserSearchManager(conn.getInstance());  

    Form searchForm;
    try {
    searchForm = search.getSearchForm("search."+conn.getInstance().getServiceName());

    Form answerForm = searchForm.createAnswerForm();  

    answerForm.setAnswer("Username", true);  

    answerForm.setAnswer("search","anurag");  
    ReportedData data = search.getSearchResults(answerForm,"search."+conn.getInstance().getServiceName());  

if(data.getRows() != null)
    {
         //Toast.makeText(this,"Username Exists",Toast.LENGTH_SHORT).show();

    Log.v("user","exits");
        return true;

    }

    /*else
    {
         Toast.makeText(this,"Username Available",Toast.LENGTH_SHORT).show();

    }*/
    } catch (XMPPException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();

        Log.v("Exceptio occured",""+e.getMessage());

    } 
      return false;

Howerver I am getting Sevice-unavailable(503) exception on this line

searchForm = search.getSearchForm("search."+conn.getInstance().getServiceName());

I have also included the following code

 provider_manager.addIQProvider("query", "jabber:iq:search", new UserSearch.Provider());

Do i need some configuration settings on the server e.g plugins etc or anything else??

Thanks in advance.

Upvotes: 1

Views: 305

Answers (1)

user2897257
user2897257

Reputation:

added search.jar plugin on the server and everything turned well...

Upvotes: 1

Related Questions