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

Sander Devrieze s.devrieze at pandora.be
Thu Mar 17 17:07:44 CST 2005


Op donderdag 17 maart 2005 22:23, schreef Trejkaz:
> 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'/>
>     </iq>

Your email is not XMPP compliant :O) It should be:

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

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

<iq from="RECIPIENT" type="result" to="SENDER" >
<query xmlns="http://jabber.org/protocol/disco#info">
<feature var="ejabberd:config" />
</query>
</iq>

> 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>
>     </iq>

This are some possible errors I could get with ejabberd:

<iq from="RECIPIENT" type="error" to="SENDER" >
     <query xmlns="http://jabber.org/protocol/disco#info"/>
   <error type="cancel" code="404" >
<remote-server-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>


<iq from="@@@server" type="error" >
     <query xmlns="http://jabber.org/protocol/disco#info"/>
   <error type="modify" code="400" >
<jid-malformed xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</iq>

But when I send to an unexistant recipeint, I get the same reply as when 
sending to an existing one:

<iq from="_UNEXISTENT_RECIPIENT" type="result" to="SENDER" >
<query xmlns="http://jabber.org/protocol/disco#info">
<feature var="ejabberd:config" />
</query>
</iq>

So it will probably not work...

> 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.

-- 
Mvg, Sander Devrieze.

xmpp:sander at l4l.be ( http://jabber.l4l.be/ )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20050318/4376f049/attachment-0002.pgp>


More information about the JDev mailing list