Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ACLOCAL_AMFLAGS = -Im4
SUBDIRS = pidgin/libpurple/protocols/facebook
SUBDIRS = facebook

EXTRA_DIST = \
autogen.sh \
Expand Down
6 changes: 2 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,12 @@ AS_IF(
)]
)

PLUGIN_CFLAGS="-I`pwd`/$srcdir/include -I`pwd`/$srcdir/pidgin "
PLUGIN_CFLAGS="${PLUGIN_CFLAGS} -I`pwd`/$srcdir/pidgin/libpurple"
PLUGIN_CFLAGS="$PLUGIN_CFLAGS -DPURPLE_PLUGINS -include purple-compat.h"
PLUGIN_CFLAGS="-DPURPLE_PLUGINS"
AC_SUBST([PLUGIN_CFLAGS])

AM_CONDITIONAL([STATIC_FACEBOOK], false)
AC_SUBST([PLUGIN_LDFLAGS], [-avoid-version])
AC_SUBST([PURPLE_LIBS], ["$GLIB_LIBS $JSON_LIBS $PURPLE_LIBS $ZLIB_LIBS"])

AC_CONFIG_FILES([Makefile pidgin/libpurple/protocols/facebook/Makefile])
AC_CONFIG_FILES([Makefile facebook/Makefile])
AC_OUTPUT
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ FACEBOOKSOURCES = \
thrift.h \
util.c \
util.h \
../../glibcompat.h \
../../http.c \
../../http.h \
../../purple-socket.h \
../../purple-socket.c
glibcompat.h \
purple-http.c \
purple-http.h \
purple-socket.h \
purple-socket.c

CLEANFILES = \
marshal.c \
Expand Down Expand Up @@ -67,4 +67,5 @@ AM_CPPFLAGS = \
$(PURPLE_CFLAGS) \
$(ZLIB_CFLAGS) \
$(PLUGIN_CFLAGS) \
$(DEBUG_CFLAGS)
$(DEBUG_CFLAGS) \
-DGLIB_DISABLE_DEPRECATION_WARNINGS
File renamed without changes.
12 changes: 6 additions & 6 deletions pidgin/libpurple/protocols/facebook/api.c → facebook/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -3323,7 +3323,7 @@ fb_api_event_dup(const FbApiEvent *event, gboolean deep)
return g_new0(FbApiEvent, 1);
}

ret = g_memdup(event, sizeof *event);
ret = g_memdup2(event, sizeof *event);

if (deep) {
ret->text = g_strdup(event->text);
Expand Down Expand Up @@ -3362,7 +3362,7 @@ fb_api_message_dup(const FbApiMessage *msg, gboolean deep)
return g_new0(FbApiMessage, 1);
}

ret = g_memdup(msg, sizeof *msg);
ret = g_memdup2(msg, sizeof *msg);

if (deep) {
ret->text = g_strdup(msg->text);
Expand Down Expand Up @@ -3399,7 +3399,7 @@ fb_api_presence_dup(const FbApiPresence *pres)
return g_new0(FbApiPresence, 1);
}

return g_memdup(pres, sizeof *pres);
return g_memdup2(pres, sizeof *pres);
}

void
Expand Down Expand Up @@ -3428,7 +3428,7 @@ fb_api_thread_dup(const FbApiThread *thrd, gboolean deep)
return g_new0(FbApiThread, 1);
}

ret = g_memdup(thrd, sizeof *thrd);
ret = g_memdup2(thrd, sizeof *thrd);

if (deep) {
ret->users = NULL;
Expand Down Expand Up @@ -3475,7 +3475,7 @@ fb_api_typing_dup(const FbApiTyping *typg)
return g_new0(FbApiTyping, 1);
}

return g_memdup(typg, sizeof *typg);
return g_memdup2(typg, sizeof *typg);
}

void
Expand All @@ -3502,7 +3502,7 @@ fb_api_user_dup(const FbApiUser *user, gboolean deep)
return g_new0(FbApiUser, 1);
}

ret = g_memdup(user, sizeof *user);
ret = g_memdup2(user, sizeof *user);

if (deep) {
ret->name = g_strdup(user->name);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ fb_data_set_unread(FbData *fata, FbId id, gboolean unread)
return;
}

key = g_memdup(&id, sizeof id);
key = g_memdup2(&id, sizeof id);
g_hash_table_replace(priv->unread, key, GINT_TO_POINTER(unread));
}

Expand Down Expand Up @@ -523,7 +523,7 @@ fb_data_image_dup_image(FbDataImage *img, gsize *size)
return NULL;
}

return g_memdup(priv->image, priv->size);
return g_memdup2(priv->image, priv->size);
}

const gchar *
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,18 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/

#include "glibcompat.h"
#include "purple-compat.h"

#include "internal.h"

#include "account.h"
#include "accountopt.h"
#include "blistnode.h"
#include "buddy.h"
#include "buddyicon.h"
#include "buddylist.h"
#include "cmds.h"
#include "connection.h"
#include "conversation.h"
#include "conversations.h"
#include "conversationtypes.h"
#include "glibcompat.h"
#include "image.h"
#include "image-store.h"
#include "message.h"
#include "notify.h"
#include "plugins.h"
#include "presence.h"
#include "protocol.h"
#include "protocols.h"
#include "request.h"
#include "roomlist.h"
#include "server.h"
Expand Down Expand Up @@ -951,7 +941,7 @@ fb_blist_chat_create(GSList *buddies, gpointer data)
for (l = buddies; l != NULL; l = l->next) {
name = purple_buddy_get_name(l->data);
uid = FB_ID_FROM_STR(name);
did = g_memdup(&uid, sizeof uid);
did = g_memdup2(&uid, sizeof uid);
uids = g_slist_prepend(uids, did);
}

Expand Down
File renamed without changes.
79 changes: 79 additions & 0 deletions facebook/glibcompat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* pidgin
*
* Pidgin 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 _GLIBCOMPAT_H_
#define _GLIBCOMPAT_H_
/*
* SECTION:glibcompat
* @section_id: libpurple-glibcompat
* @short_description: <filename>glibcompat.h</filename>
* @title: GLib version-dependent definitions
*
* This file is internal to libpurple. Do not use!
* Also, any public API should not depend on this file.
*/

#include <glib.h>

/* glib's definition of g_stat+GStatBuf seems to be broken on mingw64-w32 (and
* possibly other 32-bit windows), so instead of relying on it,
* we'll define our own.
*/
#if defined(_WIN32) && !defined(_MSC_VER) && !defined(_WIN64)
# include <glib/gstdio.h>
typedef struct _stat GStatBufW32;
static inline int
purple_g_stat(const gchar *filename, GStatBufW32 *buf)
{
return g_stat(filename, (GStatBuf*)buf);
}
# define GStatBuf GStatBufW32
# define g_stat purple_g_stat
#endif

/******************************************************************************
* g_assert_* macros
*****************************************************************************/

#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;
}

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

#if !GLIB_CHECK_VERSION(2, 30, 0)
#define G_VALUE_INIT {0, {{0}}}
#endif

#endif /* _GLIBCOMPAT_H_ */
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include <glib.h>

#include <libpurple/http.h>
#include <purple-http.h>

/**
* FB_HTTP_ERROR:
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions include/internal.h → facebook/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
# include <unistd.h>
#endif

#include "connection.h"

void
_purple_socket_cancel_with_connection(PurpleConnection *gc);

Expand Down
File renamed without changes.
File renamed without changes.
Loading