Hello all,
I have a need allow a user to register on the fly. Currently here is what happens:
-
JoeSchmoe tries to login (create a xmpp connection).
-
JoeSchmoe does not exist (not a registered user).
-
Throws a SASL authentication failed error
Now I need to allow JoeSchmoe to create (register) an account if he does not exist.
Currently I am attempting to do this in the catch block.
public XMPPConnection getConnx(String user, String pwd) throws XMPPException { XMPPConnection connx = new XMPPConnection(HOST,PORT); try { //connx.DEBUG_ENABLED = true; PacketTypeFilter filter = new PacketTypeFilter(Message.class); connx.addPacketListener(messageListener,filter); connx.login(user,pwd); System.out.println(user+" IS CONNECTED via getConnx method"); } catch(XMPPException e) { createUserAccount(user,pwd); try { Thread.sleep(3000); } catch(InterruptedException ie){ie.printStackTrace();} getConnx(user,pwd); System.out.println("USER DOES NOT EXIST"); e.printStackTrace(); connx.close(); }
Is there a way to test if the user exists prior to calling the connection.login() method?
Thanks.
BTW, any page that I access under jivesoftware --> Smack take in excess of a few minutes to load. Does anyone else have this problem?