aboutsummaryrefslogtreecommitdiffstats
path: root/facebook/facebook-thrift.h
diff options
context:
space:
mode:
authorjgeboski <jgeboski@gmail.com>2015-12-31 16:11:55 -0500
committerjgeboski <jgeboski@gmail.com>2016-01-01 19:37:58 -0500
commit56d729851a1a431cbdd28b9c5626fd7e1c86d9e0 (patch)
tree8e3558e5f14c0a9d5c392132317b837da5e6e527 /facebook/facebook-thrift.h
parentfd4e4f7195c0fe93713c25d40ce6edaf600a00c6 (diff)
downloadbitlbee-facebook-56d729851a1a431cbdd28b9c5626fd7e1c86d9e0.tar.gz
bitlbee-facebook-56d729851a1a431cbdd28b9c5626fd7e1c86d9e0.tar.bz2
bitlbee-facebook-56d729851a1a431cbdd28b9c5626fd7e1c86d9e0.tar.xz
facebook-api: properly handle optional Thrift fields and scoping
The plugin is required to read Thrift data for the presence states of contacts. The data which is being read has some optional fields, which are rarely not supplied. This has led to this bug being undiscovered for quite some time. Not only was the plugin not properly accounting for optional fields, but also did not account for field scoping. This is not really an issue until a Thrift list is being read, which will cause the identifier to grow with each field read, rather than reset. The field identifier is only relevant to its local scope, nothing more. More importantly, the identifier must be reset with each iteration of a list.
Diffstat (limited to 'facebook/facebook-thrift.h')
-rw-r--r--facebook/facebook-thrift.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/facebook/facebook-thrift.h b/facebook/facebook-thrift.h
index 65257c4..943825d 100644
--- a/facebook/facebook-thrift.h
+++ b/facebook/facebook-thrift.h
@@ -326,14 +326,16 @@ fb_thrift_read_str(FbThrift *thft, gchar **value);
* fb_thrift_read_field:
* @thft: The #FbThrift.
* @type: The return location for the #FbThriftType.
- * @id: The return location for the identifier or #NULL.
+ * @id: The return location for the identifier.
+ * @lastid: The identifier of the previous field.
*
* Reads a field header from the #FbThrift.
*
* Returns: #TRUE if the field header was read, otherwise #FALSE.
*/
gboolean
-fb_thrift_read_field(FbThrift *thft, FbThriftType *type, gint16 *id);
+fb_thrift_read_field(FbThrift *thft, FbThriftType *type, gint16 *id,
+ gint16 lastid);
/**
* fb_thrift_read_stop:
@@ -520,11 +522,13 @@ fb_thrift_write_str(FbThrift *thft, const gchar *value);
* @thft: The #FbThrift.
* @type: The #FbThriftType.
* @id: The identifier.
+ * @lastid: The identifier of the previous field.
*
* Writes a field header to the #FbThrift.
*/
void
-fb_thrift_write_field(FbThrift *thft, FbThriftType type, gint16 id);
+fb_thrift_write_field(FbThrift *thft, FbThriftType type, gint16 id,
+ gint16 lastid);
/**
* fb_thrift_write_stop: