I want to efficiently check for all local address book contacts if they have a jabber account. The users are registered on the XMPP server with the mobile phone number. I currently send the following XEP-0055 stanza to the ejabberd server and evaluate the result.
<iq type="set" id="searchByUserName" to="vjud.ecoimac1.local" from="+1222333444@ecoimac1.local">
<query xmlns="jabber:iq:search">
<x xmlns="jabber:x:data" type="submit">
<field type="hidden" var="FORM_TYPE">
<value>jabber:iq:search</value>
</field>
<field var="user">
<value>+123456789</value>
</field>
</x>
</query>
</iq>
This works but is not efficient. For each number a query has to be sent. Other apps like WhatsApp do the same job. Is there a more efficient way?
I have now following efficient solution:
On server side I did set up a MySQL database backend for eJabberd and on the web server a PHP interface provides a user lookup for the client application. The app sends a HTTP POST request with a set of jabber user names to check. The PHP script looks up which users are registered and returns a response containing the indices of the registered users.
?>