Not logged in. · Lost password · Register
Forum: XMPP Protocol RSS
Avatar
liyasker #1
Member since Jan 2006 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: there is any method avaliable to find user exists or not
Hi
I am using wildfire xmpp server and Agsxmpp dll
In my project i have one method

public void newuserRegisteration(username,password)
{
}any one call this Utility method and  they can register.

Before registeration i have to find wheather the user already exists or not?
can i search in xmpp server wheather the user already exists?
i need method like that..

private Boolean checkUserExists( string userName)
{

}

it should return true or false ( user exists or not)
it is posible through our agsxmpp library ?

help me
sam
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

no there is nothing in XMPP to check if a user exists. This is by design and for security reasons.
But the register function will return an 409 error if the username is in use.

sample error packet:
<iq type='error' id='reg2'>
  <query xmlns='jabber:iq:register'>
    <username>bill</username>
    <password>m1cro$oft</password>
    <email>billg@bigcompany.com</email>
  </query>
  <error code='409' type='cancel'>
    <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</iq>

Older server may return another error code. So just check them all.
You should get this error in OnRegisterError Handler.

let me know if this helps you.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: