ekiga r7223 - trunk/lib/engine/components/xcap
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7223 - trunk/lib/engine/components/xcap
- Date: Wed, 15 Oct 2008 12:48:12 +0000 (UTC)
Author: jpuydt
Date: Wed Oct 15 12:48:12 2008
New Revision: 7223
URL: http://svn.gnome.org/viewvc/ekiga?rev=7223&view=rev
Log:
Much improved XCAP implementation (but still read-only, and no real support for auth)
Added:
trunk/lib/engine/components/xcap/xcap-core.cpp
- copied, changed from r7222, /trunk/lib/engine/components/xcap/xcap.cpp
trunk/lib/engine/components/xcap/xcap-core.h
- copied, changed from r7222, /trunk/lib/engine/components/xcap/xcap.h
trunk/lib/engine/components/xcap/xcap-path.cpp
trunk/lib/engine/components/xcap/xcap-path.h
- copied, changed from r7222, /trunk/lib/engine/components/xcap/xcap.h
Removed:
trunk/lib/engine/components/xcap/xcap.cpp
trunk/lib/engine/components/xcap/xcap.h
Modified:
trunk/lib/engine/components/xcap/Makefile.am
trunk/lib/engine/components/xcap/xcap-main.cpp
Modified: trunk/lib/engine/components/xcap/Makefile.am
==============================================================================
--- trunk/lib/engine/components/xcap/Makefile.am (original)
+++ trunk/lib/engine/components/xcap/Makefile.am Wed Oct 15 12:48:12 2008
@@ -4,12 +4,15 @@
AM_CXXFLAGS = $(SIGC_CFLAGS) $(SOUP_CFLAGS)
-INCLUDES = \
+INCLUDES = \
+ -I$(top_srcdir)/lib/gmref \
-I$(top_srcdir)/lib/engine/framework
libgmxcap_la_SOURCES = \
- $(xcap_dir)/xcap.h \
- $(xcap_dir)/xcap.cpp \
+ $(xcap_dir)/xcap-path.h \
+ $(xcap_dir)/xcap-path.cpp \
+ $(xcap_dir)/xcap-core.h \
+ $(xcap_dir)/xcap-core.cpp \
$(xcap_dir)/xcap-main.h \
$(xcap_dir)/xcap-main.cpp
Copied: trunk/lib/engine/components/xcap/xcap-core.cpp (from r7222, /trunk/lib/engine/components/xcap/xcap.cpp)
==============================================================================
--- /trunk/lib/engine/components/xcap/xcap.cpp (original)
+++ trunk/lib/engine/components/xcap/xcap-core.cpp Wed Oct 15 12:48:12 2008
@@ -37,9 +37,10 @@
#include "config.h"
-#include "xcap.h"
+#include "xcap-core.h"
#include <libsoup/soup.h>
+#include <iostream>
/* declaration of XCAP::CoreImpl */
@@ -51,7 +52,7 @@
~CoreImpl ();
- void read (const std::string uri,
+ void read (gmref_ptr<XCAP::Path> path,
sigc::slot<void,XCAP::Core::ResultType,std::string> callback);
private:
@@ -82,7 +83,7 @@
default:
- cb->callback (XCAP::Core::ERROR, _("Some error occured"));
+ cb->callback (XCAP::Core::ERROR, message->reason_phrase);
break;
}
@@ -103,13 +104,13 @@
}
void
-XCAP::CoreImpl::read (const std::string uri,
+XCAP::CoreImpl::read (gmref_ptr<Path> path,
sigc::slot<void, XCAP::Core::ResultType, std::string> callback)
{
SoupMessage* message = NULL;
cb_data* data = NULL;
- message = soup_message_new ("GET", uri.c_str ());
+ message = soup_message_new ("GET", path->to_uri ().c_str ());
data = new cb_data;
data->callback = callback;
@@ -130,8 +131,9 @@
}
void
-XCAP::Core::read (const std::string uri,
+XCAP::Core::read (gmref_ptr<XCAP::Path> path,
sigc::slot<void, XCAP::Core::ResultType,std::string> callback)
{
- impl->read (uri, callback);
+ std::cout << "XCAP trying to read " << path->to_uri () << std::endl;
+ impl->read (path, callback);
}
Copied: trunk/lib/engine/components/xcap/xcap-core.h (from r7222, /trunk/lib/engine/components/xcap/xcap.h)
==============================================================================
--- /trunk/lib/engine/components/xcap/xcap.h (original)
+++ trunk/lib/engine/components/xcap/xcap-core.h Wed Oct 15 12:48:12 2008
@@ -27,7 +27,7 @@
/*
- * xcap.h - description
+ * xcap-core.h - description
* ------------------------------------
* begin : Mon 29 September 2008
* copyright : (C) 2008 by Julien Puydt
@@ -35,11 +35,13 @@
*
*/
-#ifndef __XCAP_H__
-#define __XCAP_H__
+#ifndef __XCAP_CORE_H__
+#define __XCAP_CORE_H__
#include "services.h"
+#include "xcap-path.h"
+
namespace XCAP
{
@@ -55,7 +57,7 @@
typedef enum { SUCCESS, ERROR } ResultType;
- void read (const std::string uri,
+ void read (gmref_ptr<Path>,
sigc::slot<void,ResultType,std::string> callback);
/* implementation of the Ekiga::Service api */
Modified: trunk/lib/engine/components/xcap/xcap-main.cpp
==============================================================================
--- trunk/lib/engine/components/xcap/xcap-main.cpp (original)
+++ trunk/lib/engine/components/xcap/xcap-main.cpp Wed Oct 15 12:48:12 2008
@@ -36,7 +36,7 @@
*/
#include "xcap-main.h"
-#include "xcap.h"
+#include "xcap-core.h"
bool
xcap_init (Ekiga::ServiceCore& core)
Added: trunk/lib/engine/components/xcap/xcap-path.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/components/xcap/xcap-path.cpp Wed Oct 15 12:48:12 2008
@@ -0,0 +1,123 @@
+
+/* 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-path.h - description
+ * ------------------------------------
+ * begin : Sun 12 October 2008
+ * copyright : (C) 2008 by Julien Puydt
+ * description : Interface of an XCAP path
+ *
+ */
+
+#include "xcap-path.h"
+
+#include <sstream>
+
+XCAP::Path::Path (std::string root_,
+ std::string application_,
+ std::string user_):
+ root(root_), application(application_), user(user_)
+{
+}
+
+XCAP::Path::~Path ()
+{}
+
+std::string
+XCAP::Path::to_uri () const
+{
+ std::string uri;
+
+ uri = root + "/" + application;
+
+ if ( !user.empty ())
+ uri = uri + "/users/" + user;
+ else
+ uri = uri + "/global";
+
+ uri = uri + "/index/~~" + relative;
+
+ return uri;
+}
+
+void
+XCAP::Path::set_credentials (std::string username_,
+ std::string password_)
+{
+ username = username_;
+ password = password_;
+}
+
+gmref_ptr<XCAP::Path>
+XCAP::Path::build_child (const std::string name)
+{
+ gmref_ptr<Path> result = new Path (root, application, user,
+ relative, username, password);
+ result->relative = relative + "/" + name;
+
+ return result;
+}
+
+gmref_ptr<XCAP::Path>
+XCAP::Path::build_child_with_attribute (const std::string name,
+ const std::string attr,
+ const std::string value)
+{
+ gmref_ptr<Path> result = new Path (root, application, user, relative,
+ username, password);
+ result->relative = relative + "/" + name +"[" + attr + "=\"" + value + "\"]";
+
+ return result;
+}
+
+gmref_ptr<XCAP::Path>
+XCAP::Path::build_child_with_position (const std::string name,
+ int position)
+{
+ std::ostringstream stream;
+ gmref_ptr<Path> result = new Path (root, application, user, relative,
+ username, password);
+
+ /* notice: Snark hates C++ */
+ stream << name << "[" << position << "]";
+ result->relative = relative + "/" + stream.str ();
+
+ return result;
+}
+
+XCAP::Path::Path (std::string root_,
+ std::string application_,
+ std::string user_,
+ std::string relative_,
+ std::string username_,
+ std::string password_):
+ root(root_), application(application_), user(user_), relative(relative_),
+ username(username_), password(password_)
+{
+}
Copied: trunk/lib/engine/components/xcap/xcap-path.h (from r7222, /trunk/lib/engine/components/xcap/xcap.h)
==============================================================================
--- /trunk/lib/engine/components/xcap/xcap.h (original)
+++ trunk/lib/engine/components/xcap/xcap-path.h Wed Oct 15 12:48:12 2008
@@ -27,48 +27,66 @@
/*
- * xcap.h - description
+ * xcap-path.h - description
* ------------------------------------
- * begin : Mon 29 September 2008
+ * begin : Sun 12 October 2008
* copyright : (C) 2008 by Julien Puydt
- * description : Interface of the XCAP support code
+ * description : Interface of an XCAP path
*
*/
-#ifndef __XCAP_H__
-#define __XCAP_H__
+#ifndef __XCAP_PATH_H__
+#define __XCAP_PATH_H__
-#include "services.h"
+#include "gmref.h"
+
+#include <string>
+#include <list>
namespace XCAP
{
-
- class CoreImpl; // yes, I'm pimpling!
-
- class Core: public Ekiga::Service
+ class Path: public GmRefCounted
{
public:
- Core ();
+ /* if user is empty, then it's global */
+ Path (std::string root,
+ std::string application,
+ std::string user);
- ~Core ();
+ ~Path ();
- typedef enum { SUCCESS, ERROR } ResultType;
+ std::string to_uri () const;
- void read (const std::string uri,
- sigc::slot<void,ResultType,std::string> callback);
+ /* this sets what you need to connect to the server */
+ void set_credentials (std::string username,
+ std::string password);
- /* implementation of the Ekiga::Service api */
+ gmref_ptr<Path> build_child (const std::string name);
- const std::string get_name () const
- { return "xcap-core"; }
+ gmref_ptr<Path> build_child_with_attribute (const std::string name,
+ const std::string attr,
+ const std::string value);
- const std::string get_description () const
- { return "Service providing XCAP support"; }
+ gmref_ptr<Path> build_child_with_position (const std::string name,
+ int position);
private:
- CoreImpl* impl;
+ Path (std::string root,
+ std::string application,
+ std::string user,
+ std::string relative,
+ std::string username,
+ std::string password);
+
+ std::string root;
+ std::string application;
+ std::string user;
+ std::string relative;
+
+ std::string username;
+ std::string password;
};
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]