pidgin/pidgin

Parents 69b44723d52c
Children 274f63f95cc2
facebook: Prevent disconnections on 509 errors, "Invalid attachment id"

I'm still not sure about the origin of these errors (I suspect it's a
race condition between servers), but it's going to be fixed properly in
the future when the sync protocol is updated and doing HTTP requests to
get the attachment URL is no longer required (newer orca versions only
do HTTP requests to get the url of file attachments, everything else is
included in the MQTT stream)
--- a/libpurple/protocols/facebook/api.c Sat Oct 22 03:51:49 2016 -0300
+++ b/libpurple/protocols/facebook/api.c Sat Oct 22 04:13:02 2016 -0300
@@ -600,6 +600,12 @@
priv->token = NULL;
}
+ /* 509 is used for "invalid attachment id" */
+ if (code == 509) {
+ errc = FB_API_ERROR_NONFATAL;
+ success = FALSE;
+ }
+
str = fb_json_values_next_str(values, NULL);
if (purple_strequal(str, "ERROR_QUEUE_NOT_FOUND") ||
--- a/libpurple/protocols/facebook/api.h Sat Oct 22 03:51:49 2016 -0300
+++ b/libpurple/protocols/facebook/api.h Sat Oct 22 04:13:02 2016 -0300
@@ -350,6 +350,7 @@
* @FB_API_ERROR_GENERAL: General failure.
* @FB_API_ERROR_AUTH: Authentication failure.
* @FB_API_ERROR_QUEUE: Queue failure.
+ * @FB_API_ERROR_NONFATAL: Other non-fatal errors.
*
* The error codes for the #FB_API_ERROR domain.
*/
@@ -357,7 +358,8 @@
{
FB_API_ERROR_GENERAL,
FB_API_ERROR_AUTH,
- FB_API_ERROR_QUEUE
+ FB_API_ERROR_QUEUE,
+ FB_API_ERROR_NONFATAL
} FbApiError;
/**
--- a/libpurple/protocols/facebook/facebook.c Sat Oct 22 03:51:49 2016 -0300
+++ b/libpurple/protocols/facebook/facebook.c Sat Oct 22 04:13:02 2016 -0300
@@ -353,7 +353,10 @@
errc = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
}
- purple_connection_error(gc, errc, error->message);
+
+ if (!g_error_matches(error, FB_API_ERROR, FB_API_ERROR_NONFATAL)) {
+ purple_connection_error(gc, errc, error->message);
+ }
}
static void