/soc/2015/jgeboski/facebook: dc35ba3e7fac: facebook: fixed all e...

James Geboski jgeboski at gmail.com
Sat Jul 11 14:45:55 EDT 2015


Changeset: dc35ba3e7fac5c93574b4f5def2b89ed65920239
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-07-11 14:45 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/dc35ba3e7fac

Description:

facebook: fixed all errors being marked as fatal

diffstat:

 libpurple/protocols/facebook/facebook.c |  20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diffs (40 lines):

diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c
--- a/libpurple/protocols/facebook/facebook.c
+++ b/libpurple/protocols/facebook/facebook.c
@@ -39,9 +39,6 @@ static GSList *fb_cmds = NULL;
 static PurpleProtocol *fb_protocol = NULL;
 
 static void
-fb_cb_api_error(FbApi *api, GError *error, gpointer data);
-
-static void
 fb_cb_api_auth(FbApi *api, gpointer data)
 {
 	FbData *fata = data;
@@ -168,11 +165,24 @@ static void
 fb_cb_api_error(FbApi *api, GError *error, gpointer data)
 {
 	FbData *fata = data;
+	gboolean nfatal;
 	PurpleConnection *gc;
+	PurpleConnectionError reason;
+
+	/* Non-fatal errors */
+	nfatal = (error->domain == FB_API_ERROR) ||
+	         (error->domain == FB_MQTT_ERROR);
+
+	/* Non-fatal HTTP errors */
+	nfatal |= (error->domain == FB_HTTP_ERROR) &&
+	          (error->code < 400) &&
+	          (error->code > 500);
+
+	reason = (nfatal) ? PURPLE_CONNECTION_ERROR_NETWORK_ERROR
+	                  : PURPLE_CONNECTION_ERROR_OTHER_ERROR;
 
 	gc = fb_data_get_connection(fata);
-	purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
-	                        error->message);
+	purple_connection_error(gc, reason, error->message);
 }
 
 static void



More information about the Commits mailing list