/pidgin/main: 2ee4c67768f4: connection: Support PurpleConnection...
Mike Ruprecht <[email protected]> Sun, 28 Aug 2016 23:58:01 -0400
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: 2ee4c67768f4ca1bf7a20bd02f6eccfd939da8a3 Author: Mike Ruprecht <[email protected]> Date: 2016-08-26 03:52 -0500 Branch: default URL: https://hg.pidgin.im/pidgin/main/rev/2ee4c67768f4 Description: connection: Support PurpleConnectionError GErrors This patch adds support for PurpleConnectionError codes being passed as GErrors into purple_connection_g_error() and purple_connection_take_error(). This is a step towards handling PurpleConnection errors natively as GErrors. diffstat: libpurple/connection.c | 4 ++++ libpurple/connection.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) diffs (50 lines): diff --git a/libpurple/connection.c b/libpurple/connection.c --- a/libpurple/connection.c +++ b/libpurple/connection.c @@ -39,6 +39,8 @@ #include "signals.h" #include "util.h" +G_DEFINE_QUARK(purple-connection-error-quark, purple_connection_error); + #define KEEPALIVE_INTERVAL 30 #define PURPLE_CONNECTION_GET_PRIVATE(obj) \ @@ -572,6 +574,8 @@ purple_connection_g_error(PurpleConnecti } } else if (error->domain == G_IO_ERROR) { reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; + } else if (error->domain == PURPLE_CONNECTION_ERROR) { + reason = error->code; } else { reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; } diff --git a/libpurple/connection.h b/libpurple/connection.h --- a/libpurple/connection.h +++ b/libpurple/connection.h @@ -29,6 +29,8 @@ * @see_also: <link linkend="chapter-signals-connection">Connection signals</link> */ +#include <glib.h> + #define PURPLE_TYPE_CONNECTION (purple_connection_get_type()) #define PURPLE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_CONNECTION, PurpleConnection)) #define PURPLE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_CONNECTION, PurpleConnectionClass)) @@ -99,6 +101,16 @@ typedef enum PURPLE_CONNECTION_CONNECTING } PurpleConnectionState; +#define PURPLE_CONNECTION_ERROR purple_connection_error_quark() + +/** + * purple_connection_error_quark: + * + * Error domain for Purple connection errors. Errors in this domain will be + * from the #PurpleConnectionError enum. + */ +GQuark purple_connection_error_quark(void); + /** * PurpleConnectionError: * @PURPLE_CONNECTION_ERROR_NETWORK_ERROR: There was an error sending or _______________________________________________ Commits mailing list [email protected] https://pidgin.im/cgi-bin/mailman/listinfo/commits