diff options
author | James Geboski <jgeboski@gmail.com> | 2015-05-30 02:28:55 -0400 |
---|---|---|
committer | James Geboski <jgeboski@gmail.com> | 2015-05-30 02:28:55 -0400 |
commit | fa89840952b21a98f47adb5031f98078d63b2b52 (patch) | |
tree | 197a2f574b9f28d2804aa42e6da9dd9d0cbea780 | |
parent | 3220ba8e0f804c509440e107f01a078a3fe3ae1f (diff) | |
download | pidgin-fa89840952b21a98f47adb5031f98078d63b2b52.tar.gz |
facebook: initial protocol plugin
-rw-r--r-- | COPYRIGHT | 1 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | libpurple/protocols/Makefile.am | 2 | ||||
-rw-r--r-- | libpurple/protocols/Makefile.mingw | 2 | ||||
-rw-r--r-- | libpurple/protocols/facebook/Makefile.am | 35 | ||||
-rw-r--r-- | libpurple/protocols/facebook/Makefile.mingw | 79 | ||||
-rw-r--r-- | libpurple/protocols/facebook/facebook.c | 161 | ||||
-rw-r--r-- | libpurple/protocols/facebook/facebook.h | 52 |
8 files changed, 336 insertions, 4 deletions
@@ -200,6 +200,7 @@ François Gagné Andrew Gaul Evgueni V. Gavrilov Ignacy Gawedzki +James Geboski Georgi Georgiev Brian Geppert Emanuele Giaquinta diff --git a/configure.ac b/configure.ac index 339a0cfbb0..e635c836b7 100644 --- a/configure.ac +++ b/configure.ac @@ -1422,7 +1422,7 @@ if test "x$STATIC_PRPLS" != "x" -a "x$DYNAMIC_PRPLS" = "xall"; then fi if test "x$STATIC_PRPLS" = "xall" ; then - STATIC_PRPLS="bonjour gg irc jabber msn mxit novell oscar sametime silc simple yahoo zephyr" + STATIC_PRPLS="bonjour facebook gg irc jabber msn mxit novell oscar sametime silc simple yahoo zephyr" fi if test "x$have_meanwhile" != "xyes" ; then STATIC_PRPLS=`echo $STATIC_PRPLS | $sedpath 's/sametime//'` @@ -1456,6 +1456,7 @@ for i in $STATIC_PRPLS ; do case $i in bonjour) static_bonjour=yes ;; + facebook) static_facebook=yes ;; gg) static_gg=yes ;; irc) static_irc=yes ;; jabber) static_jabber=yes ;; @@ -1474,6 +1475,7 @@ for i in $STATIC_PRPLS ; do esac done AM_CONDITIONAL(STATIC_BONJOUR, test "x$static_bonjour" = "xyes") +AM_CONDITIONAL(STATIC_FACEBOOK, test "x$static_facebook" = "xyes") AM_CONDITIONAL(STATIC_GG, test "x$static_gg" = "xyes") AM_CONDITIONAL(STATIC_IRC, test "x$static_irc" = "xyes") AM_CONDITIONAL(STATIC_JABBER, test "x$static_jabber" = "xyes") @@ -1494,7 +1496,7 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_UNLOAD, $extern_unload static void static_proto_ AC_ARG_WITH(dynamic_prpls, [AS_HELP_STRING([--with-dynamic-prpls], [specify which protocols to build dynamically])], [DYNAMIC_PRPLS=`echo $withval | $sedpath 's/,/ /g'`]) if test "x$DYNAMIC_PRPLS" = "xall" ; then - DYNAMIC_PRPLS="bonjour gg irc jabber msn mxit novell oscar sametime silc simple yahoo zephyr" + DYNAMIC_PRPLS="bonjour facebook gg irc jabber msn mxit novell oscar sametime silc simple yahoo zephyr" fi if test "x$have_meanwhile" != "xyes"; then DYNAMIC_PRPLS=`echo $DYNAMIC_PRPLS | $sedpath 's/sametime//'` @@ -1512,6 +1514,7 @@ AC_SUBST(DYNAMIC_PRPLS) for i in $DYNAMIC_PRPLS ; do case $i in bonjour) dynamic_bonjour=yes ;; + facebook) dynamic_facebook=yes ;; gg) dynamic_gg=yes ;; irc) dynamic_irc=yes ;; jabber) dynamic_jabber=yes ;; @@ -2760,6 +2763,7 @@ AC_CONFIG_FILES([Makefile libpurple/Makefile libpurple/protocols/Makefile libpurple/protocols/bonjour/Makefile + libpurple/protocols/facebook/Makefile libpurple/protocols/gg/Makefile libpurple/protocols/irc/Makefile libpurple/protocols/jabber/Makefile diff --git a/libpurple/protocols/Makefile.am b/libpurple/protocols/Makefile.am index 429db4e87f..4942cd6177 100644 --- a/libpurple/protocols/Makefile.am +++ b/libpurple/protocols/Makefile.am @@ -1,5 +1,5 @@ EXTRA_DIST = Makefile.mingw -DIST_SUBDIRS = bonjour gg irc jabber msn mxit novell null oscar sametime silc simple yahoo zephyr +DIST_SUBDIRS = bonjour facebook gg irc jabber msn mxit novell null oscar sametime silc simple yahoo zephyr SUBDIRS = $(DYNAMIC_PRPLS) $(STATIC_PRPLS) diff --git a/libpurple/protocols/Makefile.mingw b/libpurple/protocols/Makefile.mingw index f0871c3dc2..64c0d30aff 100644 --- a/libpurple/protocols/Makefile.mingw +++ b/libpurple/protocols/Makefile.mingw @@ -8,7 +8,7 @@ PIDGIN_TREE_TOP := ../.. include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak -SUBDIRS = gg irc jabber msn mxit novell null oscar sametime silc simple yahoo bonjour +SUBDIRS = gg irc jabber msn mxit novell null oscar sametime silc simple yahoo bonjour facebook .PHONY: all install clean diff --git a/libpurple/protocols/facebook/Makefile.am b/libpurple/protocols/facebook/Makefile.am new file mode 100644 index 0000000000..f6cfbe45f0 --- /dev/null +++ b/libpurple/protocols/facebook/Makefile.am @@ -0,0 +1,35 @@ +EXTRA_DIST = \ + Makefile.mingw + +pkgdir = @PURPLE_PLUGINDIR@ + +FACEBOOKSOURCES = \ + facebook.h \ + facebook.c + +AM_CFLAGS = $(st) + +libfacebook_la_LDFLAGS = -module @PLUGIN_LDFLAGS@ + +if STATIC_FACEBOOK + +st = -DPURPLE_STATIC_PRPL +noinst_LTLIBRARIES = libfacebook.la +libfacebook_la_SOURCES = $(FACEBOOKSOURCES) +libfacebook_la_CFLAGS = $(AM_CFLAGS) + +else + +st = +pkg_LTLIBRARIES = libfacebook.la +libfacebook_la_SOURCES = $(FACEBOOKSOURCES) +libfacebook_la_LIBADD = @PURPLE_LIBS@ + +endif + +AM_CPPFLAGS = \ + -I$(top_srcdir)/libpurple \ + -I$(top_builddir)/libpurple \ + $(GLIB_CFLAGS) \ + $(GPLUGIN_CFLAGS) \ + $(DEBUG_CFLAGS) diff --git a/libpurple/protocols/facebook/Makefile.mingw b/libpurple/protocols/facebook/Makefile.mingw new file mode 100644 index 0000000000..0f848e01e1 --- /dev/null +++ b/libpurple/protocols/facebook/Makefile.mingw @@ -0,0 +1,79 @@ +# +# Makefile.mingw +# +# Description: Makefile for win32 (mingw) version of libfacebook +# + +PIDGIN_TREE_TOP := ../../.. +include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak + +TARGET = libnovell +TYPE = PLUGIN + +# Static or Plugin... +ifeq ($(TYPE),STATIC) + DEFINES += -DSTATIC + DLL_INSTALL_DIR = $(PURPLE_INSTALL_DIR) +else +ifeq ($(TYPE),PLUGIN) + DLL_INSTALL_DIR = $(PURPLE_INSTALL_PLUGINS_DIR) +endif +endif + +## +## INCLUDE PATHS +## +INCLUDE_PATHS += -I. \ + -I$(GTK_TOP)/include \ + -I$(GTK_TOP)/include/glib-2.0 \ + -I$(GTK_TOP)/lib/glib-2.0/include \ + -I$(PURPLE_TOP) \ + -I$(PURPLE_TOP)/win32 \ + -I$(PIDGIN_TREE_TOP) + +LIB_PATHS += -L$(GTK_TOP)/lib \ + -L$(PURPLE_TOP) + +## +## SOURCES, OBJECTS +## +C_SRC = \ + facebook.c + +OBJECTS = $(C_SRC:%.c=%.o) + +## +## LIBRARIES +## +LIBS = \ + -lglib-2.0 \ + -lgobject-2.0 \ + -lws2_32 \ + -lintl \ + -lpurple + +include $(PIDGIN_COMMON_RULES) + +## +## TARGET DEFINITIONS +## +.PHONY: all install clean + +all: $(TARGET).dll + +install: all $(DLL_INSTALL_DIR) + cp $(TARGET).dll $(DLL_INSTALL_DIR) + +$(OBJECTS): $(PURPLE_CONFIG_H) + +$(TARGET).dll: $(PURPLE_DLL).a $(OBJECTS) + $(CC) -shared $(OBJECTS) $(LIB_PATHS) $(LIBS) $(DLL_LD_FLAGS) -o $(TARGET).dll + +## +## CLEAN RULES +## +clean: + rm -f $(OBJECTS) + rm -f $(TARGET).dll + +include $(PIDGIN_COMMON_TARGETS) diff --git a/libpurple/protocols/facebook/facebook.c b/libpurple/protocols/facebook/facebook.c new file mode 100644 index 0000000000..fde5638f7b --- /dev/null +++ b/libpurple/protocols/facebook/facebook.c @@ -0,0 +1,161 @@ +/* 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 + */ + +#include "internal.h" + +#include "account.h" +#include "connection.h" +#include "plugins.h" +#include "protocol.h" +#include "protocols.h" +#include "roomlist.h" +#include "version.h" + +#include "facebook.h" + +static PurpleProtocol *my_protocol = NULL; + +static void +fb_login(PurpleAccount *acct) +{ + +} + +static void +fb_close(PurpleConnection *gc) +{ + +} + +static GList * +fb_status_types(PurpleAccount *acct) +{ + return NULL; +} + +static const char * +fb_list_icon(PurpleAccount *account, PurpleBuddy *buddy) +{ + return "facebook"; +} + +static void +facebook_protocol_init(PurpleProtocol *protocol) +{ + protocol->id = "prpl-facebook"; + protocol->name = "Facebook"; +} + +static void +facebook_protocol_class_init(PurpleProtocolClass *klass) +{ + klass->login = fb_login; + klass->close = fb_close; + klass->status_types = fb_status_types; + klass->list_icon = fb_list_icon; +} + +static void +facebook_protocol_client_iface_init(PurpleProtocolClientIface *client_iface) +{ + +} + +static void +facebook_protocol_server_iface_init(PurpleProtocolServerIface *server_iface) +{ + +} + +static void +facebook_protocol_im_iface_init(PurpleProtocolIMIface *im_iface) +{ + +} + +static void +facebook_protocol_chat_iface_init(PurpleProtocolChatIface *chat_iface) +{ + +} + +static void +facebook_protocol_privacy_iface_init(PurpleProtocolPrivacyIface *privacy_iface) +{ + +} + +static void +facebook_protocol_roomlist_iface_init(PurpleProtocolRoomlistIface *roomlist_iface) +{ + +} + +PURPLE_DEFINE_TYPE_EXTENDED( + FacebookProtocol, facebook_protocol, PURPLE_TYPE_PROTOCOL, 0, + + PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CLIENT_IFACE, + facebook_protocol_client_iface_init) + PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_SERVER_IFACE, + facebook_protocol_server_iface_init) + PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_IM_IFACE, + facebook_protocol_im_iface_init) + PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_CHAT_IFACE, + facebook_protocol_chat_iface_init) + PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_PRIVACY_IFACE, + facebook_protocol_privacy_iface_init) + PURPLE_IMPLEMENT_INTERFACE_STATIC(PURPLE_TYPE_PROTOCOL_ROOMLIST_IFACE, + facebook_protocol_roomlist_iface_init) +); + +static PurplePluginInfo * +plugin_query(GError **error) +{ + return purple_plugin_info_new( + "id", "prpl-facebook", + "name", "Facebook Protocol", + "version", DISPLAY_VERSION, + "category", N_("Protocol"), + "summary", N_("Facebook Protocol Plugin"), + "description", N_("Facebook Protocol Plugin"), + "website", PURPLE_WEBSITE, + "abi-version", PURPLE_ABI_VERSION, + "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | + PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD, + NULL + ); +} + +static gboolean +plugin_load(PurplePlugin *plugin, GError **error) +{ + facebook_protocol_register_type(plugin); + my_protocol = purple_protocols_add(FACEBOOK_TYPE_PROTOCOL, error); + return my_protocol != NULL; +} + +static gboolean +plugin_unload(PurplePlugin *plugin, GError **error) +{ + return purple_protocols_remove(my_protocol, error); +} + +PURPLE_PLUGIN_INIT(facebook, plugin_query, plugin_load, plugin_unload); diff --git a/libpurple/protocols/facebook/facebook.h b/libpurple/protocols/facebook/facebook.h new file mode 100644 index 0000000000..0d3a624fb6 --- /dev/null +++ b/libpurple/protocols/facebook/facebook.h @@ -0,0 +1,52 @@ +/* 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_H_ +#define _FACEBOOK_H_ + +#include "protocol.h" + +#define FACEBOOK_TYPE_PROTOCOL (facebook_protocol_get_type()) +#define FACEBOOK_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FACEBOOK_TYPE_PROTOCOL, FacebookProtocol)) +#define FACEBOOK_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), FACEBOOK_TYPE_PROTOCOL, FacebookProtocolClass)) +#define FACEBOOK_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), FACEBOOK_TYPE_PROTOCOL)) +#define FACEBOOK_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), FACEBOOK_TYPE_PROTOCOL)) +#define FACEBOOK_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FACEBOOK_TYPE_PROTOCOL, FacebookProtocolClass)) + +typedef struct _FacebookProtocol FacebookProtocol; +typedef struct _FacebookProtocolClass FacebookProtocolClass; + +struct _FacebookProtocol +{ + PurpleProtocol parent; +}; + +struct _FacebookProtocolClass +{ + PurpleProtocolClass parent_class; +}; + +/** + * Returns the GType for the FacebookProtocol object. + */ +G_MODULE_EXPORT GType facebook_protocol_get_type(void); + +#endif /* _FACEBOOK_H_ */ |