ekiga r7142 - in trunk: . lib/engine lib/engine/components lib/engine/components/xcap



Author: jpuydt
Date: Thu Oct  2 13:06:15 2008
New Revision: 7142
URL: http://svn.gnome.org/viewvc/ekiga?rev=7142&view=rev

Log:
New XCAP code, based on libsoup.

Added:
   trunk/lib/engine/components/xcap/
   trunk/lib/engine/components/xcap/Makefile.am
   trunk/lib/engine/components/xcap/xcap-main.cpp
   trunk/lib/engine/components/xcap/xcap-main.h
   trunk/lib/engine/components/xcap/xcap.cpp
   trunk/lib/engine/components/xcap/xcap.h
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/lib/engine/Makefile.am
   trunk/lib/engine/components/Makefile.am
   trunk/lib/engine/engine.cpp

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu Oct  2 13:06:15 2008
@@ -602,6 +602,23 @@
 AM_CONDITIONAL(HAVE_KAB, test "x$found_kab" = "xyes")
 
 dnl ###############################
+dnl   XCAP support
+dnl ###############################
+XCAP="disabled"
+
+AC_ARG_ENABLE(xcap, [  --enable-xcap                Enable XCAP support],enable_xcap=yes,)
+
+if test "x$enable_xcap" = "xyes"; then
+   PKG_CHECK_MODULES([SOUP], [libsoup-2.4])
+   found_xcap="yes"
+   XCAP="enabled"
+   AC_SUBST(SOUP_CFLAGS)
+   AC_SUBST(SOUP_LIBS)
+fi
+
+AM_CONDITIONAL(HAVE_XCAP, test "x$found_xcap" = "xyes")
+
+dnl ###############################
 dnl   Gnome-Doc-Utils
 dnl ###############################
 GDU="disabled"
@@ -792,6 +809,7 @@
 lib/engine/components/avahi-publisher/Makefile
 lib/engine/components/gstreamer/Makefile
 lib/engine/components/kde/Makefile
+lib/engine/components/xcap/Makefile
 )
 
 
@@ -827,6 +845,7 @@
 echo "               GStreamer support  :  $GSTREAMER"
 echo "            KAddressBook support  :  $KAB"
 echo "                     KDE support  :  $KDE"
+echo "                    XCAP support  :  $XCAP"
 echo ""
 echo "                         OS Type  :  $target_os"
 echo "                    Machine Type  :  $target_cpu"

Modified: trunk/lib/engine/Makefile.am
==============================================================================
--- trunk/lib/engine/Makefile.am	(original)
+++ trunk/lib/engine/Makefile.am	Thu Oct  2 13:06:15 2008
@@ -27,7 +27,8 @@
 	-I$(top_srcdir)/lib/engine/components/gmconf-personal-details	\
 	-I$(top_srcdir)/lib/engine/components/avahi-publisher		\
 	-I$(top_srcdir)/lib/engine/components/gstreamer			\
-	-I$(top_srcdir)/lib/engine/components/kde
+	-I$(top_srcdir)/lib/engine/components/kde			\
+	-I$(top_srcdir)/lib/engine/components/xcap
 
 # XVideo/X
 if !WIN32
@@ -144,6 +145,10 @@
 libekiga_engine_la_LIBADD += addressbook/kab/libgmkab.la
 endif
 
+if HAVE_XCAP
+libekiga_engine_la_LIBADD += components/xcap/libgmxcap.la
+endif
+
 #### FIXME should be removed at a later stage
 INCLUDES += \
 	-I$(top_srcdir)/lib/gui/	                \

Modified: trunk/lib/engine/components/Makefile.am
==============================================================================
--- trunk/lib/engine/components/Makefile.am	(original)
+++ trunk/lib/engine/components/Makefile.am	Thu Oct  2 13:06:15 2008
@@ -10,4 +10,13 @@
 KDE_DIR = kde
 endif
 
-SUBDIRS = gmconf-personal-details $(AVAHI_DIR) $(GSTREAMER_DIR) $(KDE_DIR)
+if HAVE_XCAP
+XCAP_DIR = xcap
+endif
+
+SUBDIRS = \
+	gmconf-personal-details \
+	$(AVAHI_DIR) \
+	$(GSTREAMER_DIR) \
+	$(KDE_DIR) \
+	$(XCAP_DIR)
\ No newline at end of file

Added: trunk/lib/engine/components/xcap/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/lib/engine/components/xcap/Makefile.am	Thu Oct  2 13:06:15 2008
@@ -0,0 +1,16 @@
+noinst_LTLIBRARIES = libgmxcap.la
+
+xcap_dir = $(top_srcdir)/lib/engine/components/xcap/
+
+AM_CXXFLAGS = $(SIGC_CFLAGS) $(SOUP_CFLAGS)
+
+INCLUDES = 						\
+	-I$(top_srcdir)/lib/engine/framework
+
+libgmxcap_la_SOURCES = \
+	$(xcap_dir)/xcap.h \
+	$(xcap_dir)/xcap.cpp \
+	$(xcap_dir)/xcap-main.h \
+	$(xcap_dir)/xcap-main.cpp
+
+libgmxcap_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS) $(SOUP_LIBS)
\ No newline at end of file

Added: trunk/lib/engine/components/xcap/xcap-main.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/components/xcap/xcap-main.cpp	Thu Oct  2 13:06:15 2008
@@ -0,0 +1,49 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * 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.
+ */
+
+
+/*
+ *                         xcap-main.cpp  -  description
+ *                         ------------------------------------
+ *   begin                : Mon 29 September 2008
+ *   copyright            : (C) 2008 by Julien Puydt
+ *   description          : Code to hook the XCAP code to the engine
+ *
+ */
+
+#include "xcap-main.h"
+#include "xcap.h"
+
+bool
+xcap_init (Ekiga::ServiceCore& core)
+{
+  XCAP::Core* xcap = new XCAP::Core ();
+
+  core.add (*xcap);
+
+  return true;
+}

Added: trunk/lib/engine/components/xcap/xcap-main.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/components/xcap/xcap-main.h	Thu Oct  2 13:06:15 2008
@@ -0,0 +1,45 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * 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.
+ */
+
+
+/*
+ *                         xcap-main.h  -  description
+ *                         ------------------------------------
+ *   begin                : Mon 29 September 2008
+ *   copyright            : (C) 2008 by Julien Puydt
+ *   description          : Code to hook the XCAP code to the engine
+ *
+ */
+
+#ifndef __XCAP_MAIN_H__
+#define __XCAP_MAIN_H__
+
+#include "services.h"
+
+bool xcap_init (Ekiga::ServiceCore& core);
+
+#endif

Added: trunk/lib/engine/components/xcap/xcap.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/components/xcap/xcap.cpp	Thu Oct  2 13:06:15 2008
@@ -0,0 +1,137 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * 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.
+ */
+
+
+/*
+ *                         xcap.cpp  -  description
+ *                         ------------------------------------
+ *   begin                : Mon 29 September 2008
+ *   copyright            : (C) 2008 by Julien Puydt
+ *   description          : Implementation of the XCAP support code
+ *
+ */
+
+#include "config.h"
+
+#include "xcap.h"
+
+#include <libsoup/soup.h>
+
+/* declaration of XCAP::CoreImpl */
+
+class XCAP::CoreImpl
+{
+public:
+
+  CoreImpl ();
+
+  ~CoreImpl ();
+
+  void read (const std::string uri,
+	     sigc::slot<void,XCAP::Core::ResultType,std::string> callback);
+
+private:
+
+  SoupSession* session;
+};
+
+/* soup callback */
+
+struct cb_data
+{
+  sigc::slot<void,XCAP::Core::ResultType, std::string> callback;
+};
+
+static void
+soup_callback (G_GNUC_UNUSED SoupSession* session,
+	       SoupMessage* message,
+	       gpointer data)
+{
+  cb_data* cb = (cb_data*)data;
+
+  switch (message->status_code) {
+
+  case SOUP_STATUS_OK:
+
+    cb->callback (XCAP::Core::SUCCESS, message->response_body->data);
+    break;
+
+  default:
+
+    cb->callback (XCAP::Core::ERROR, _("Some error occured"));
+    break;
+  }
+
+  delete (cb_data*)data;
+}
+
+/* implementation of XCAP::CoreImpl */
+
+XCAP::CoreImpl::CoreImpl ()
+{
+  session = soup_session_async_new_with_options ("user-agent", "ekiga",
+						 NULL);
+}
+
+XCAP::CoreImpl::~CoreImpl ()
+{
+  g_object_unref (session);
+}
+
+void
+XCAP::CoreImpl::read (const std::string uri,
+		      sigc::slot<void, XCAP::Core::ResultType, std::string> callback)
+{
+  SoupMessage* message = NULL;
+  cb_data* data = NULL;
+
+  message = soup_message_new ("GET", uri.c_str ());
+  data = new cb_data;
+  data->callback = callback;
+
+  soup_session_queue_message (session, message,
+			      soup_callback, data);
+}
+
+
+/* XCAP::Core just pimples : */
+XCAP::Core::Core ()
+{
+  impl = new CoreImpl ();
+}
+
+XCAP::Core::~Core ()
+{
+  delete impl;
+}
+
+void
+XCAP::Core::read (const std::string uri,
+		  sigc::slot<void, XCAP::Core::ResultType,std::string> callback)
+{
+  impl->read (uri, callback);
+}

Added: trunk/lib/engine/components/xcap/xcap.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/components/xcap/xcap.h	Thu Oct  2 13:06:15 2008
@@ -0,0 +1,75 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * 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.
+ */
+
+
+/*
+ *                         xcap.h  -  description
+ *                         ------------------------------------
+ *   begin                : Mon 29 September 2008
+ *   copyright            : (C) 2008 by Julien Puydt
+ *   description          : Interface of the XCAP support code
+ *
+ */
+
+#ifndef __XCAP_H__
+#define __XCAP_H__
+
+#include "services.h"
+
+namespace XCAP
+{
+
+  class CoreImpl; // yes, I'm pimpling!
+
+  class Core: public Ekiga::Service
+  {
+  public:
+
+    Core ();
+
+    ~Core ();
+
+    typedef enum { SUCCESS, ERROR } ResultType;
+
+    void read (const std::string uri,
+	       sigc::slot<void,ResultType,std::string> callback);
+
+    /* implementation of the Ekiga::Service api */
+
+    const std::string get_name () const
+    { return "xcap-core"; }
+
+    const std::string get_description () const
+    { return "Service providing XCAP support"; }
+
+  private:
+
+    CoreImpl* impl;
+  };
+};
+
+#endif

Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp	(original)
+++ trunk/lib/engine/engine.cpp	Thu Oct  2 13:06:15 2008
@@ -105,6 +105,10 @@
 #include "kab-main.h"
 #endif
 
+#ifdef HAVE_XCAP
+#include "xcap-main.h"
+#endif
+
 void
 engine_init (int argc,
              char *argv [],
@@ -161,6 +165,10 @@
   }
 #endif
 
+#ifdef HAVE_XCAP
+  xcap_init (*core);
+#endif
+
 #ifdef HAVE_DX
   if (!videooutput_dx_init (*core, &argc, &argv)) {
     delete core;



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