/soc/2015/jgeboski/facebook: c92bc4233941: facebook: fixed impro...

James Geboski jgeboski at gmail.com
Mon Aug 24 19:58:01 EDT 2015


Changeset: c92bc423394184f4a17f619caedaf56d72347085
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-08-24 19:34 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/c92bc4233941

Description:

facebook: fixed improper handling of queue errors

diffstat:

 libpurple/protocols/facebook/api.c      |  2 +-
 libpurple/protocols/facebook/api.h      |  4 +++-
 libpurple/protocols/facebook/facebook.c |  5 +++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diffs (47 lines):

diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -602,7 +602,7 @@ fb_api_json_chk(FbApi *api, gconstpointe
 	if (purple_strequal(str, "ERROR_QUEUE_NOT_FOUND") ||
 	    purple_strequal(str, "ERROR_QUEUE_LOST"))
 	{
-		errc = FB_API_ERROR_AUTH;
+		errc = FB_API_ERROR_QUEUE;
 		success = FALSE;
 
 		g_free(priv->stoken);
diff --git a/libpurple/protocols/facebook/api.h b/libpurple/protocols/facebook/api.h
--- a/libpurple/protocols/facebook/api.h
+++ b/libpurple/protocols/facebook/api.h
@@ -249,13 +249,15 @@ typedef struct _FbApiUser FbApiUser;
  * FbApiError:
  * @FB_API_ERROR_GENERAL: General failure.
  * @FB_API_ERROR_AUTH: Authentication failure.
+ * @FB_API_ERROR_QUEUE: Queue failure.
  *
  * The error codes for the #FB_API_ERROR domain.
  */
 typedef enum
 {
 	FB_API_ERROR_GENERAL,
-	FB_API_ERROR_AUTH
+	FB_API_ERROR_AUTH,
+	FB_API_ERROR_QUEUE
 } FbApiError;
 
 /**
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
@@ -336,6 +336,11 @@ fb_cb_api_error(FbApi *api, GError *erro
 		return;
 	}
 
+	if (g_error_matches(error, FB_API_ERROR, FB_API_ERROR_QUEUE)) {
+		/* Save the reset data */
+		fb_data_save(fata);
+	}
+
 	if ((error->domain == FB_HTTP_ERROR) &&
 	    (error->code >= 400) &&
 	    (error->code <= 500))



More information about the Commits mailing list