[jdev] Re: How can I verify the JID validity?

Trejkaz trejkaz at trypticon.org
Thu Mar 17 15:23:42 CST 2005

On Thursday 17 March 2005 21:10, George Hazan wrote:
> But for searching by JID I must provide a validator which will decide
> whether to put that JID to the search results window or not. So that's why
> I need all of that, cause previosly the entered JID was simply copied to
> the results window, and users complained that they might try to add
> something completely incorrect. I don't want to compile a list of users :)

This works for jabberd1.4 but would need to be tested more thoroughly to see 
if it behaves the same way on other servers:

The query:
    <iq type='get' to='RECIPIENT'>
      <query xmlns='http://jabber.org/protocols/disco#info'/>

The response when they do exist:
    <iq from="RECIPIENT" type="result" to="SENDER" />

The response when they don't exist:
    <iq from="RECIPIENT" type="error" to="SENDER">
      <query xmlns="http://jabber.org/protocols/disco#info"/>
      <error code="404" >Not Found</error>

I don't know for sure if these responses are exactly right.  Also I'm sure 
some servers might choose to reject disco#info queries for privacy reasons, 
since it allows you to do this kind of user searching.


             Email: Trejkaz Xaoza <trejkaz at trypticon.org>
          Web site: http://trypticon.org/
         Jabber ID: trejkaz at jabber.zim.net.au
   GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F  A62C B8C7 BC8B 037E EA73

More information about the JDev mailing list