/soc/2015/jgeboski/facebook: df6d420a48b7: facebook: added glib ...

James Geboski jgeboski at gmail.com
Tue Jun 23 17:16:15 EDT 2015


Changeset: df6d420a48b7f717fa3d7ba6f50d8c6db109b699
Author:	 James Geboski <jgeboski at gmail.com>
Date:	 2015-06-17 22:02 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/df6d420a48b7

Description:

facebook: added glib compatibility symbols

diffstat:

 libpurple/protocols/facebook/Makefile.am  |   1 +
 libpurple/protocols/facebook/api.h        |   3 +-
 libpurple/protocols/facebook/data.h       |   4 +-
 libpurple/protocols/facebook/facebook.h   |   3 +-
 libpurple/protocols/facebook/glibcompat.h |  51 +++++++++++++++++++++++++++++++
 libpurple/protocols/facebook/http.h       |   3 +-
 libpurple/protocols/facebook/json.h       |   3 +-
 libpurple/protocols/facebook/mqtt.h       |   4 +-
 libpurple/protocols/facebook/util.h       |   3 +-
 9 files changed, 62 insertions(+), 13 deletions(-)

diffs (168 lines):

diff --git a/libpurple/protocols/facebook/Makefile.am b/libpurple/protocols/facebook/Makefile.am
--- a/libpurple/protocols/facebook/Makefile.am
+++ b/libpurple/protocols/facebook/Makefile.am
@@ -13,6 +13,7 @@ FACEBOOKSOURCES = \
 	data.h \
 	facebook.h \
 	facebook.c \
+	glibcompat.h \
 	http.c \
 	http.h \
 	id.h \
diff --git a/libpurple/protocols/facebook/api.h b/libpurple/protocols/facebook/api.h
--- a/libpurple/protocols/facebook/api.h
+++ b/libpurple/protocols/facebook/api.h
@@ -24,8 +24,7 @@
 
 #include "internal.h"
 
-#include <glib.h>
-
+#include "glibcompat.h"
 #include "http.h"
 #include "id.h"
 #include "mqtt.h"
diff --git a/libpurple/protocols/facebook/data.h b/libpurple/protocols/facebook/data.h
--- a/libpurple/protocols/facebook/data.h
+++ b/libpurple/protocols/facebook/data.h
@@ -22,10 +22,8 @@
 #ifndef _FACEBOOK_DATA_H_
 #define _FACEBOOK_DATA_H_
 
-#include <glib.h>
-#include <glib-object.h>
-
 #include "connection.h"
+#include "glibcompat.h"
 
 #define FB_TYPE_DATA             (fb_data_get_type())
 #define FB_DATA(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), FB_TYPE_DATA, FbData))
diff --git a/libpurple/protocols/facebook/facebook.h b/libpurple/protocols/facebook/facebook.h
--- a/libpurple/protocols/facebook/facebook.h
+++ b/libpurple/protocols/facebook/facebook.h
@@ -22,8 +22,7 @@
 #ifndef _FACEBOOK_H_
 #define _FACEBOOK_H_
 
-#include <glib.h>
-
+#include "glibcompat.h"
 #include "protocol.h"
 
 #define FACEBOOK_TYPE_PROTOCOL             (facebook_protocol_get_type())
diff --git a/libpurple/protocols/facebook/glibcompat.h b/libpurple/protocols/facebook/glibcompat.h
new file mode 100644
--- /dev/null
+++ b/libpurple/protocols/facebook/glibcompat.h
@@ -0,0 +1,51 @@
+/* purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+
+#ifndef _FACEBOOK_GLIBCOMPAT_H_
+#define _FACEBOOK_GLIBCOMPAT_H_
+
+#include <glib.h>
+#include <glib-object.h>
+#include <libpurple/glibcompat.h>
+
+#if !GLIB_CHECK_VERSION(2, 32, 0)
+
+static inline GByteArray*
+g_byte_array_new_take(guint8 *data, gsize len)
+{
+	GByteArray *array;
+
+	array = g_byte_array_new();
+	g_byte_array_append(array, data, len);
+	g_free(data);
+
+	return array;
+}
+
+#if !GLIB_CHECK_VERSION(2, 30, 0)
+
+#define G_VALUE_INIT  {0, {{0}}}
+
+#endif /* < 2.30.0 */
+
+#endif /* < 2.32.0 */
+
+#endif /* _FACEBOOK_GLIBCOMPAT_H_ */
diff --git a/libpurple/protocols/facebook/http.h b/libpurple/protocols/facebook/http.h
--- a/libpurple/protocols/facebook/http.h
+++ b/libpurple/protocols/facebook/http.h
@@ -22,9 +22,10 @@
 #ifndef _FACEBOOK_HTTP_H_
 #define _FACEBOOK_HTTP_H_
 
-#include <glib.h>
 #include <libpurple/http.h>
 
+#include "glibcompat.h"
+
 #define FB_HTTP_ERROR fb_http_error_quark()
 
 typedef GHashTable FbHttpParams;
diff --git a/libpurple/protocols/facebook/json.h b/libpurple/protocols/facebook/json.h
--- a/libpurple/protocols/facebook/json.h
+++ b/libpurple/protocols/facebook/json.h
@@ -22,9 +22,10 @@
 #ifndef _FACEBOOK_JSON_H_
 #define _FACEBOOK_JSON_H_
 
-#include <glib.h>
 #include <json-glib/json-glib.h>
 
+#include "glibcompat.h"
+
 #define FB_JSON_ERROR fb_json_error_quark()
 
 typedef enum _FbJsonError FbJsonError;
diff --git a/libpurple/protocols/facebook/mqtt.h b/libpurple/protocols/facebook/mqtt.h
--- a/libpurple/protocols/facebook/mqtt.h
+++ b/libpurple/protocols/facebook/mqtt.h
@@ -22,10 +22,10 @@
 #ifndef _FACEBOOK_MQTT_H_
 #define _FACEBOOK_MQTT_H_
 
-#include <glib.h>
-#include <glib-object.h>
 #include <string.h>
 
+#include "glibcompat.h"
+
 #define FB_MQTT_NAME "MQIsdp"
 #define FB_MQTT_VERS 3
 #define FB_MQTT_KA   60
diff --git a/libpurple/protocols/facebook/util.h b/libpurple/protocols/facebook/util.h
--- a/libpurple/protocols/facebook/util.h
+++ b/libpurple/protocols/facebook/util.h
@@ -22,9 +22,8 @@
 #ifndef _FACEBOOK_UTIL_H_
 #define _FACEBOOK_UTIL_H_
 
-#include <glib.h>
-
 #include "connection.h"
+#include "glibcompat.h"
 
 typedef void (*FbUtilRequestBuddyFunc) (GSList *buddies, gpointer data);
 



More information about the Commits mailing list