/soc/2015/jgeboski/facebook: dfa58c08a4fd: facebook: initial pro...

James Geboski <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: dfa58c08a4fd4e35b06f303c70ab359ef7583790
Author:	 James Geboski <[email protected]>
Date:	 2015-05-30 02:28 -0400
Branch:	 facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/dfa58c08a4fd

Description:

facebook: initial protocol plugin

diffstat:

 COPYRIGHT                                   |    1 +
 configure.ac                                |    8 +-
 libpurple/protocols/Makefile.am             |    2 +-
 libpurple/protocols/Makefile.mingw          |    2 +-
 libpurple/protocols/facebook/Makefile.am    |   35 ++++++
 libpurple/protocols/facebook/Makefile.mingw |   79 +++++++++++++
 libpurple/protocols/facebook/facebook.c     |  161 ++++++++++++++++++++++++++++
 libpurple/protocols/facebook/facebook.h     |   52 +++++++++
 8 files changed, 336 insertions(+), 4 deletions(-)

diffs (truncated from 433 to 300 lines):

diff --git a/COPYRIGHT b/COPYRIGHT
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -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
--- a/configure.ac
+++ b/configure.ac
@@ -1422,7 +1422,7 @@ if test "x$STATIC_PRPLS" != "x" -a "x$DY
 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, 
 
 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
--- 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
--- 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
--- /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
--- /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
--- /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)
+{
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.