aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--facebook/facebook-api.c25
-rw-r--r--facebook/facebook-api.h7
2 files changed, 23 insertions, 9 deletions
diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c
index 1237861..d9d4486 100644
--- a/facebook/facebook-api.c
+++ b/facebook/facebook-api.c
@@ -1353,7 +1353,11 @@ fb_api_xma_parse(FbApi *api, const gchar *body, JsonNode *root, GError **error)
if (g_strcmp0(str, "ExternalUrl") == 0) {
prms = fb_http_values_new();
fb_http_values_parse(prms, url, TRUE);
- text = fb_http_values_dup_str(prms, "u", NULL);
+ if (g_str_has_prefix(url, FB_API_FBRPC_PREFIX)) {
+ text = fb_http_values_dup_str(prms, "target_url", NULL);
+ } else {
+ text = fb_http_values_dup_str(prms, "u", NULL);
+ }
fb_http_values_free(prms);
} else {
text = g_strdup(url);
@@ -2034,6 +2038,7 @@ fb_api_cb_contacts_nodes(FbApi *api, JsonNode *root, GSList *users)
FbApiUser *user;
FbId uid;
FbJsonValues *values;
+ gboolean is_array;
GError *err = NULL;
values = fb_json_values_new(root);
@@ -2046,7 +2051,9 @@ fb_api_cb_contacts_nodes(FbApi *api, JsonNode *root, GSList *users)
fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE,
"$.hugePictureUrl.uri");
- if (JSON_NODE_TYPE(root) == JSON_NODE_ARRAY) {
+ is_array = (JSON_NODE_TYPE(root) == JSON_NODE_ARRAY);
+
+ if (is_array) {
fb_json_values_set_array(values, FALSE, "$");
}
@@ -2058,6 +2065,9 @@ fb_api_cb_contacts_nodes(FbApi *api, JsonNode *root, GSList *users)
if (((g_strcmp0(str, "ARE_FRIENDS") != 0) &&
(uid != priv->uid)) || (uid == 0))
{
+ if (!is_array) {
+ break;
+ }
continue;
}
@@ -2070,7 +2080,7 @@ fb_api_cb_contacts_nodes(FbApi *api, JsonNode *root, GSList *users)
users = g_slist_prepend(users, user);
- if (JSON_NODE_TYPE(root) != JSON_NODE_ARRAY) {
+ if (!is_array) {
break;
}
}
@@ -2086,7 +2096,7 @@ fb_api_cb_contacts_parse_removed(FbApi *api, JsonNode *node, GSList *users)
{
gsize len;
char **split;
- guchar *decoded = g_base64_decode(json_node_get_string(node), &len);
+ char *decoded = (char *) g_base64_decode(json_node_get_string(node), &len);
g_return_val_if_fail(decoded[len] == '\0', users);
g_return_val_if_fail(len == strlen(decoded), users);
@@ -2109,11 +2119,8 @@ fb_api_cb_contacts(FbHttpRequest *req, gpointer data)
{
const gchar *cursor;
const gchar *delta_cursor;
- const gchar *str;
FbApi *api = data;
FbApiPrivate *priv = api->priv;
- FbApiUser *user;
- FbId uid;
FbJsonValues *values;
gboolean complete;
gboolean is_delta;
@@ -2144,12 +2151,12 @@ fb_api_cb_contacts(FbHttpRequest *req, gpointer data)
GList *elms = json_array_get_elements(arr);
for (l = elms; l != NULL; l = l->next) {
- if (node = fb_json_node_get(l->data, "$.added", NULL)) {
+ if ((node = fb_json_node_get(l->data, "$.added", NULL))) {
added = fb_api_cb_contacts_nodes(api, node, added);
json_node_free(node);
}
- if (node = fb_json_node_get(l->data, "$.removed", NULL)) {
+ if ((node = fb_json_node_get(l->data, "$.removed", NULL))) {
removed = fb_api_cb_contacts_parse_removed(api, node, removed);
json_node_free(node);
}
diff --git a/facebook/facebook-api.h b/facebook/facebook-api.h
index cb7467f..b6a2812 100644
--- a/facebook/facebook-api.h
+++ b/facebook/facebook-api.h
@@ -68,6 +68,13 @@
#define FB_API_WHOST "https://www.facebook.com"
/**
+ * FB_API_FBRPC_PREFIX
+ *
+ * The fbrpc URL prefix used in links shared from the mobile app.
+ */
+#define FB_API_FBRPC_PREFIX "fbrpc://facebook/nativethirdparty"
+
+/**
* FB_API_KEY:
*
* The Facebook API key.