예제 #1
0
        /// <summary>
        /// XMPP
        /// </summary>
        /// <param name="sender">Objet parent</param>
        /// <param name="el">Element</param>
        private void ElementError(object sender, agsXMPP.Xml.Dom.Element el)
        {
            if (el.HasTag("error", true))
            {
                agsXMPP.Xml.Dom.Element e = el.SelectSingleElement("error", true);
                int code = 0;
                if (e.HasAttribute("code"))
                {
                    code = Convert.ToInt32(e.Attribute("code"));
                }
                switch (code)
                {
                case 302:
                    OnErrorRaised(Enums.ErrorType.Query, "Request redirected.");
                    break;

                case 400:
                    OnErrorRaised(Enums.ErrorType.Query, "Bad Request.");
                    break;

                case 401:
                    OnErrorRaised(Enums.ErrorType.Authentification, "Account not authorized.");
                    break;

                case 402:
                    OnErrorRaised(Enums.ErrorType.Authentification, "Account incorrect.");
                    break;

                case 403:
                    OnErrorRaised(Enums.ErrorType.Authentification, "Account denied.");
                    break;

                case 404:
                    OnErrorRaised(Enums.ErrorType.Warning, "Request discontinued.");
                    break;

                case 405:
                    OnErrorRaised(Enums.ErrorType.Warning, "Request prohibited.");
                    break;

                case 406:
                    OnErrorRaised(Enums.ErrorType.Query, "Request not authorized.");
                    break;

                case 407:
                    OnErrorRaised(Enums.ErrorType.Authentification, "Account not registered.");
                    break;

                case 408:
                    OnErrorRaised(Enums.ErrorType.Server, "Server Timeout.");
                    break;

                case 409:
                    OnErrorRaised(Enums.ErrorType.Warning, "Conflicting request.");
                    break;

                case 500:
                    OnErrorRaised(Enums.ErrorType.Server, "Internal error.");
                    break;

                case 501:
                    OnErrorRaised(Enums.ErrorType.Warning, "Request not implemented.");
                    break;

                case 502:
                    OnErrorRaised(Enums.ErrorType.Server, "Distant error.");
                    break;

                case 503:
                    OnErrorRaised(Enums.ErrorType.Warning, "Service temporarily not available.");
                    break;

                case 504:
                    OnErrorRaised(Enums.ErrorType.Server, "Distant time limit reached.");
                    break;

                case 510:
                    OnErrorRaised(Enums.ErrorType.Warning, "Disconnected.");
                    break;

                default:
                    OnErrorRaised(Enums.ErrorType.Client, "General error.");
                    break;
                }
            }
            else
            {
                if (el.HasTag("bad-request", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Request incorrect.");
                }
                else if (el.HasTag("conflict", true))
                {
                    OnErrorRaised(Enums.ErrorType.Warning, "Conflicting request.");
                }
                else if (el.HasTag("feature-not-implemented", true))
                {
                    OnErrorRaised(Enums.ErrorType.Warning, "Request not implemented.");
                }
                else if (el.HasTag("forbidden", true))
                {
                    OnErrorRaised(Enums.ErrorType.Authentification, "Account not authorized.");
                }
                else if (el.HasTag("gone", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Request redirected.");
                }
                else if (el.HasTag("internal-server-error", true))
                {
                    OnErrorRaised(Enums.ErrorType.Server, "Internal error.");
                }
                else if (el.HasTag("item-not-found", true))
                {
                    OnErrorRaised(Enums.ErrorType.Warning, "Request discontinued.");
                }
                else if (el.HasTag("jid-malformed", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Jabber ID incorrect.");
                }
                else if (el.HasTag("not-acceptable", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Request not accepted.");
                }
                else if (el.HasTag("not-allowed", true))
                {
                    OnErrorRaised(Enums.ErrorType.Server, "Operation not allowed");
                }
                else if (el.HasTag("not-authorized", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Request not authorized.");
                }
                else if (el.HasTag("payment-required", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Finalisation requise.");
                }
                else if (el.HasTag("recipient-unavailable", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Recipient unavailable.");
                }
                else if (el.HasTag("redirect", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Request redirected.");
                }
                else if (el.HasTag("registration-required", true))
                {
                    OnErrorRaised(Enums.ErrorType.Authentification, "Account not registered.");
                }
                else if (el.HasTag("remote-server-not-found", true))
                {
                    OnErrorRaised(Enums.ErrorType.Server, "Distant error.");
                }
                else if (el.HasTag("remote-server-timeout", true))
                {
                    OnErrorRaised(Enums.ErrorType.Server, "Server Timeout.");
                }
                else if (el.HasTag("resource-constraint", true))
                {
                    OnErrorRaised(Enums.ErrorType.Authentification, "Resource invalid.");
                }
                else if (el.HasTag("service-unavailable", true))
                {
                    OnErrorRaised(Enums.ErrorType.Warning, "Service temporary not available");
                }
                else if (el.HasTag("subscription-required", true))
                {
                    OnErrorRaised(Enums.ErrorType.Client, "Abonnement required.");
                }
                else if (el.HasTag("undefined-condition", true))
                {
                    OnErrorRaised(Enums.ErrorType.Client, "Condition undefined.");
                }
                else if (el.HasTag("unexpected-request", true))
                {
                    OnErrorRaised(Enums.ErrorType.Query, "Bad Request.");
                }
            }
        }
예제 #2
0
        /// <summary>
        /// XMPP
        /// </summary>
        /// <param name="sender">Objet parent</param>
        /// <param name="el">Element</param>
        private void ElementError(object sender, agsXMPP.Xml.Dom.Element el)
        {
            if (el.HasTag("error", true))
            {
                agsXMPP.Xml.Dom.Element e = el.SelectSingleElement("error", true);
                int code = 0;
                if (e.HasAttribute("code"))
                {
                    code = Convert.ToInt32(e.Attribute("code"));
                }
                switch (code)
                {
                case 302:
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande redirig�.");
                    break;

                case 400:
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande incorrecte.");
                    break;

                case 401:
                    OnErrorRaised(Enumerations.ErrorType.Authentification, "Compte non autauris�.");
                    break;

                case 402:
                    OnErrorRaised(Enumerations.ErrorType.Authentification, "Compte incorrect.");
                    break;

                case 403:
                    OnErrorRaised(Enumerations.ErrorType.Authentification, "Compte refus�.");
                    break;

                case 404:
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Demande inconnue.");
                    break;

                case 405:
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Demande interdite.");
                    break;

                case 406:
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande non autoris�e.");
                    break;

                case 407:
                    OnErrorRaised(Enumerations.ErrorType.Authentification, "Compte non enregistr�.");
                    break;

                case 408:
                    OnErrorRaised(Enumerations.ErrorType.Server, "Temps limite atteint.");
                    break;

                case 409:
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Demande en conflit.");
                    break;

                case 500:
                    OnErrorRaised(Enumerations.ErrorType.Server, "Erreur interne.");
                    break;

                case 501:
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Demande non impl�ment�e.");
                    break;

                case 502:
                    OnErrorRaised(Enumerations.ErrorType.Server, "Erreur distante.");
                    break;

                case 503:
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Service temporairement innaccessible.");
                    break;

                case 504:
                    OnErrorRaised(Enumerations.ErrorType.Server, "Temps limite distant atteint.");
                    break;

                case 510:
                    OnErrorRaised(Enumerations.ErrorType.Warning, "D�connect�.");
                    break;

                default:
                    OnErrorRaised(Enumerations.ErrorType.Client, "Erreur g�n�rale.");
                    break;
                }
            }
            else
            {
                if (el.HasTag("bad-request", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande incorrecte.");
                }
                else if (el.HasTag("conflict", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Demande en conflit.");
                }
                else if (el.HasTag("feature-not-implemented", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Demande non impl�ment�e.");
                }
                else if (el.HasTag("forbidden", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Authentification, "Compte non autoris�.");
                }
                else if (el.HasTag("gone", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande redirig�e");
                }
                else if (el.HasTag("internal-server-error", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Server, "Erreur interne.");
                }
                else if (el.HasTag("item-not-found", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Warning, "El�ment inconnu.");
                }
                else if (el.HasTag("jid-malformed", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Jabber ID incorrect.");
                }
                else if (el.HasTag("not-acceptable", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande non accept�e.");
                }
                else if (el.HasTag("not-allowed", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Server, "Op�ration non autoris�e.");
                }
                else if (el.HasTag("not-authorized", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande non autoris�e.");
                }
                else if (el.HasTag("payment-required", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Finalisation requise.");
                }
                else if (el.HasTag("recipient-unavailable", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Destinataire non disponible.");
                }
                else if (el.HasTag("redirect", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande redirig�.");
                }
                else if (el.HasTag("registration-required", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Authentification, "Compte non enregistr�.");
                }
                else if (el.HasTag("remote-server-not-found", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Server, "Erreur distante.");
                }
                else if (el.HasTag("remote-server-timeout", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Server, "Temps limite distant atteint.");
                }
                else if (el.HasTag("resource-constraint", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Authentification, "Ressource valide requise.");
                }
                else if (el.HasTag("service-unavailable", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Warning, "Service temporairement innaccessible.");
                }
                else if (el.HasTag("subscription-required", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Client, "Abonnement requis.");
                }
                else if (el.HasTag("undefined-condition", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Client, "Condition inconnue.");
                }
                else if (el.HasTag("unexpected-request", true))
                {
                    OnErrorRaised(Enumerations.ErrorType.Query, "Demande incorrecte.");
                }
            }
        }