diff options
author | dequis <dx@dxzone.com.ar> | 2015-04-03 01:17:13 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-04-03 01:17:13 -0300 |
commit | 8499f8093ec116a102bcff0fb5633ae245310392 (patch) | |
tree | f5cade3689b7dc70731a9ef548e401b823601adb /facebook/facebook-api.c | |
parent | cf3e226c124028e19987c29ea882038fc449f9d4 (diff) | |
download | bitlbee-facebook-8499f8093ec116a102bcff0fb5633ae245310392.tar.gz bitlbee-facebook-8499f8093ec116a102bcff0fb5633ae245310392.tar.bz2 bitlbee-facebook-8499f8093ec116a102bcff0fb5633ae245310392.tar.xz |
Reset stoken when getting ERROR_QUEUE_NOT_FOUND, to create a new one
Simpler and more verbose version of my other patch which silently
created a new queue - this will show up as a reconnection and should
make it obvious if an infinite loop happens. jgeboski's idea, not mine.
Diffstat (limited to 'facebook/facebook-api.c')
-rw-r--r-- | facebook/facebook-api.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c index 5346327..381568f 100644 --- a/facebook/facebook-api.c +++ b/facebook/facebook-api.c @@ -72,6 +72,13 @@ static gboolean fb_api_json_new(fb_api_t *api, const gchar *data, gsize size, json_value_free(jv); return FALSE; } else if (fb_json_str_chk(jv, "errorCode", &msg)) { + if ((g_ascii_strcasecmp(msg, "ERROR_QUEUE_NOT_FOUND") == 0) || + (g_ascii_strcasecmp(msg, "ERROR_QUEUE_LOST") == 0)) + { + g_free(api->stoken); + api->stoken = NULL; + } + fb_api_error(api, FB_API_ERROR_GENERAL, "%s", msg); json_value_free(jv); return FALSE; @@ -308,7 +315,7 @@ static void fb_api_cb_seqid(fb_http_req_t *req, gpointer data) goto finish; } - if (G_UNLIKELY(api->stoken == NULL)) { + if (api->stoken == NULL) { fb_api_publish(api, "/messenger_sync_create_queue", "{" "\"device_params\":{}," "\"encoding\":\"JSON\"," |