Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
geovanyayala #1
Member since Jun 2007 · 5 posts · Location: Los Mochis, Sinaloa
Group memberships: Members
Show profile · Link to this post
Subject: XMPP Server. Register user
Hi, i'm building a xmpp server. i have a question? how can i send a message from the server to the client to indicate that exist an error on login/register? to fire the OnAuthError or onRegisterError events..

thanks
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
see RFC3920 section 6.5
http://www.xmpp.org/rfcs/rfc3920.html#sasl

If the SASL authentication fails you send failure and include the error.

Example:
  1. <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>

Alex
Alexander Gnauck
AG-Software
Avatar
geovanyayala #3
Member since Jun 2007 · 5 posts · Location: Los Mochis, Sinaloa
Group memberships: Members
Show profile · Link to this post
Subject: Registering error
this a fragment of code to send error to client.

                    if (iq.Query.GetType() == typeof(Register))
                    {
                        //Hacemos el nuevo registro
                        Register _register = iq.Query as Register;
                        switch (iq.Type)
                        {
                            case IqType.get:
                                iq.SwitchDirection();
                                iq.Type = IqType.error; //set the type to error
                                //set the specific error with details
                                agsXMPP.protocol.client.Error x = new agsXMPP.protocol.client.Error();
                                x.Code = ErrorCode.NotAllowed;
                                x.Type = ErrorType.auth;
                                x.Message = "username ocupado";
                                iq.Error = x;                               
                                Send(iq);
                                break;

thanks for your help. with this code the server returns a xml like you explain.
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:
Forum: agsXMPP SDK Support RSS