Member since Feb 2003 ·
4449 posts · Location: Germany
Group memberships: Administrators, Members
User search needs several steps.
Its described here in XEP-0055: Jabber Search
first you have to figure out the Jid of the user search service on your server. This is done with service discovery. Normally its a subdomain like search.yourserver.com. The search queries get sent to this jid. You can also hardcode the jid when you want.
1) Then you first send a SearchIq of type get to the search service. The service will reply with fields you can search for then. Or an xdata form for the search.
2) based on the reply to 1 you create the search query of type set and sent it to the search service. The service then replies with the search results.
Here is some sampel XML
Query 1:
<iq type='get'
to='search.shakespeare.lit'
id='search1'>
<query xmlns='jabber:iq:search'/>
</iq>
<iq type='result'
from='search.shakespeare.lit'
id='search1'>
<query xmlns='jabber:iq:search'>
<instructions>
Fill in one or more fields to search
for any matching Jabber users.
</instructions>
<first/>
<last/>
<nick/>
<email/>
</query>
</iq>
Query 2, we submit a search with the last (lastname) field only:
<iq type='set'
to='search.shakespeare.lit'
id='search2'>
<query xmlns='jabber:iq:search'>
<last>Capulet</last>
</query>
</iq>
<iq type='result'
from='search.shakespeare.lit'
id='search2'>
<query xmlns='jabber:iq:search'>
<item jid='juliet@capulet.com'>
<first>Juliet</first>
<last>Capulet</last>
<nick>JuliC</nick>
<email>juliet@shakespeare.lit</email>
</item>
<item jid='tybalt@shakespeare.lit'>
<first>Tybalt</first>
<last>Capulet</last>
<nick>ty</nick>
<email>tybalt@shakespeare.lit</email>
</item>
</query>
</iq>

This post was edited on 2013-05-27, 20:55 by
Alex.