ekiga r7565 - in trunk: . lib/engine lib/engine/plugin



Author: jpuydt
Date: Sat Jan 17 08:56:30 2009
New Revision: 7565
URL: http://svn.gnome.org/viewvc/ekiga?rev=7565&view=rev

Log:
Added a simple plugin loader -- only tries to load /tmp/hello.so for now

Added:
   trunk/lib/engine/plugin/
   trunk/lib/engine/plugin/Makefile.am
   trunk/lib/engine/plugin/plugin-core.cpp
   trunk/lib/engine/plugin/plugin-core.h
Modified:
   trunk/configure.ac
   trunk/lib/engine/Makefile.am
   trunk/lib/engine/engine.cpp

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Sat Jan 17 08:56:30 2009
@@ -761,6 +761,7 @@
 lib/engine/components/kab/Makefile
 lib/engine/chat/Makefile
 lib/engine/framework/Makefile
+lib/engine/plugin/Makefile
 lib/engine/presence/Makefile
 lib/engine/components/avahi/Makefile
 lib/engine/components/local-roster/Makefile

Modified: trunk/lib/engine/Makefile.am
==============================================================================
--- trunk/lib/engine/Makefile.am	(original)
+++ trunk/lib/engine/Makefile.am	Sat Jan 17 08:56:30 2009
@@ -1,4 +1,4 @@
-SUBDIRS = framework account addressbook presence chat gui protocol videooutput videoinput audioinput audiooutput hal components
+SUBDIRS = framework plugin account addressbook presence chat gui protocol videooutput videoinput audioinput audiooutput hal components
 
 noinst_LTLIBRARIES = libekiga_engine.la
 
@@ -8,14 +8,15 @@
 	-I$(top_srcdir)/lib/engine/gui/gtk-core				\
 	-I$(top_srcdir)/lib/engine/gui/gtk-frontend			\
 	-I$(top_srcdir)/lib/engine/framework/		 		\
-	-I$(top_srcdir)/lib/engine/chat				\
-	-I$(top_srcdir)/lib/engine/videooutput			\
+	-I$(top_srcdir)/lib/engine/chat					\
+	-I$(top_srcdir)/lib/engine/videooutput				\
 	-I$(top_srcdir)/lib/engine/videoinput/  			\
-	-I$(top_srcdir)/lib/engine/hal				\
+	-I$(top_srcdir)/lib/engine/hal					\
 	-I$(top_srcdir)/lib/engine/account				\
 	-I$(top_srcdir)/lib/engine/audioinput                           \
 	-I$(top_srcdir)/lib/engine/audiooutput                          \
 	-I$(top_srcdir)/lib/engine/addressbook				\
+	-I$(top_srcdir)/lib/engine/plugin				\
 	-I$(top_srcdir)/lib/engine/presence				\
 	-I$(top_srcdir)/lib/engine/protocol				\
 	-I$(top_srcdir)/lib/engine/components/gmconf-personal-details	\
@@ -74,13 +75,14 @@
 libekiga_engine_la_LIBADD = \
 	$(top_builddir)/lib/engine/gui/gtk-core/libgmgtk-core.la 					\
 	$(top_builddir)/lib/engine/gui/gtk-frontend/libgmgtk-frontend.la 				\
-	$(top_builddir)/lib/engine/chat/libgmchat.la 						\
+	$(top_builddir)/lib/engine/chat/libgmchat.la 							\
 	$(top_builddir)/lib/engine/protocol/libgmprotocol.la	 				        \
 	$(top_builddir)/lib/engine/framework/libgmframework.la 						\
 	$(top_builddir)/lib/engine/addressbook/libgmaddressbook.la 				        \
 	$(top_builddir)/lib/engine/components/call-history/libcall-history.la 				\
 	$(top_builddir)/lib/engine/account/libaccount.la 						\
 	$(top_builddir)/lib/engine/presence/libgmpresence.la 					        \
+	$(top_builddir)/lib/engine/plugin/libplugin.la							\
 	$(top_builddir)/lib/engine/components/local-roster/liblocal-roster.la 				\
 	$(top_builddir)/lib/engine/videooutput/libgmvideooutput.la					\
 	$(top_builddir)/lib/engine/videoinput/libgmvideoinput.la					\

Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp	(original)
+++ trunk/lib/engine/engine.cpp	Sat Jan 17 08:56:30 2009
@@ -42,6 +42,7 @@
 #include "services.h"
 #include "kickstart.h"
 
+#include "plugin-core.h"
 #include "presence-core.h"
 #include "account-core.h"
 #include "contact-core.h"
@@ -274,6 +275,8 @@
     return;
   }
 
+  plugin_init (kickstart);
+
   kickstart.kick (*service_core, &argc, &argv);
 
   videooutput_core->setup_conf_bridge();

Added: trunk/lib/engine/plugin/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/lib/engine/plugin/Makefile.am	Sat Jan 17 08:56:30 2009
@@ -0,0 +1,15 @@
+noinst_LTLIBRARIES = libplugin.la
+
+plugin_dir = $(top_srcdir)/lib/engine/plugin
+
+AM_CPPFLAGS = $(SIGC_CFLAGS) $(GLIB_CFLAGS)
+
+INCLUDES = \
+	-I$(top_srcdir)/lib/gmconf	 		\
+	-I$(top_srcdir)/lib/engine/framework
+
+libplugin_la_SOURCES = \
+	$(plugin_dir)/plugin-core.h			\
+	$(plugin_dir)/plugin-core.cpp
+
+libplugin_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(GLIB_LIBS)

Added: trunk/lib/engine/plugin/plugin-core.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/plugin/plugin-core.cpp	Sat Jan 17 08:56:30 2009
@@ -0,0 +1,83 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         plugin-core.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2009 by Julien Puydt
+ *   copyright            : (c) 2009 by Julien Puydt
+ *   description          : Implementation of the object responsible of plugin loads
+ *
+ */
+
+#include "plugin-core.h"
+
+#include <gmodule.h>
+#include <iostream>
+
+// Here is what a trivial plugin looks like :
+//
+// #include "kickstart.h"
+// #include <iostream>
+//
+// extern "C" void
+// ekiga_plugin_init (Ekiga::KickStart& /*kickstart*/)
+// {
+//   std::cout << "Hello!" << std::endl;
+// }
+//
+// which can be compiled with :
+// gcc -o hello.so hello.cpp -shared -export-dynamic -I$(PATH_TO_EKIGA_SOURCES)/lib/engine/framework `pkg-config --cflags sigc++-2.0`
+
+void
+plugin_init (Ekiga::KickStart& kickstart)
+{
+  std::cout << "Trying to load the hello plugin... ";
+
+  GModule* plugin = g_module_open ("/tmp/hello.so", G_MODULE_BIND_LOCAL);
+
+  if (plugin != 0) {
+
+    std::cout << "loaded... ";
+    gpointer init_func = NULL;
+
+    if (g_module_symbol (plugin, "ekiga_plugin_init", &init_func)) {
+
+      std::cout << "valid, running:" << std::endl;
+      g_module_make_resident (plugin);
+      ((void (*)(Ekiga::KickStart&))init_func) (kickstart);
+    } else {
+
+      std::cout << "invalid: " << g_module_error () << std::endl;
+      g_module_close (plugin);
+    }
+  } else {
+
+    std::cout << "failed to load the module" << std::endl;
+  }
+}

Added: trunk/lib/engine/plugin/plugin-core.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/plugin/plugin-core.h	Sat Jan 17 08:56:30 2009
@@ -0,0 +1,45 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix 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, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         plugin-core.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2009 by Julien Puydt
+ *   copyright            : (c) 2009 by Julien Puydt
+ *   description          : Interface to the object responsible of plugin loads
+ *
+ */
+
+#ifndef __PLUGIN_CORE_H__
+#define __PLUGIN_CORE_H__
+
+#include "kickstart.h"
+
+void plugin_init (Ekiga::KickStart& kickstart);
+
+#endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]