/soc/2015/mmcc/main: 7dbfc8d90111: dx pointed out why macro is e...
Michael McConville <[email protected]>
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: 7dbfc8d901110304181266abe3bf4e951ce4c599 Author: Michael McConville <[email protected]> Date: 2015-06-20 13:39 -0400 Branch: default URL: https://hg.pidgin.im/soc/2015/mmcc/main/rev/7dbfc8d90111 Description: dx pointed out why macro is easiest - reverting diffstat: libpurple/protocols/jabber/jabber.c | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-) diffs (73 lines): diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c +++ b/libpurple/protocols/jabber/jabber.c @@ -2668,12 +2668,8 @@ char *jabber_parse_error(JabberStream *j const char *xmlns = purple_xmlnode_get_namespace(packet); char *cdata = NULL; - -void set_reason(PurpleConnectionError x) { - if (reason != NULL) { - *reason = x; - } -} +#define SET_REASON(x) \ + if(reason != NULL) { *reason = x; } if((error = purple_xmlnode_get_child(packet, "error"))) { PurpleXmlNode *t = purple_xmlnode_get_child_with_namespace(error, "text", NS_XMPP_STANZAS); @@ -2688,7 +2684,7 @@ void set_reason(PurpleConnectionError x) if(purple_xmlnode_get_child(error, "bad-request")) { text = _("Bad Request"); } else if(purple_xmlnode_get_child(error, "conflict")) { - set_reason(PURPLE_CONNECTION_ERROR_NAME_IN_USE); + SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); text = _("Conflict"); } else if(purple_xmlnode_get_child(error, "feature-not-implemented")) { text = _("Feature Not Implemented"); @@ -2733,7 +2729,7 @@ void set_reason(PurpleConnectionError x) } } else if(xmlns && !strcmp(xmlns, NS_XMPP_SASL)) { /* Most common reason can be the default */ - set_reason(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); + SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); if(purple_xmlnode_get_child(packet, "aborted")) { text = _("Authorization Aborted"); } else if(purple_xmlnode_get_child(packet, "incorrect-encoding")) { @@ -2743,10 +2739,10 @@ void set_reason(PurpleConnectionError x) } else if(purple_xmlnode_get_child(packet, "invalid-mechanism")) { text = _("Invalid Authorization Mechanism"); } else if(purple_xmlnode_get_child(packet, "mechanism-too-weak")) { - set_reason(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); + SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE); text = _("Authorization mechanism too weak"); } else if(purple_xmlnode_get_child(packet, "not-authorized")) { - set_reason(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); + SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); /* Clear the pasword if it isn't being saved */ if (!purple_account_get_remember_password(purple_connection_get_account(js->gc))) purple_account_set_password(purple_connection_get_account(js->gc), NULL, NULL, NULL); @@ -2754,20 +2750,20 @@ void set_reason(PurpleConnectionError x) } else if(purple_xmlnode_get_child(packet, "temporary-auth-failure")) { text = _("Temporary Authentication Failure"); } else { - set_reason(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); + SET_REASON(PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED); text = _("Authentication Failure"); } } else if(!strcmp(packet->name, "stream:error") || (!strcmp(packet->name, "error") && xmlns && !strcmp(xmlns, NS_XMPP_STREAMS))) { /* Most common reason as default: */ - set_reason(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); + SET_REASON(PURPLE_CONNECTION_ERROR_NETWORK_ERROR); if(purple_xmlnode_get_child(packet, "bad-format")) { text = _("Bad Format"); } else if(purple_xmlnode_get_child(packet, "bad-namespace-prefix")) { text = _("Bad Namespace Prefix"); } else if(purple_xmlnode_get_child(packet, "conflict")) { - set_reason(PURPLE_CONNECTION_ERROR_NAME_IN_USE); + SET_REASON(PURPLE_CONNECTION_ERROR_NAME_IN_USE); text = _("Resource Conflict"); } else if(purple_xmlnode_get_child(packet, "connection-timeout")) { text = _("Connection Timeout"); _______________________________________________ Commits mailing list [email protected] https://pidgin.im/cgi-bin/mailman/listinfo/commits