aboutsummaryrefslogtreecommitdiffstats
path: root/facebook
diff options
context:
space:
mode:
Diffstat (limited to 'facebook')
-rw-r--r--facebook/Makefile.am1
-rw-r--r--facebook/facebook-api.h4
-rw-r--r--facebook/facebook-data.h3
-rw-r--r--facebook/facebook-glib.h51
-rw-r--r--facebook/facebook-http.h4
-rw-r--r--facebook/facebook-id.h4
-rw-r--r--facebook/facebook-json.h4
-rw-r--r--facebook/facebook-mqtt.c1
-rw-r--r--facebook/facebook-mqtt.h4
-rw-r--r--facebook/facebook-thrift.h3
-rw-r--r--facebook/facebook-util.c1
-rw-r--r--facebook/facebook-util.h3
12 files changed, 63 insertions, 20 deletions
diff --git a/facebook/Makefile.am b/facebook/Makefile.am
index bb154e5..779abbe 100644
--- a/facebook/Makefile.am
+++ b/facebook/Makefile.am
@@ -19,6 +19,7 @@ facebook_la_SOURCES = \
facebook-api.h \
facebook-data.c \
facebook-data.h \
+ facebook-glib.h \
facebook-http.c \
facebook-http.h \
facebook-id.h \
diff --git a/facebook/facebook-api.h b/facebook/facebook-api.h
index 0aedd6f..59b4829 100644
--- a/facebook/facebook-api.h
+++ b/facebook/facebook-api.h
@@ -27,9 +27,7 @@
* The API for interacting with the Facebook Messenger protocol.
*/
-#include <glib.h>
-#include <glib-object.h>
-
+#include "facebook-glib.h"
#include "facebook-http.h"
#include "facebook-id.h"
#include "facebook-mqtt.h"
diff --git a/facebook/facebook-data.h b/facebook/facebook-data.h
index 319481d..02da466 100644
--- a/facebook/facebook-data.h
+++ b/facebook/facebook-data.h
@@ -28,10 +28,9 @@
*/
#include <bitlbee.h>
-#include <glib.h>
-#include <glib-object.h>
#include "facebook-api.h"
+#include "facebook-glib.h"
#include "facebook-http.h"
#include "facebook-id.h"
diff --git a/facebook/facebook-glib.h b/facebook/facebook-glib.h
new file mode 100644
index 0000000..3e609ae
--- /dev/null
+++ b/facebook/facebook-glib.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2014-2015 James Geboski <jgeboski@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _FACEBOOK_GLIB_H_
+#define _FACEBOOK_GLIB_H_
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <glib/gprintf.h>
+#include <glib-object.h>
+
+#if !GLIB_CHECK_VERSION(2, 30, 0)
+#define G_VALUE_INIT {0, {{0}}}
+#endif /* 2.30.0 */
+
+#if !GLIB_CHECK_VERSION(2, 32, 0)
+static inline GByteArray *
+g_byte_array_new_take(guint8 *data, gsize len)
+{
+ GByteArray *bytes;
+
+ bytes = g_byte_array_new();
+ g_byte_array_append(bytes, data, len);
+ g_free(data);
+
+ return bytes;
+}
+
+static inline void
+g_queue_free_full(GQueue *queue, GDestroyNotify free_func)
+{
+ g_queue_foreach(queue, (GFunc) free_func, NULL);
+ g_queue_free(queue);
+}
+#endif /* 2.32.0 */
+
+#endif /* _FACEBOOK_GLIB_H_ */
diff --git a/facebook/facebook-http.h b/facebook/facebook-http.h
index ceccbfc..51c21ab 100644
--- a/facebook/facebook-http.h
+++ b/facebook/facebook-http.h
@@ -27,10 +27,10 @@
* The HTTP client.
*/
-#include <glib.h>
-#include <glib-object.h>
#include <http_client.h>
+#include "facebook-glib.h"
+
#define FB_TYPE_HTTP (fb_http_get_type())
#define FB_HTTP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FB_TYPE_HTTP, FbHttp))
#define FB_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), FB_TYPE_HTTP, FbHttpClass))
diff --git a/facebook/facebook-id.h b/facebook/facebook-id.h
index f357caa..92b1558 100644
--- a/facebook/facebook-id.h
+++ b/facebook/facebook-id.h
@@ -27,9 +27,7 @@
* The Facebook identifier utilities.
*/
-#include <glib.h>
-#include <glib/gprintf.h>
-
+#include "facebook-glib.h"
#include "facebook-util.h"
/**
diff --git a/facebook/facebook-json.h b/facebook/facebook-json.h
index ed74435..ba2ac85 100644
--- a/facebook/facebook-json.h
+++ b/facebook/facebook-json.h
@@ -27,10 +27,10 @@
* The JSON utilities.
*/
-#include <glib.h>
-#include <glib-object.h>
#include <json-glib/json-glib.h>
+#include "facebook-glib.h"
+
#define FB_TYPE_JSON_VALUES (fb_json_values_get_type())
#define FB_JSON_VALUES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FB_TYPE_JSON_VALUES, FbJsonValues))
#define FB_JSON_VALUES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), FB_TYPE_JSON_VALUES, FbJsonValuesClass))
diff --git a/facebook/facebook-mqtt.c b/facebook/facebook-mqtt.c
index 55fd177..a1cc50a 100644
--- a/facebook/facebook-mqtt.c
+++ b/facebook/facebook-mqtt.c
@@ -16,7 +16,6 @@
*/
#include <bitlbee.h>
-#include <glib/gprintf.h>
#include <ssl_client.h>
#include <stdarg.h>
#include <string.h>
diff --git a/facebook/facebook-mqtt.h b/facebook/facebook-mqtt.h
index ee42aa8..52bb9cf 100644
--- a/facebook/facebook-mqtt.h
+++ b/facebook/facebook-mqtt.h
@@ -27,10 +27,10 @@
* The MQTT connection.
*/
-#include <glib.h>
-#include <glib-object.h>
#include <string.h>
+#include "facebook-glib.h"
+
#define FB_TYPE_MQTT (fb_mqtt_get_type())
#define FB_MQTT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FB_TYPE_MQTT, FbMqtt))
#define FB_MQTT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), FB_TYPE_MQTT, FbMqttClass))
diff --git a/facebook/facebook-thrift.h b/facebook/facebook-thrift.h
index 98893d0..65257c4 100644
--- a/facebook/facebook-thrift.h
+++ b/facebook/facebook-thrift.h
@@ -27,8 +27,7 @@
* The Thrift reader/writer.
*/
-#include <glib.h>
-#include <glib-object.h>
+#include "facebook-glib.h"
#define FB_TYPE_THRIFT (fb_thrift_get_type())
#define FB_THRIFT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FB_TYPE_THRIFT, FbThrift))
diff --git a/facebook/facebook-util.c b/facebook/facebook-util.c
index 0fadc6e..5a6aa1b 100644
--- a/facebook/facebook-util.c
+++ b/facebook/facebook-util.c
@@ -16,7 +16,6 @@
*/
#include <bitlbee.h>
-#include <gio/gio.h>
#include <sha1.h>
#include <stdarg.h>
#include <string.h>
diff --git a/facebook/facebook-util.h b/facebook/facebook-util.h
index 82752a6..e0b870f 100644
--- a/facebook/facebook-util.h
+++ b/facebook/facebook-util.h
@@ -27,8 +27,7 @@
* The general utilities.
*/
-#include <glib.h>
-#include <glib-object.h>
+#include "facebook-glib.h"
/**
* FB_UTIL_ERROR: