[telepathy-mission-control/master] Remove libmissioncontrol altogether
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Apr 2 11:03:58 PDT 2009
---
.gitignore | 3 -
configure.ac | 2 -
libmissioncontrol.pc.in | 13 -
libmissioncontrol/Makefile.am | 241 ---
libmissioncontrol/cli-nmc4.c | 111 --
libmissioncontrol/cli-nmc4.h | 58 -
libmissioncontrol/dbus-api.c | 26 -
libmissioncontrol/dbus-api.h | 40 -
libmissioncontrol/mc-account-cli.c | 363 ----
libmissioncontrol/mc-account-manager-proxy.c | 64 -
libmissioncontrol/mc-account-manager-proxy.h | 57 -
libmissioncontrol/mc-account-monitor-priv.h | 36 -
libmissioncontrol/mc-account-monitor.c | 468 -----
libmissioncontrol/mc-account-monitor.h | 72 -
libmissioncontrol/mc-account-priv.h | 57 -
libmissioncontrol/mc-account-proxy.c | 61 -
libmissioncontrol/mc-account-proxy.h | 58 -
libmissioncontrol/mc-account.c | 2062 --------------------
libmissioncontrol/mc-account.h | 197 --
libmissioncontrol/mc-manager-priv.h | 32 -
libmissioncontrol/mc-manager.c | 466 -----
libmissioncontrol/mc-manager.h | 84 -
libmissioncontrol/mc-profile.c | 1075 ----------
libmissioncontrol/mc-profile.h | 127 --
libmissioncontrol/mc-protocol-priv.h | 32 -
libmissioncontrol/mc-protocol.c | 372 ----
libmissioncontrol/mc-protocol.h | 105 -
libmissioncontrol/mc-remap.h | 159 --
libmissioncontrol/mc-signals-marshal.list | 1 -
libmissioncontrol/mc.c | 163 --
libmissioncontrol/mc.h | 56 -
.../mission-control-signals-marshal.list | 7 -
libmissioncontrol/mission-control.c | 1454 --------------
libmissioncontrol/mission-control.h | 251 ---
libmissioncontrol/svc-nmc4.h | 28 -
libmissioncontrol/test.c | 441 -----
test/mc-client.c | 84 -
37 files changed, 0 insertions(+), 8926 deletions(-)
delete mode 100644 libmissioncontrol.pc.in
delete mode 100644 libmissioncontrol/Makefile.am
delete mode 100644 libmissioncontrol/cli-nmc4.c
delete mode 100644 libmissioncontrol/cli-nmc4.h
delete mode 100644 libmissioncontrol/dbus-api.c
delete mode 100644 libmissioncontrol/dbus-api.h
delete mode 100644 libmissioncontrol/mc-account-cli.c
delete mode 100644 libmissioncontrol/mc-account-manager-proxy.c
delete mode 100644 libmissioncontrol/mc-account-manager-proxy.h
delete mode 100644 libmissioncontrol/mc-account-monitor-priv.h
delete mode 100644 libmissioncontrol/mc-account-monitor.c
delete mode 100644 libmissioncontrol/mc-account-monitor.h
delete mode 100644 libmissioncontrol/mc-account-priv.h
delete mode 100644 libmissioncontrol/mc-account-proxy.c
delete mode 100644 libmissioncontrol/mc-account-proxy.h
delete mode 100644 libmissioncontrol/mc-account.c
delete mode 100644 libmissioncontrol/mc-account.h
delete mode 100644 libmissioncontrol/mc-manager-priv.h
delete mode 100644 libmissioncontrol/mc-manager.c
delete mode 100644 libmissioncontrol/mc-manager.h
delete mode 100644 libmissioncontrol/mc-profile.c
delete mode 100644 libmissioncontrol/mc-profile.h
delete mode 100644 libmissioncontrol/mc-protocol-priv.h
delete mode 100644 libmissioncontrol/mc-protocol.c
delete mode 100644 libmissioncontrol/mc-protocol.h
delete mode 100644 libmissioncontrol/mc-remap.h
delete mode 100644 libmissioncontrol/mc-signals-marshal.list
delete mode 100644 libmissioncontrol/mc.c
delete mode 100644 libmissioncontrol/mc.h
delete mode 100644 libmissioncontrol/mission-control-signals-marshal.list
delete mode 100644 libmissioncontrol/mission-control.c
delete mode 100644 libmissioncontrol/mission-control.h
delete mode 100644 libmissioncontrol/svc-nmc4.h
delete mode 100644 libmissioncontrol/test.c
delete mode 100644 test/mc-client.c
diff --git a/.gitignore b/.gitignore
index 08cf095..eaf2bab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,9 +52,6 @@ install-sh
/lcov.info.tmp
libmcclient.pc
libmcclient/diff
-libmissioncontrol.pc
-libmissioncontrol/mc-account
-libmissioncontrol/test
libtool
ltmain.sh
m4/gtk-doc.m4
diff --git a/configure.ac b/configure.ac
index 2672bf2..3b0542a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -252,8 +252,6 @@ doc/reference/libmissioncontrol-server/Makefile \
examples/Makefile \
libmcclient.pc \
libmcclient/Makefile \
-libmissioncontrol.pc \
-libmissioncontrol/Makefile \
m4/Makefile \
mission-control.pc \
server/Makefile \
diff --git a/libmissioncontrol.pc.in b/libmissioncontrol.pc.in
deleted file mode 100644
index 9cb2f44..0000000
--- a/libmissioncontrol.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-profiles_dir=@PROFILES_DIR@
-
-Name: libmissioncontrol
-Description: Mission Control Client Library
-Requires: dbus-1 >= 0.50, libtelepathy >= 0.3.2, telepathy-glib >= 0.7.1
-Requires.private: gconf-2.0, dbus-glib-1, gmodule-2.0, gobject-2.0, glib-2.0
-Version: @VERSION@
-Libs: -L${libdir} -lmissioncontrol-client
-Cflags: -I${includedir}
diff --git a/libmissioncontrol/Makefile.am b/libmissioncontrol/Makefile.am
deleted file mode 100644
index a48297b..0000000
--- a/libmissioncontrol/Makefile.am
+++ /dev/null
@@ -1,241 +0,0 @@
-INCLUDES = \
- $(GCONF_CFLAGS) \
- $(LIBTELEPATHY_CFLAGS) \
- $(TELEPATHY_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(GMODULE_CFLAGS) \
- $(GLIB_CFLAGS) \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -DMC_DISABLE_DEPRECATED \
- -DLIBDIR="@libdir@" -DLIBVERSION="0"
-
-BUILT_SOURCES = \
- _gen/all.xml \
- _gen/nmc4.xml \
- mission-control-signals-marshal.c \
- mission-control-signals-marshal.h \
- mc-enum-types.c \
- mc-enum-types.h \
- mc-signals-marshal.c \
- mc-signals-marshal.h \
- mc-client-lib-gen.h \
- $(nodist_libmissioncontrol_client_la_SOURCES) \
- $(nodist_geninclude_HEADERS)
-
-CLEANFILES = $(BUILT_SOURCES) stamp-mc-enum-types.h
-
-lib_LTLIBRARIES = libmissioncontrol-client.la
-
-libmissioncontrol_client_la_SOURCES = \
- cli-nmc4.c \
- dbus-api.c \
- mc.c\
- mc-manager.c \
- mc-manager-priv.h \
- mc-protocol.c \
- mc-protocol-priv.h \
- mc-profile.c \
- mc-account.c \
- mc-account-proxy.c \
- mc-account-priv.h \
- mc-account-monitor.c \
- mc-account-monitor-priv.h \
- mc-account-manager-proxy.c \
- mc-signals-marshal.c \
- mc-enum-types.c \
- mission-control-signals-marshal.c \
- mission-control.c
-
-libmissioncontrol_client_includedir = $(includedir)/libmissioncontrol
-libmissioncontrol_client_include_HEADERS = \
- cli-nmc4.h \
- dbus-api.h \
- mc.h \
- mc-account.h \
- mc-account-proxy.h \
- mc-account-monitor.h \
- mc-account-manager-proxy.h \
- mc-enum-types.h \
- mc-profile.h \
- mc-protocol.h \
- mc-manager.h \
- mc-remap.h \
- mc-signals-marshal.h \
- mission-control-signals-marshal.h \
- mission-control.h \
- svc-nmc4.h
-
-genincludedir = $(libmissioncontrol_client_includedir)/_gen
-nodist_geninclude_HEADERS = \
- _gen/cli-Account.h \
- _gen/cli-Account_Interface_Avatar.h \
- _gen/cli-Account_Manager.h \
- _gen/cli-nmc4.h \
- _gen/enums.h \
- _gen/interfaces.h \
- _gen/gtypes.h \
- _gen/svc-nmc4.h
-
-nodist_libmissioncontrol_client_la_SOURCES = \
- _gen/cli-Account-body.h \
- _gen/cli-Account_Interface_Avatar-body.h \
- _gen/cli-Account_Manager-body.h \
- _gen/cli-nmc4-body.h \
- _gen/gtypes-body.h \
- _gen/interfaces-body.h \
- _gen/register-dbus-glib-marshallers-body.h \
- _gen/signals-marshal.c \
- _gen/signals-marshal.h \
- _gen/signals-marshal.list \
- _gen/svc-nmc4.c
-
-libmissioncontrol_client_la_LIBADD = \
- $(GCONF_LIBS) \
- $(LIBTELEPATHY_LIBS) \
- $(TELEPATHY_LIBS) \
- $(DBUS_LIBS) \
- $(GMODULE_LIBS) \
- $(GLIB_LIBS)
-
-libmissioncontrol_client_la_LDFLAGS = \
- -export-symbols-regex "^((mc_)|(omc_)|(mission_control_|m_cerror))" \
- -version-info "5":"0":"0"
-# the redundant quoting here is to prevent the libtool command line from
-# looking like an error message in an oddly named file
-
-mission_control_include = \
- mission-control-signals-marshal.h \
- mission-control.h
-
-mc-client-lib-gen.h: $(top_builddir)/xml/_gen/introspect-MissionControl.xml
- dbus-binding-tool --prefix=mc-client-lib --mode=glib-client $< > $@
-
-%-marshal.h: %-marshal.list Makefile.am
- echo "#include <libmissioncontrol/mc-remap.h>" > $*-marshal.h
- glib-genmarshal --header --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.h
-
-%-marshal.c: %-marshal.list Makefile.am
- echo "#include <libmissioncontrol/mc-remap.h>" > $*-marshal.c
- echo '#include "$*-marshal.h"' >> $*-marshal.c
- glib-genmarshal --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c
-
-mc-enum-types.h: stamp-mc-enum-types.h
- @true
-stamp-mc-enum-types.h: Makefile $(mission_control_include) mc-enum-types.c
- ( cd $(srcdir) && glib-mkenums \
- --fhead "#ifndef __MC_ENUM_TYPES_H__\n#define __MC_ENUM_TYPES_H__\n\n#include \"mission-control.h\"\n\nG_BEGIN_DECLS\n" \
- --fprod "/* enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name at _get_type (void) G_GNUC_CONST;\n#define MC_TYPE_ at ENUMSHORT@ (@enum_name at _get_type())\n" \
- --ftail "G_END_DECLS\n\n#endif /* __MC_ENUM_TYPES_H__ */" \
- $(mission_control_include) ) >> xgen-geth \
- && (cmp -s xgen-geth mc-enum-types.h || cp xgen-geth mc-enum-types.h ) \
- && rm -f xgen-geth \
- && echo timestamp > $(@F)
-
-mc-enum-types.c: Makefile $(mission_control_include)
- ( cd $(srcdir) && glib-mkenums \
- --fhead "#include \"mc-enum-types.h\"\n#define g_intern_static_string(s) (s)\n" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --ftail "\n#define __MC_ENUM_TYPES_C__\n" \
- --vhead "GType\n at enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G at Type@Value values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail " { 0, NULL, NULL }\n };\n etype = g_ at type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n }\n return etype;\n}\n" \
- $(mission_control_include) ) > xgen-getc \
- && cp xgen-getc mc-enum-types.c \
- && rm -f xgen-getc
-
-bin_PROGRAMS = mc-account
-mc_account_SOURCES = mc-account-cli.c
-mc_account_LDADD = libmissioncontrol-client.la
-noinst_PROGRAMS = test
-test_SOURCES = test.c
-test_LDADD = libmissioncontrol-client.la
-
-EXTRA_DIST = \
- $(libmissioncontrol_client_include_DATA) \
- mission-control-signals-marshal.list \
- mc-signals-marshal.list
-
-# ---- telepathy-glib-style code generation ----
-
-tools_dir = $(top_srcdir)/tools
-
-_gen/%.xml: $(top_srcdir)/xml/%.xml $(wildcard $(top_srcdir)/xml/*.xml)
- $(mkdir_p) _gen
- $(XSLTPROC) $(XSLTPROCFLAGS) --xinclude $(tools_dir)/identity.xsl \
- $< > $@
-
-# Generated files which can be done for all "classes" at once
-
-_gen/gtypes.h _gen/gtypes-body.h: _gen/all.xml \
- $(top_srcdir)/tools/glib-gtypes-generator.py
- $(PYTHON) $(top_srcdir)/tools/glib-gtypes-generator.py \
- $< _gen/gtypes mc
-
-_gen/signals-marshal.list: _gen/all.xml \
- $(tools_dir)/glib-signals-marshal-gen.py
- $(PYTHON) $(tools_dir)/glib-signals-marshal-gen.py $< > $@
-
-_gen/signals-marshal.h: _gen/signals-marshal.list
- $(GLIB_GENMARSHAL) --header --prefix=_mc_ext_marshal $< > $@
-
-_gen/signals-marshal.c: _gen/signals-marshal.list
- { echo '#include "_gen/signals-marshal.h"' && \
- $(GLIB_GENMARSHAL) --body --prefix=_mc_ext_marshal $<; } \
- > $@
-
-_gen/register-dbus-glib-marshallers-body.h: _gen/all.xml \
- $(tools_dir)/glib-client-marshaller-gen.py
- $(PYTHON) $(tools_dir)/glib-client-marshaller-gen.py $< \
- _mc_ext > $@
-
-_gen/enums.h: _gen/all.xml $(tools_dir)/c-constants-generator.xsl
- $(XSLTPROC) $(XSLTPROCFLAGS) \
- --stringparam mixed-case-prefix mc \
- $(tools_dir)/c-constants-generator.xsl \
- $< > $@
-
-_gen/interfaces.h: _gen/all.xml \
- $(tools_dir)/glib-interfaces-generator.xsl \
- $(tools_dir)/c-interfaces-generator.xsl
- $(XSLTPROC) $(XSLTPROCFLAGS) \
- --stringparam mixed-case-prefix mc \
- $(tools_dir)/glib-interfaces-generator.xsl \
- $< > $@
-
-_gen/interfaces-body.h: _gen/all.xml \
- $(tools_dir)/glib-interfaces-body-generator.xsl \
- $(tools_dir)/c-interfaces-generator.xsl
- $(XSLTPROC) $(XSLTPROCFLAGS) \
- --stringparam mixed-case-prefix mc \
- $(tools_dir)/glib-interfaces-body-generator.xsl \
- $< > $@
-
-
-# Generated files which must be generated per "class".
-# (Currently the only "class" is nmc4, but the new API will need "classes"
-# like account, account-manager, ...)
-
-_gen/%.xml: $(top_srcdir)/xml/%.xml $(wildcard $(top_srcdir)/xml/*.xml)
- $(mkdir_p) _gen
- $(XSLTPROC) $(XSLTPROCFLAGS) --xinclude $(tools_dir)/identity.xsl \
- $< > $@
-
-_gen/cli-%-body.h _gen/cli-%.h: _gen/%.xml \
- $(tools_dir)/glib-client-gen.py Makefile.am
- $(PYTHON) $(tools_dir)/glib-client-gen.py \
- --group=`echo $* | tr x- x_` \
- --iface-quark-prefix=MC_IFACE_QUARK \
- --generate-blocking \
- $< Mc_Cli _gen/cli-$*
-
-_gen/svc-%.c _gen/svc-%.h: _gen/%.xml \
- $(tools_dir)/glib-ginterface-gen.py Makefile.am
- $(PYTHON) $(tools_dir)/glib-ginterface-gen.py \
- --filename=_gen/svc-$* \
- --signal-marshal-prefix=_mc_ext \
- --include='<telepathy-glib/dbus.h>' \
- --include='"_gen/signals-marshal.h"' \
- --not-implemented-func='tp_dbus_g_method_return_not_implemented' \
- $< Mc_Svc_
diff --git a/libmissioncontrol/cli-nmc4.c b/libmissioncontrol/cli-nmc4.c
deleted file mode 100644
index 12f777c..0000000
--- a/libmissioncontrol/cli-nmc4.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * cli-nmc4.c - the Nokia Mission Control 4.x D-Bus interface (client side)
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libmissioncontrol/cli-nmc4.h"
-
-#include <telepathy-glib/proxy-subclass.h>
-
-#include "libmissioncontrol/mission-control.h"
-
-#include "libmissioncontrol/_gen/cli-nmc4-body.h"
-
-/**
- * SECTION:cli-nmc4
- * @title: McCliNMC4
- * @short_description: proxy object for the Nokia Mission Control 4.x D-Bus API
- *
- * This module provides a client-side proxy object for the NMC 4.x D-Bus API,
- * for use until the modular D-Bus API becomes available.
- *
- * Since: FIXME
- */
-
-/**
- * McCliNMC4Class:
- *
- * The class of a #McCliNMC4.
- *
- * Since: FIXME
- */
-struct _McCliNMC4Class {
- TpProxyClass parent_class;
- /*<private>*/
- gpointer priv;
-};
-
-/**
- * McCliNMC4:
- *
- * A proxy object for the Nokia Mission Control 4.x D-Bus API. This is a
- * subclass of #TpProxy.
- *
- * Since: FIXME
- */
-struct _McCliNMC4 {
- TpProxy parent;
- /*<private>*/
- gpointer priv;
-};
-
-G_DEFINE_TYPE (McCliNMC4,
- mc_cli_nmc4,
- TP_TYPE_PROXY);
-
-static void
-mc_cli_nmc4_init (McCliNMC4 *self)
-{
-}
-
-static void
-mc_cli_nmc4_class_init (McCliNMC4Class *klass)
-{
- GType type = MC_TYPE_CLI_NMC4;
- TpProxyClass *proxy_class = (TpProxyClass *) klass;
-
- /* the API is stateless, so we can keep the same proxy across restarts */
- proxy_class->must_have_unique_name = FALSE;
-
- proxy_class->interface = MC_IFACE_QUARK_NMC4;
- tp_proxy_or_subclass_hook_on_interface_add (type, mc_cli_nmc4_add_signals);
-
- tp_proxy_subclass_add_error_mapping (type, TP_ERROR_PREFIX, TP_ERRORS,
- TP_TYPE_ERROR);
-}
-
-/**
- * mc_cli_nmc4_new:
- * @dbus: a D-Bus daemon; may not be %NULL
- *
- * <!-- -->
- *
- * Returns: a new NMC 4.x proxy
- *
- * Since: FIXME
- */
-McCliNMC4 *
-mc_cli_nmc4_new (TpDBusDaemon *dbus)
-{
- return MC_CLI_NMC4 (g_object_new (MC_TYPE_CLI_NMC4,
- "dbus-daemon", dbus,
- "bus-name", MISSION_CONTROL_SERVICE,
- "object-path", MISSION_CONTROL_PATH,
- NULL));
-}
diff --git a/libmissioncontrol/cli-nmc4.h b/libmissioncontrol/cli-nmc4.h
deleted file mode 100644
index bbfa3b6..0000000
--- a/libmissioncontrol/cli-nmc4.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * cli-nmc4.h - the Nokia Mission Control 4.x D-Bus interface (client side)
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LIBMISSIONCONTROL_CLI_NMC4_H__
-#define __LIBMISSIONCONTROL_CLI_NMC4_H__
-
-#include <telepathy-glib/proxy.h>
-
-G_BEGIN_DECLS
-
-typedef struct _McCliNMC4 McCliNMC4;
-typedef struct _McCliNMC4Class McCliNMC4Class;
-typedef struct _McCliNMC4Private McCliNMC4Private;
-
-GType mc_cli_nmc4_get_type (void);
-
-#define MC_TYPE_CLI_NMC4 \
- (mc_cli_nmc4_get_type ())
-#define MC_CLI_NMC4(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), MC_TYPE_CLI_NMC4, \
- McCliNMC4))
-#define MC_CLI_NMC4_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), MC_TYPE_CLI_NMC4, \
- McCliNMC4Class))
-#define MC_IS_CLI_NMC4(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MC_TYPE_CLI_NMC4))
-#define MC_IS_CLI_NMC4_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), MC_TYPE_CLI_NMC4))
-#define MC_CLI_NMC4_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), MC_TYPE_CLI_NMC4, \
- McCliNokiaMC4Class))
-
-McCliNMC4 *mc_cli_nmc4_new (TpDBusDaemon *dbus);
-
-G_END_DECLS
-
-/* auto-generated stubs */
-#include <libmissioncontrol/_gen/cli-nmc4.h>
-
-#endif
diff --git a/libmissioncontrol/dbus-api.c b/libmissioncontrol/dbus-api.c
deleted file mode 100644
index f840916..0000000
--- a/libmissioncontrol/dbus-api.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * dbus-api.c - Mission Control D-Bus API strings, enums etc.
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <libmissioncontrol/dbus-api.h>
-
-/* auto-generated stubs */
-#include "_gen/gtypes-body.h"
-#include "_gen/interfaces-body.h"
diff --git a/libmissioncontrol/dbus-api.h b/libmissioncontrol/dbus-api.h
deleted file mode 100644
index 58d56a6..0000000
--- a/libmissioncontrol/dbus-api.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * dbus-api.h - Mission Control D-Bus API strings, enums etc.
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LIBMISSIONCONTROL_DBUS_API_H__
-#define __LIBMISSIONCONTROL_DBUS_API_H__
-
-#include <glib/gquark.h>
-#include <glib-object.h>
-#include <dbus/dbus-glib.h>
-
-
-#define MISSION_CONTROL_SERVICE "org.freedesktop.Telepathy.MissionControl"
-#define MISSION_CONTROL_IFACE "org.freedesktop.Telepathy.MissionControl"
-#define MISSION_CONTROL_PATH "/org/freedesktop/Telepathy/MissionControl"
-
-#include <libmissioncontrol/mc-remap.h>
-
-#include <libmissioncontrol/_gen/enums.h>
-#include <libmissioncontrol/_gen/gtypes.h>
-#include <libmissioncontrol/_gen/interfaces.h>
-
-#endif
diff --git a/libmissioncontrol/mc-account-cli.c b/libmissioncontrol/mc-account-cli.c
deleted file mode 100644
index 34fdacd..0000000
--- a/libmissioncontrol/mc-account-cli.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <libgen.h>
-
-#include <glib-object.h>
-#include "mc-account.h"
-
-static gchar *app_name;
-
-static void
-show_help (gchar * err)
-{
- if (err)
- printf ("Error: %s\n", err);
-
- printf ("Usage:\n"
- " %1$s list\n"
- " %1$s add <profile> <display name> [(int|bool|string):<key>=<value> ...]\n"
- " %1$s set <account name> (int|bool|string):<key>=<value> [...]\n"
- " %1$s display <account name> <display name>\n"
- " %1$s show <account name>\n"
- " %1$s enable <account name>\n"
- " %1$s disable <account name>\n"
- " %1$s delete <account name>\n",
- app_name);
-
- if (err)
- exit (-1);
- else
- exit (0);
-}
-
-static void
-on_params_foreach (const gchar * key, const GValue * value)
-{
- switch (G_VALUE_TYPE (value))
- {
- case G_TYPE_INT:
- printf (" (int) %s = %d\n", key, g_value_get_int (value));
- break;
- case G_TYPE_UINT:
- printf (" (int) %s = %d\n", key, g_value_get_uint (value));
- break;
- case G_TYPE_BOOLEAN:
- printf (" (bool) %s = %s\n", key,
- g_value_get_boolean (value) ? "true" : "false");
- break;
- case G_TYPE_STRING:
- printf (" (string) %s = %s\n", key, g_value_get_string (value));
- break;
- default:
- g_warning ("Unknown account setting type.");
- }
-}
-
-static gboolean
-set_account_param (McAccount *account, gchar *param_value)
-{
- gchar **strv_param_value = NULL;
- gchar **strv_type_key = NULL;
- const gchar *param, *type, *key, *value;
- gboolean ret = FALSE;
-
- if (!param_value)
- return FALSE;
-
- strv_param_value = g_strsplit (param_value, "=", -1);
- if (strv_param_value[0] == NULL ||
- strv_param_value[1] == NULL ||
- strv_param_value[2] != NULL)
- goto CLEANUP;
- param = strv_param_value[0];
- value = strv_param_value[1];
-
- strv_type_key = g_strsplit (param, ":", -1);
- if (strv_type_key[0] == NULL ||
- strv_type_key[1] == NULL ||
- strv_type_key[2] != NULL)
- goto CLEANUP;
- type = strv_type_key[0];
- key = strv_type_key[1];
-
- /* Set the key */
- if (strcmp (type, "int") == 0)
- {
- mc_account_set_param_int (account, key, atoi (value));
- ret = TRUE;
- }
- else if (strcmp (type, "bool") == 0)
- {
- mc_account_set_param_boolean (account, key, atoi (value));
- ret = TRUE;
- }
- else if (strcmp (type, "string") == 0)
- {
- mc_account_set_param_string (account, key, value);
- ret = TRUE;
- }
-CLEANUP:
- if (strv_param_value)
- g_strfreev (strv_param_value);
- if (strv_type_key)
- g_strfreev (strv_type_key);
- return ret;
-}
-
-int
-main (int argc, char **argv)
-{
- app_name = basename (argv[0]);
-
- if (argc < 2)
- show_help ("No command specified");
-
- g_type_init ();
- /* Command processing */
-
- if (strcmp (argv[1], "add") == 0)
- {
- /* Add */
- McProfile *profile;
- McAccount *account;
-
- if (argc < 4)
- show_help ("Invalid add command.");
-
- profile = mc_profile_lookup (argv[2]);
- if (profile == NULL)
- {
- printf ("Error: No such profile: %s\n", argv[2]);
- }
- else
- {
- account = mc_account_create (profile);
- if (account == NULL)
- {
- printf ("Error: Error creating account.\n");
- }
- else
- {
- const gchar *name;
- gint i;
- gboolean status = TRUE;
-
- mc_account_set_display_name (account, argv[3]);
- for (i = 4; i < argc; i++)
- {
- status = set_account_param (account, argv[i]);
- if (!status)
- break;
- }
- name = mc_account_get_unique_name (account);
- if (!status)
- {
- mc_account_delete (account);
- printf ("Account not added successfully: %s\n", name);
- show_help ("Invalid account paramenters");
- }
-
- /* we must iterate the main loop to get the "Valid" property */
- while (g_main_context_iteration (NULL, FALSE));
-
- if (!mc_account_is_complete (account))
- {
- mc_account_delete (account);
- printf ("Account not added successfully: %s\n", name);
- show_help ("Given account paramenters does not define a complete account");
- }
- printf ("Account added successfully: %s\n", name);
- g_object_unref (account);
- }
- g_object_unref (profile);
- }
- }
- else if (strcmp (argv[1], "delete") == 0)
- {
- /* Delete account */
- McAccount *account;
-
- if (argc != 3)
- show_help ("Invalid delete command.");
-
- account = mc_account_lookup (argv[2]);
- if (account == NULL)
- {
- printf ("Error: No such account: %s\n", argv[2]);
- }
- else
- {
- if (mc_account_delete (account))
- {
- printf ("Account %s deleted sucessfully.\n", argv[2]);
- }
- else
- {
- printf ("Error: Error deleting account: %s\n", argv[2]);
- }
- g_object_unref (account);
- }
- }
- else if (strcmp (argv[1], "list") == 0)
- {
- /* List accounts */
- GList *accounts, *tmp;
-
- if (argc != 2)
- show_help ("Invalid list command.");
-
- accounts = mc_accounts_list ();
- for (tmp = accounts; tmp != NULL; tmp = tmp->next)
- {
- McAccount *account;
-
- account = (McAccount *) tmp->data;
- printf ("%s (%s)\n",
- mc_account_get_unique_name (account),
- mc_account_get_display_name (account));
-
- }
- mc_accounts_list_free (accounts);
- }
- else if (strcmp (argv[1], "show") == 0)
- {
- /* Show account details */
- McAccount *account;
- GHashTable *params;
-
- if (argc != 3)
- show_help ("Invalid show command.");
-
- account = mc_account_lookup (argv[2]);
- if (account == NULL)
- {
- printf ("Error: No such account: %s\n", argv[2]);
- exit (1);
- }
-
- params = mc_account_get_params (account);
- if (params == NULL)
- {
- printf ("Error: Failed to retreive params: %s\n", argv[2]);
- }
- else
- {
- gboolean enabled;
-
- enabled = mc_account_is_enabled (account);
-
- printf (" Account: %s\n", argv[2]);
- printf ("Display Name: %s\n", mc_account_get_display_name (account));
- printf (" Enabled: %s\n\n", enabled ? "enabled" : "disabled");
- g_hash_table_foreach (params, (GHFunc) on_params_foreach, NULL);
-
- g_hash_table_destroy (params);
- }
- g_object_unref (account);
- }
- else if (strcmp (argv[1], "enable") == 0)
- {
- /* Enable account */
- McAccount *account;
-
- if (argc != 3)
- show_help ("Invalid enable command.");
-
- account = mc_account_lookup (argv[2]);
- if (account == NULL)
- {
- printf ("Error: No such account: %s\n", argv[2]);
- exit (-1);
- }
- mc_account_set_enabled (account, TRUE);
- g_object_unref (account);
- }
- else if (strcmp (argv[1], "disable") == 0)
- {
- /* Disable account */
- McAccount *account;
-
- if (argc != 3)
- show_help ("Invalid disable command.");
-
- account = mc_account_lookup (argv[2]);
- if (account == NULL)
- {
- printf ("Error: No such account: %s\n", argv[2]);
- exit (-1);
- }
- mc_account_set_enabled (account, FALSE);
- g_object_unref (account);
- }
- else if (strcmp (argv[1], "display") == 0)
- {
- /* Set display name */
- McAccount *account;
-
- if (argc != 4)
- show_help ("Invalid display command.");
-
- account = mc_account_lookup (argv[2]);
- if (account == NULL)
- {
- printf ("Error: No such account: %s\n", argv[2]);
- exit (-1);
- }
- mc_account_set_display_name (account, argv[3]);
- g_object_unref (account);
- }
- else if (strcmp (argv[1], "set") == 0)
- {
- /* Set account parameter */
- McAccount *account;
-
- if (argc != 4)
- show_help ("Invalid set command.");
-
- account = mc_account_lookup (argv[2]);
- if (!account)
- {
- printf ("Error: No such account: %s\n", argv[2]);
- exit (-1);
- }
- if (!set_account_param (account, argv[3]))
- {
- show_help ("Invalid set command.");
- }
- g_object_unref (account);
- }
- else if (strcmp (argv[1], "help") == 0 ||
- strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0)
- {
- show_help (NULL);
- }
- else
- {
- show_help ("Unknown command.");
- }
- return 0;
-}
diff --git a/libmissioncontrol/mc-account-manager-proxy.c b/libmissioncontrol/mc-account-manager-proxy.c
deleted file mode 100644
index d4f42e2..0000000
--- a/libmissioncontrol/mc-account-manager-proxy.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * mc-account_manager-manager-proxy.c - Subclass of TpProxy
- *
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mc-account-manager-proxy.h"
-#include <telepathy-glib/proxy-subclass.h>
-#include <telepathy-glib/errors.h>
-#include "_gen/interfaces.h"
-#include "_gen/signals-marshal.h"
-
-/* auto-generated stub code */
-
-static void _mc_ext_register_dbus_glib_marshallers (void);
-#include "_gen/register-dbus-glib-marshallers-body.h"
-#include "_gen/cli-Account_Manager-body.h"
-
-struct _McAccountManagerProxyClass {
- TpProxyClass parent_class;
-};
-
-struct _McAccountManagerProxy {
- TpProxy parent;
-};
-
-G_DEFINE_TYPE (McAccountManagerProxy, mc_account_manager_proxy, TP_TYPE_PROXY);
-
-static void
-mc_account_manager_proxy_init (McAccountManagerProxy *self)
-{
-}
-
-static void
-mc_account_manager_proxy_class_init (McAccountManagerProxyClass *klass)
-{
- GType type = MC_TYPE_ACCOUNT_MANAGER_PROXY;
- TpProxyClass *proxy_class = (TpProxyClass *) klass;
-
- /* the API is stateless, so we can keep the same proxy across restarts */
- proxy_class->must_have_unique_name = FALSE;
-
- proxy_class->interface = MC_IFACE_QUARK_ACCOUNT_MANAGER;
- _mc_ext_register_dbus_glib_marshallers ();
- tp_proxy_or_subclass_hook_on_interface_add (type, mc_cli_Account_Manager_add_signals);
-
- tp_proxy_subclass_add_error_mapping (type, TP_ERROR_PREFIX, TP_ERRORS,
- TP_TYPE_ERROR);
-}
-
diff --git a/libmissioncontrol/mc-account-manager-proxy.h b/libmissioncontrol/mc-account-manager-proxy.h
deleted file mode 100644
index 2441557..0000000
--- a/libmissioncontrol/mc-account-manager-proxy.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * mc-account-manager-proxy.h - Subclass of TpProxy
- *
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LIBMISSIONCONTROL_ACCOUNT_MANAGER_PROXY_H__
-#define __LIBMISSIONCONTROL_ACCOUNT_MANAGER_PROXY_H__
-
-#include <telepathy-glib/proxy.h>
-#include <libmissioncontrol/mc-remap.h>
-
-G_BEGIN_DECLS
-
-typedef struct _McAccountManagerProxy McAccountManagerProxy;
-typedef struct _McAccountManagerProxyClass McAccountManagerProxyClass;
-typedef struct _McAccountManagerProxyPrivate McAccountManagerProxyPrivate;
-
-GType mc_account_manager_proxy_get_type (void);
-
-#define MC_TYPE_ACCOUNT_MANAGER_PROXY \
- (mc_account_manager_proxy_get_type ())
-#define MC_ACCOUNT_MANAGER_PROXY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), MC_TYPE_ACCOUNT_MANAGER_PROXY, \
- McAccountManagerProxy))
-#define MC_ACCOUNT_MANAGER_PROXY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), MC_TYPE_ACCOUNT_MANAGER_PROXY, \
- McAccountManagerProxyClass))
-#define MC_IS_ACCOUNT_MANAGER_PROXY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MC_TYPE_ACCOUNT_MANAGER_PROXY))
-#define MC_IS_ACCOUNT_MANAGER_PROXY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), MC_TYPE_ACCOUNT_MANAGER_PROXY))
-#define MC_ACCOUNT_MANAGER_PROXY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), MC_TYPE_ACCOUNT_MANAGER_PROXY, \
- McAccountManagerProxyClass))
-
-
-G_END_DECLS
-
-/* auto-generated stubs */
-#include <libmissioncontrol/_gen/cli-Account_Manager.h>
-
-#endif
diff --git a/libmissioncontrol/mc-account-monitor-priv.h b/libmissioncontrol/mc-account-monitor-priv.h
deleted file mode 100644
index 3e3c42d..0000000
--- a/libmissioncontrol/mc-account-monitor-priv.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_ACCOUNT_MONITOR_PRIV_H__
-#define __MC_ACCOUNT_MONITOR_PRIV_H__
-
-McAccount * _mc_account_monitor_lookup (McAccountMonitor *monitor, const gchar *unique_name);
-GList * _mc_account_monitor_list (McAccountMonitor *monitor);
-McAccount *_mc_account_monitor_create_account (McAccountMonitor *monitor,
- const gchar *manager,
- const gchar *protocol,
- const gchar *display_name,
- GHashTable *parameters);
-
-#endif /* __MC_ACCOUNT_MONITOR_PRIV_H__ */
-
diff --git a/libmissioncontrol/mc-account-monitor.c b/libmissioncontrol/mc-account-monitor.c
deleted file mode 100644
index 67f45e4..0000000
--- a/libmissioncontrol/mc-account-monitor.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <string.h>
-#include <strings.h>
-
-#include <telepathy-glib/proxy.h>
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/svc-generic.h>
-#include "_gen/interfaces.h"
-#include <gconf/gconf-client.h>
-
-#include "mc-account.h"
-#include "mc-account-priv.h"
-#include "mc-account-monitor.h"
-#include "mc-account-monitor-priv.h"
-#include "mc-account-manager-proxy.h"
-#include "mc-signals-marshal.h"
-#include "mc.h"
-
-G_DEFINE_TYPE (McAccountMonitor, mc_account_monitor, G_TYPE_OBJECT);
-
-#define MC_ACCOUNT_MONITOR_PRIV(monitor) \
- ((McAccountMonitorPrivate *)monitor->priv)
-
-enum
-{
- SIGNAL_CREATED,
- SIGNAL_DELETED,
- SIGNAL_ENABLED,
- SIGNAL_DISABLED,
- SIGNAL_CHANGED,
- PARAM_CHANGED,
- NUM_SIGNALS
-};
-
-static guint signals[NUM_SIGNALS];
-
-typedef struct
-{
- TpProxy *proxy;
- GHashTable *accounts;
-} McAccountMonitorPrivate;
-
-static void
-mc_account_monitor_finalize (GObject *object)
-{
- McAccountMonitor *self = MC_ACCOUNT_MONITOR (object);
- McAccountMonitorPrivate *priv = MC_ACCOUNT_MONITOR_PRIV (self);
-
- g_hash_table_destroy (priv->accounts);
-}
-
-static void
-mc_account_monitor_class_init (McAccountMonitorClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (McAccountMonitorPrivate));
- object_class->finalize = mc_account_monitor_finalize;
-
- /**
- * McAccountMonitor::account-created:
- * @self: The #McAccountMonitor.
- * @name: The name of the account being created (use mc_account_lookup() to
- * retrieve the account object).
- *
- * Emitted when a new account is created.
- */
- signals[SIGNAL_CREATED] = g_signal_new (
- "account-created",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
- /**
- * McAccountMonitor::account-deleted:
- * @self: The #McAccountMonitor.
- * @name: The name of the account being deleted (use mc_account_lookup() to
- * retrieve the account object).
- *
- * Emitted when an account is deleted.
- */
- signals[SIGNAL_DELETED] = g_signal_new (
- "account-deleted",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
- /**
- * McAccountMonitor::account-enabled:
- * @self: The #McAccountMonitor.
- * @name: The name of the account being enabled (use mc_account_lookup() to
- * retrieve the account object).
- *
- * Emitted when an account is enabled.
- */
- signals[SIGNAL_ENABLED] = g_signal_new (
- "account-enabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
- /**
- * McAccountMonitor::account-disabled:
- * @self: The #McAccountMonitor.
- * @name: The name of the account being disabled (use mc_account_lookup() to
- * retrieve the account object).
- *
- * Emitted when an account is disabled.
- */
- signals[SIGNAL_DISABLED] = g_signal_new (
- "account-disabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
- /**
- * McAccountMonitor::account-changed:
- * @self: The #McAccountMonitor.
- * @name: The name of the account being changed (use mc_account_lookup() to
- * retrieve the account object).
- *
- * Emitted when an account is changed.
- */
- signals[SIGNAL_CHANGED] = g_signal_new (
- "account-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
- /**
- * McAccountMonitor::param-changed:
- * @self: The #McAccountMonitor.
- * @name: The name of the account being changed (use mc_account_lookup() to
- * retrieve the account object).
- * @param: The name of the parameter which changed.
- *
- * NOTE: this signal is no longer emitted in this version.
- */
- signals[PARAM_CHANGED] = g_signal_new (
- "param-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- mc_signals_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2,
- G_TYPE_STRING, G_TYPE_STRING);
-}
-
-static void
-on_account_removed (TpProxy *proxy, const gchar *object_path,
- gpointer user_data, GObject *weak_object)
-{
- McAccountMonitor *monitor = MC_ACCOUNT_MONITOR (weak_object);
- McAccountMonitorPrivate *priv = user_data;
- const gchar *name;
- McAccount *account;
-
- name = MC_ACCOUNT_UNIQUE_NAME_FROM_PATH (object_path);
-
- account = g_hash_table_lookup (priv->accounts, name);
- if (account)
- {
- if (mc_account_is_enabled (account))
- {
- _mc_account_set_enabled_priv (account, FALSE);
- g_signal_emit (monitor, signals[SIGNAL_DISABLED], 0, name);
- }
- g_signal_emit (monitor, signals[SIGNAL_DELETED], 0, name);
- g_hash_table_remove (priv->accounts, name);
- }
-}
-
-static void
-on_account_validity_changed (TpProxy *proxy, const gchar *object_path,
- gboolean valid, gpointer user_data,
- GObject *weak_object)
-{
- McAccountMonitor *monitor = MC_ACCOUNT_MONITOR (weak_object);
- McAccountMonitorPrivate *priv = user_data;
- const gchar *name;
- McAccount *account;
-
- name = MC_ACCOUNT_UNIQUE_NAME_FROM_PATH (object_path);
-
- account = g_hash_table_lookup (priv->accounts, name);
- if (account)
- {
- /* the old implementation didn't report signals for account
- * completeness, and for account deletion we have another signal; so,
- * we have nothing to do here */
- }
- else if (valid)
- {
- account = _mc_account_new (priv->proxy->dbus_daemon, object_path);
- g_hash_table_insert (priv->accounts, g_strdup (name), account);
- g_signal_emit (monitor, signals[SIGNAL_CREATED], 0, name);
-
- /* check if the account is enabled and, in case, emit the respective
- * signal */
- if (mc_account_is_enabled (account))
- {
- g_signal_emit (monitor, signals[SIGNAL_ENABLED], 0, name);
- }
- }
-}
-
-static void
-mc_account_monitor_init (McAccountMonitor *self)
-{
- GType ao_type;
- GError *error = NULL;
- McAccountMonitorPrivate *priv;
- TpDBusDaemon *dbus_daemon;
- DBusGConnection *connection;
- GValue *val_accounts;
- GPtrArray *accounts;
- guint i;
-
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
- MC_TYPE_ACCOUNT_MONITOR, McAccountMonitorPrivate);
- priv = MC_ACCOUNT_MONITOR_PRIV (self);
- connection = dbus_g_bus_get (DBUS_BUS_STARTER, &error);
- if (error)
- {
- g_printerr ("Failed to open connection to bus: %s", error->message);
- g_error_free (error);
- return;
- }
-
- ao_type = dbus_g_type_get_collection ("GPtrArray",
- DBUS_TYPE_G_OBJECT_PATH);
-
- dbus_daemon = tp_dbus_daemon_new (connection);
- priv->proxy = g_object_new (MC_TYPE_ACCOUNT_MANAGER_PROXY,
- "dbus-daemon", dbus_daemon,
- "bus-name", MC_ACCOUNT_MANAGER_DBUS_SERVICE,
- "object-path", MC_ACCOUNT_MANAGER_DBUS_OBJECT,
- NULL);
- g_assert (priv->proxy != NULL);
- priv->accounts = NULL;
-
- if (NULL != error)
- {
- g_print ("Error: %s\n", error->message);
- g_assert_not_reached ();
- }
-
- priv->accounts = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- g_object_unref);
-
- mc_cli_dbus_properties_do_get (priv->proxy, -1,
- MC_IFACE_ACCOUNT_MANAGER, "ValidAccounts",
- &val_accounts, &error);
- if (error)
- {
- g_warning ("Error getting accounts: %s", error->message);
- g_error_free (error);
- error = NULL;
- return;
- }
- if (!G_VALUE_HOLDS (val_accounts, ao_type))
- {
- g_warning ("ValidAccounts did not have D-Bus type 'ao': %s",
- G_VALUE_TYPE_NAME (val_accounts));
- g_value_unset (val_accounts);
- g_free (val_accounts);
- return;
- }
- accounts = g_value_get_boxed (val_accounts);
-
- for (i = 0; i < accounts->len; i++)
- {
- const gchar *object_path = g_ptr_array_index (accounts, i);
- McAccount *account;
- const gchar *unique_name;
-
- account = _mc_account_new (dbus_daemon, object_path);
- unique_name = MC_ACCOUNT_UNIQUE_NAME_FROM_PATH (object_path);
- g_hash_table_insert (priv->accounts, g_strdup (unique_name), account);
- }
- g_value_unset (val_accounts);
- g_free (val_accounts);
-
- mc_cli_account_manager_connect_to_account_removed (priv->proxy,
- on_account_removed,
- priv, NULL,
- (GObject *)self, NULL);
- mc_cli_account_manager_connect_to_account_validity_changed (priv->proxy,
- on_account_validity_changed,
- priv, NULL,
- (GObject *)self, NULL);
-}
-
-McAccount *
-_mc_account_monitor_lookup (McAccountMonitor *monitor, const gchar *unique_name)
-{
- McAccountMonitorPrivate *priv = MC_ACCOUNT_MONITOR_PRIV (monitor);
- McAccount *ret;
-
- g_return_val_if_fail (unique_name != NULL, NULL);
- g_return_val_if_fail (*unique_name != '\0', NULL);
-
- ret = g_hash_table_lookup (priv->accounts, unique_name);
-
- if (NULL != ret)
- g_object_ref (ret);
-
- return ret;
-}
-
-/**
- * mc_account_monitor_new:
- *
- * Get a #McAccountMonitor object. The object is a singleton: it is created
- * only if another instance of itself is not alive, otherwise the same instance
- * is returned.
- *
- * Returns: the #McAccountMonitor object.
- */
-McAccountMonitor *
-mc_account_monitor_new (void)
-{
- static McAccountMonitor *monitor = NULL;
-
- if (NULL == monitor)
- {
- monitor = g_object_new (MC_TYPE_ACCOUNT_MONITOR, NULL);
- g_object_add_weak_pointer (G_OBJECT (monitor), (gpointer) &monitor);
- }
- /* The object is never to be disposed, or mc_account_lookup() might return
- * different objects at each invocation. */
- g_object_ref (monitor);
- return monitor;
-}
-
-static void
-_list_append (gpointer key, gpointer value, gpointer user_data)
-{
- GList **list = (GList **) user_data;
-
- *list = g_list_prepend (*list, value);
-}
-
-GList *
-_mc_account_monitor_list (McAccountMonitor *monitor)
-{
- McAccountMonitorPrivate *priv = MC_ACCOUNT_MONITOR_PRIV (monitor);
- GList *accounts = NULL;
-
- g_hash_table_foreach (priv->accounts, _list_append, &accounts);
- return accounts;
-}
-
-static void
-merge_presences (gpointer key, McAccount *account, GArray *presences)
-{
- const McPresence *account_presences;
- guint i;
-
- if (!mc_account_is_enabled (account))
- return;
-
- account_presences = mc_account_get_supported_presences (account);
- if (account_presences)
- {
- while (*account_presences)
- {
- /* check if this presence is already in the array */
- for (i = 0; i < presences->len; i++)
- if (g_array_index (presences, McPresence, i) == *account_presences)
- break;
- if (i >= presences->len) /* no, it's not: let's add it */
- g_array_append_vals (presences, account_presences, 1);
- account_presences++;
- }
- }
-}
-
-/**
- * mc_account_monitor_get_supported_presences:
- * @monitor: The #McAccountMonitor.
- *
- * Get a list of all the presences supported in any account: a presence is
- * considered as supported if there is at least one enabled account which
- * supports it. Support fot the basic presences @MC_PRESENCE_AVAILABLE and
- * @MC_PRESENCE_OFFLINE is taken for granted and therefore these presences are
- * not returned.
- *
- * Returns: a NULL-terminated array of presences, which must be freed with
- * g_free().
- */
-McPresence *
-mc_account_monitor_get_supported_presences (McAccountMonitor *monitor)
-{
- McAccountMonitorPrivate *priv = MC_ACCOUNT_MONITOR_PRIV (monitor);
- GArray *presences;
- McPresence *data;
-
- presences = g_array_new (TRUE, FALSE, sizeof (McPresence));
- g_hash_table_foreach (priv->accounts, (GHFunc)merge_presences, presences);
- data = (McPresence *)presences->data;
- g_array_free (presences, FALSE);
- return data;
-}
-
-McAccount *
-_mc_account_monitor_create_account (McAccountMonitor *monitor,
- const gchar *manager,
- const gchar *protocol,
- const gchar *display_name,
- GHashTable *parameters)
-{
- McAccountMonitorPrivate *priv = MC_ACCOUNT_MONITOR_PRIV (monitor);
- gchar *object_path;
- GError *error = NULL;
-
- mc_cli_account_manager_do_create_account (priv->proxy, -1,
- manager, protocol,
- display_name, parameters,
- &object_path, &error);
- if (error)
- {
- g_warning ("%s failed: %s", G_STRFUNC, error->message);
- g_error_free (error);
- return NULL;
- }
-
- return _mc_account_new (priv->proxy->dbus_daemon, object_path);
-}
-
diff --git a/libmissioncontrol/mc-account-monitor.h b/libmissioncontrol/mc-account-monitor.h
deleted file mode 100644
index 742117a..0000000
--- a/libmissioncontrol/mc-account-monitor.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_ACCOUNT_MONITOR_H__
-#define __MC_ACCOUNT_MONITOR_H__
-
-#include <glib-object.h>
-#include <libmissioncontrol/mission-control.h>
-
-G_BEGIN_DECLS
-
-#define MC_TYPE_ACCOUNT_MONITOR mc_account_monitor_get_type()
-
-#define MC_ACCOUNT_MONITOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MC_TYPE_ACCOUNT_MONITOR, McAccountMonitor))
-
-#define MC_ACCOUNT_MONITOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MC_TYPE_ACCOUNT_MONITOR, McAccountMonitorClass))
-
-#define MC_IS_ACCOUNT_MONITOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MC_TYPE_ACCOUNT_MONITOR))
-
-#define MC_IS_ACCOUNT_MONITOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MC_TYPE_ACCOUNT_MONITOR))
-
-#define MC_ACCOUNT_MONITOR_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MC_TYPE_ACCOUNT_MONITOR, McAccountMonitorClass))
-
-typedef struct {
- GObject parent;
- gpointer priv;
-} McAccountMonitor;
-
-typedef struct {
- GObjectClass parent_class;
-} McAccountMonitorClass;
-
-GType mc_account_monitor_get_type (void);
-
-McAccountMonitor* mc_account_monitor_new (void);
-
-McPresence * mc_account_monitor_get_supported_presences (McAccountMonitor *
- monitor);
-
-G_END_DECLS
-
-#endif /* __MC_ACCOUNT_MONITOR_H__ */
diff --git a/libmissioncontrol/mc-account-priv.h b/libmissioncontrol/mc-account-priv.h
deleted file mode 100644
index 6cc4850..0000000
--- a/libmissioncontrol/mc-account-priv.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_ACCOUNT_PRIV_H__
-#define __MC_ACCOUNT_PRIV_H__
-
-#define MC_ACCOUNT_MANAGER_DBUS_SERVICE "org.freedesktop.Telepathy.AccountManager"
-#define MC_ACCOUNT_MANAGER_DBUS_OBJECT "/org/freedesktop/Telepathy/AccountManager"
-#define MC_ACCOUNT_DBUS_OBJECT_BASE "/org/freedesktop/Telepathy/Account/"
-
-#define MC_ACCOUNTS_GCONF_KEY_DISPLAY_NAME "DisplayName"
-#define MC_ACCOUNTS_GCONF_KEY_NORMALIZED_NAME "NormalizedName"
-#define MC_ACCOUNTS_GCONF_KEY_VALID "Valid"
-#define MC_ACCOUNTS_GCONF_KEY_ENABLED "Enabled"
-#define MC_ACCOUNTS_GCONF_KEY_PARAMETERS "Parameters"
-#define MC_ACCOUNTS_GCONF_KEY_DELETED "deleted"
-#define MC_ACCOUNTS_GCONF_KEY_PROFILE "Profile"
-#define MC_ACCOUNTS_GCONF_KEY_PARAM_ACCOUNT "account"
-#define MC_ACCOUNTS_GCONF_KEY_AVATAR "Avatar"
-#define MC_ACCOUNTS_GCONF_KEY_AVATAR_FILE "AvatarFile"
-#define MC_ACCOUNTS_GCONF_KEY_AVATAR_TOKEN "avatar_token"
-#define MC_ACCOUNTS_GCONF_KEY_AVATAR_MIME "avatar_mime"
-#define MC_ACCOUNTS_GCONF_KEY_AVATAR_ID "avatar_id"
-#define MC_ACCOUNTS_GCONF_KEY_DATA_DIR "data_dir"
-#define MC_ACCOUNTS_GCONF_KEY_ALIAS "Nickname"
-#define MC_ACCOUNTS_GCONF_KEY_SECONDARY_VCARD_FIELDS "SecondaryVCardFields"
-
-McAccount *_mc_account_new (TpDBusDaemon *dbus_daemon,
- const gchar *object_path);
-void _mc_account_set_enabled_priv (McAccount *account, gboolean enabled);
-void _mc_account_set_normalized_name_priv (McAccount *account, const gchar *name);
-void _mc_account_set_display_name_priv (McAccount *account, const gchar *name);
-
-#define MC_ACCOUNT_UNIQUE_NAME_FROM_PATH(object_path) \
- (object_path + (sizeof (MC_ACCOUNT_DBUS_OBJECT_BASE) - 1))
-#endif /* __MC_ACCOUNT_PRIV_H__ */
-
diff --git a/libmissioncontrol/mc-account-proxy.c b/libmissioncontrol/mc-account-proxy.c
deleted file mode 100644
index 0925a9e..0000000
--- a/libmissioncontrol/mc-account-proxy.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * mc-account-proxy.c - Subclass of TpProxy
- *
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "mc-account-proxy.h"
-#include <telepathy-glib/proxy-subclass.h>
-#include <telepathy-glib/errors.h>
-#include "_gen/interfaces.h"
-#include "_gen/cli-Account-body.h"
-#include "_gen/cli-Account_Interface_Avatar-body.h"
-
-struct _McAccountProxyClass {
- TpProxyClass parent_class;
-};
-
-struct _McAccountProxy {
- TpProxy parent;
-};
-
-G_DEFINE_TYPE (McAccountProxy, mc_account_proxy, TP_TYPE_PROXY);
-
-static void
-mc_account_proxy_init (McAccountProxy *self)
-{
- tp_proxy_add_interface_by_id ((TpProxy *)self,
- MC_IFACE_QUARK_ACCOUNT_INTERFACE_AVATAR);
-}
-
-static void
-mc_account_proxy_class_init (McAccountProxyClass *klass)
-{
- GType type = MC_TYPE_ACCOUNT_PROXY;
- TpProxyClass *proxy_class = (TpProxyClass *) klass;
-
- /* the API is stateless, so we can keep the same proxy across restarts */
- proxy_class->must_have_unique_name = FALSE;
-
- proxy_class->interface = MC_IFACE_QUARK_ACCOUNT;
- tp_proxy_or_subclass_hook_on_interface_add (type, mc_cli_Account_add_signals);
- tp_proxy_or_subclass_hook_on_interface_add (type, mc_cli_Account_Interface_Avatar_add_signals);
-
- tp_proxy_subclass_add_error_mapping (type, TP_ERROR_PREFIX, TP_ERRORS,
- TP_TYPE_ERROR);
-}
-
diff --git a/libmissioncontrol/mc-account-proxy.h b/libmissioncontrol/mc-account-proxy.h
deleted file mode 100644
index 816fb0d..0000000
--- a/libmissioncontrol/mc-account-proxy.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * mc-account-proxy.h - Subclass of TpProxy
- *
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LIBMISSIONCONTROL_ACCOUNT_PROXY_H__
-#define __LIBMISSIONCONTROL_ACCOUNT_PROXY_H__
-
-#include <telepathy-glib/proxy.h>
-#include <libmissioncontrol/mc-remap.h>
-
-G_BEGIN_DECLS
-
-typedef struct _McAccountProxy McAccountProxy;
-typedef struct _McAccountProxyClass McAccountProxyClass;
-typedef struct _McAccountProxyPrivate McAccountProxyPrivate;
-
-GType mc_account_proxy_get_type (void);
-
-#define MC_TYPE_ACCOUNT_PROXY \
- (mc_account_proxy_get_type ())
-#define MC_ACCOUNT_PROXY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), MC_TYPE_ACCOUNT_PROXY, \
- McAccountProxy))
-#define MC_ACCOUNT_PROXY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), MC_TYPE_ACCOUNT_PROXY, \
- McAccountProxyClass))
-#define MC_IS_ACCOUNT_PROXY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MC_TYPE_ACCOUNT_PROXY))
-#define MC_IS_ACCOUNT_PROXY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), MC_TYPE_ACCOUNT_PROXY))
-#define MC_ACCOUNT_PROXY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), MC_TYPE_ACCOUNT_PROXY, \
- McAccountProxyClass))
-
-
-G_END_DECLS
-
-/* auto-generated stubs */
-#include <libmissioncontrol/_gen/cli-Account.h>
-#include <libmissioncontrol/_gen/cli-Account_Interface_Avatar.h>
-
-#endif
diff --git a/libmissioncontrol/mc-account.c b/libmissioncontrol/mc-account.c
deleted file mode 100644
index d3f88e3..0000000
--- a/libmissioncontrol/mc-account.c
+++ /dev/null
@@ -1,2062 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include "config.h"
-#undef MC_DISABLE_DEPRECATED
-#include "mc-account.h"
-#define MC_DISABLE_DEPRECATED
-
-#define DBUS_API_SUBJECT_TO_CHANGE
-
-#include <dbus/dbus.h>
-#include <errno.h>
-#include <gconf/gconf-client.h>
-#include <glib.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <glib/gstdio.h>
-
-#include "mc-account-proxy.h"
-#include "mc-account-priv.h"
-#include "mc-account-monitor.h"
-#include "mc-account-monitor-priv.h"
-#include "mc.h"
-
-#define MC_ACCOUNTS_MAX 1024
-#define MC_AVATAR_FILENAME "avatar.bin"
-
-#define MC_ACCOUNT_PRIV(account) ((McAccountPrivate *)MC_ACCOUNT (account)->priv)
-
-G_DEFINE_TYPE (McAccount, mc_account, G_TYPE_OBJECT);
-
-typedef struct
-{
- TpProxy *proxy;
- gchar *manager_name;
- gchar *protocol_name;
- gchar *unique_name;
- gchar *profile_name;
- GSList *display_names;
- GSList *normalized_names;
- gchar *alias;
- gboolean enabled;
- gboolean valid;
- gchar *last_name;
- gchar *last_value;
- gint avatar_id;
-} McAccountPrivate;
-
-static GSList *set_first_element (GSList *list, const gchar *value);
-
-static void
-mc_account_dispose (GObject *object)
-{
- McAccount *self = MC_ACCOUNT(object);
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (self);
-
- if (priv->proxy)
- {
- g_object_unref (priv->proxy);
- priv->proxy = NULL;
- }
- G_OBJECT_CLASS (mc_account_parent_class)->dispose (object);
-}
-
-static void
-mc_account_finalize (GObject *object)
-{
- McAccount *self = MC_ACCOUNT(object);
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (self);
-
- g_free (priv->manager_name);
- g_free (priv->protocol_name);
- g_free (priv->unique_name);
- g_free (priv->profile_name);
- g_slist_foreach (priv->display_names, (GFunc)g_free, NULL);
- g_slist_free (priv->display_names);
- g_slist_foreach (priv->normalized_names, (GFunc)g_free, NULL);
- g_slist_free (priv->normalized_names);
- g_free (priv->alias);
- g_free (priv->last_name);
- g_free (priv->last_value);
-}
-
-static void
-mc_account_init (McAccount *self)
-{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
- MC_TYPE_ACCOUNT, McAccountPrivate);
-}
-
-void
-mc_account_clear_cache (void)
-{
-}
-
-static inline gboolean
-parse_object_path (McAccountPrivate *priv, const gchar *object_path)
-{
- gchar manager[64], protocol[64], unique_name[256];
- gint n;
-
- n = sscanf (object_path, MC_ACCOUNT_DBUS_OBJECT_BASE "%[^/]/%[^/]/%s",
- manager, protocol, unique_name);
- if (n != 3) return FALSE;
-
- priv->manager_name = g_strdup (manager);
- priv->protocol_name = g_strdup (protocol);
- priv->unique_name = g_strdup (MC_ACCOUNT_UNIQUE_NAME_FROM_PATH (object_path));
- return TRUE;
-}
-
-static void
-print_prop (gpointer key, gpointer ht_value, gpointer userdata)
-{
- const gchar *name = key;
- const GValue *value = ht_value;
-
- g_debug ("prop: %s (%s)", name, G_VALUE_TYPE_NAME (value));
-}
-
-static void
-on_account_property_changed (TpProxy *proxy, GHashTable *properties,
- gpointer user_data, GObject *weak_object)
-{
- McAccountPrivate *priv = user_data;
- const GValue *value;
- McAccountMonitor *monitor;
-
- g_hash_table_foreach (properties, print_prop, NULL);
-
- monitor = mc_account_monitor_new ();
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_VALID);
- if (value)
- priv->valid = g_value_get_boolean (value);
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_ENABLED);
- if (value)
- {
- priv->enabled = g_value_get_boolean (value);
- g_signal_emit_by_name (monitor, priv->enabled ?
- "account-enabled" : "account-disabled",
- priv->unique_name);
- }
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_NORMALIZED_NAME);
- if (value)
- priv->normalized_names = set_first_element (priv->normalized_names,
- g_value_get_string (value));
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_DISPLAY_NAME);
- if (value)
- {
- priv->display_names = set_first_element (priv->display_names,
- g_value_get_string (value));
- }
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_ALIAS);
- if (value)
- {
- g_free (priv->alias);
- priv->alias = g_value_dup_string (value);
- }
-
- /* FIXME: we should also emit the "param-changed" signal if an account
- * parameter changed, but since is was used only be the mission-control
- * process, we can skip now. Besides, we wouldn't know which parameter
- * actually changed */
-
- /* emit the account-changed signal */
- g_signal_emit_by_name (monitor, "account-changed", priv->unique_name);
- g_object_unref (monitor);
-}
-
-static void
-on_account_avatar_changed (TpProxy *proxy, gpointer user_data,
- GObject *weak_object)
-{
- McAccountPrivate *priv = user_data;
- McAccountMonitor *monitor;
-
- g_debug ("%s called", G_STRFUNC);
- priv->avatar_id = time(0);
- /* emit the account-changed signal */
- monitor = mc_account_monitor_new ();
- g_signal_emit_by_name (monitor, "account-changed", priv->unique_name);
- g_object_unref (monitor);
-}
-
-McAccount *
-_mc_account_new (TpDBusDaemon *dbus_daemon, const gchar *object_path)
-{
- McAccountPrivate *priv;
- McAccount *new;
- GHashTable *properties;
- GError *error = NULL;
-
- new = (McAccount *)g_object_new (MC_TYPE_ACCOUNT, NULL);
- priv = MC_ACCOUNT_PRIV (new);
- priv->proxy = g_object_new (MC_TYPE_ACCOUNT_PROXY,
- "dbus-daemon", dbus_daemon,
- "bus-name", MC_ACCOUNT_MANAGER_DBUS_SERVICE,
- "object-path", object_path,
- NULL);
- if (!priv->proxy ||
- !parse_object_path (priv, object_path))
- return NULL;
-
- mc_cli_account_connect_to_account_property_changed (priv->proxy,
- on_account_property_changed,
- priv, NULL,
- (GObject *)new, NULL);
- mc_cli_account_interface_avatar_connect_to_avatar_changed (priv->proxy,
- on_account_avatar_changed,
- priv, NULL,
- (GObject *)new, NULL);
-
- mc_cli_dbus_properties_do_get_all (priv->proxy, -1,
- MC_IFACE_ACCOUNT,
- &properties, &error);
- if (error)
- {
- g_warning ("Properties error: %s", error->message);
- g_error_free (error);
- }
- else
- {
- GValue *value;
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_ENABLED);
- if (value)
- priv->enabled = g_value_get_boolean (value);
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_VALID);
- if (value)
- priv->valid = g_value_get_boolean (value);
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_NORMALIZED_NAME);
- if (value)
- priv->normalized_names = g_slist_prepend (NULL, g_value_dup_string (value));
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_DISPLAY_NAME);
- if (value)
- priv->display_names = g_slist_prepend (NULL, g_value_dup_string (value));
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_ALIAS);
- if (value)
- priv->alias = g_value_dup_string (value);
-
- g_hash_table_destroy (properties);
- }
-
- mc_cli_dbus_properties_do_get_all (priv->proxy, -1,
- MC_IFACE_ACCOUNT_INTERFACE_COMPAT,
- &properties, &error);
- if (error)
- {
- g_warning ("Compat properties error: %s", error->message);
- g_error_free (error);
- }
- else
- {
- GValue *value;
-
- value = g_hash_table_lookup (properties, MC_ACCOUNTS_GCONF_KEY_PROFILE);
- if (value)
- priv->profile_name = g_value_dup_string (value);
-
- g_hash_table_destroy (properties);
- }
-
- return new;
-}
-
-void
-_mc_account_set_enabled_priv (McAccount *account, gboolean enabled)
-{
- g_return_if_fail (account != NULL);
- MC_ACCOUNT_PRIV (account)->enabled = enabled;
-}
-
-static gint
-strcmp_null (gconstpointer a, gconstpointer b)
-{
- if (a == b) return 0;
- if (!a || !b) return 1;
- return strcmp (a, b);
-}
-
-static GSList *
-set_first_element (GSList *list, const gchar *value)
-{
- GSList *elem;
-
- if (value && value[0] == 0) value = NULL;
-
- if ((elem = g_slist_find_custom(list, value, strcmp_null)) != NULL)
- {
- if (elem != list)
- {
- /* move the new name at the beginning of the list */
- list = g_slist_remove_link (list, elem);
- list = g_slist_concat (elem, list);
- }
- }
- else
- list = g_slist_prepend (list, g_strdup (value));
- return list;
-}
-
-void
-_mc_account_set_normalized_name_priv (McAccount *account, const gchar *name)
-{
- McAccountPrivate *priv;
-
- g_return_if_fail (account != NULL);
- priv = MC_ACCOUNT_PRIV (account);
- priv->normalized_names = set_first_element (priv->normalized_names, name);
-}
-
-void
-_mc_account_set_display_name_priv (McAccount *account, const gchar *name)
-{
- McAccountPrivate *priv;
-
- g_return_if_fail (account != NULL);
- priv = MC_ACCOUNT_PRIV (account);
- priv->display_names = set_first_element (priv->display_names, name);
-}
-
-static void
-mc_account_class_init (McAccountClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (McAccountPrivate));
- object_class->dispose = mc_account_dispose;
- object_class->finalize = mc_account_finalize;
-}
-
-/**
- * mc_account_lookup:
- * @unique_name: The unique name of the account.
- *
- * Look-up an account from its unique name. The reference count of the returned
- * account is incremented.
- *
- * Return value: The requested #McAccount, or NULL if not found.
- */
-McAccount *
-mc_account_lookup (const gchar *unique_name)
-{
- McAccountMonitor *monitor = mc_account_monitor_new ();
- McAccount *ret = _mc_account_monitor_lookup (monitor, unique_name);
-
- g_object_unref (monitor);
- return ret;
-}
-
-static gboolean
-_filter_account (McAccount *acct, gpointer data)
-{
- const gchar *compare_account, *normalized_name;
- gchar *gconf_account;
- gboolean ret;
-
- g_return_val_if_fail (acct != NULL, FALSE);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (acct)->unique_name != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- compare_account = (const gchar *) data;
-
- if (mc_account_get_param_string (acct, "account", &gconf_account) ==
- MC_ACCOUNT_SETTING_ABSENT)
- return FALSE;
-
- ret = (0 == strcmp(gconf_account, compare_account));
-
- g_free (gconf_account);
-
- if (!ret)
- {
- normalized_name = mc_account_get_normalized_name (acct);
- if (!normalized_name)
- return FALSE;
-
- ret = (0 == strcmp(normalized_name, compare_account));
- }
-
- return ret;
-}
-
-static McAccount *
-_free_all_but_one (GList *list)
-{
- McAccount *ret = NULL;
-
- if (list != NULL)
- {
- GList *tmp;
-
- tmp = g_list_remove_link (list, list);
- mc_accounts_list_free (tmp);
-
- ret = (McAccount *) list->data;
- g_list_free (list);
- }
-
- return ret;
-}
-
-/**
- * mc_account_lookup_with_profile:
- * @profile: A #McProfile.
- * @account: The name of the account.
- *
- * Look-up an account from its name in the given #McProfile. The reference
- * count of the returned account is incremented.
- *
- * Return value: The requested #McAccount, or NULL if not found.
- */
-McAccount *
-mc_account_lookup_with_profile (McProfile *profile,
- const gchar *account)
-{
- GList *accounts;
-
- g_return_val_if_fail (profile != NULL, NULL);
- g_return_val_if_fail (account != NULL, NULL);
-
- accounts = mc_accounts_list_by_profile (profile);
- accounts = mc_accounts_filter (accounts, _filter_account, (gpointer) account);
-
- return _free_all_but_one (accounts);
-}
-
-/**
- * mc_account_lookup_with_vcard_field:
- * @vcard_field: The VCard field.
- * @account: The name of the account.
- *
- * Look-up an account from its name in the given VCard field. The reference
- * count of the returned account is incremented.
- *
- * Return value: The requested #McAccount, or NULL if not found.
- */
-McAccount *
-mc_account_lookup_with_vcard_field (const gchar *vcard_field,
- const gchar *account)
-{
- GList *accounts;
-
- g_return_val_if_fail (vcard_field != NULL, NULL);
- g_return_val_if_fail (account != NULL, NULL);
-
- accounts = mc_accounts_list_by_vcard_field (vcard_field);
- accounts = mc_accounts_filter (accounts, _filter_account, (gpointer) account);
-
- return _free_all_but_one (accounts);
-}
-
-/**
- * mc_account_free:
- * @account: The #McAccount.
- *
- * Free an account.
- * DEPRECATED, use g_object_unref() instead.
- */
-void
-mc_account_free (McAccount* account)
-{
- g_object_unref (account);
-}
-
-/**
- * mc_account_create:
- * @profile: A #McProfile.
- *
- * Create a new account of the given #McProfile.
- *
- * Return value: the newly created #McAccount.
- */
-McAccount *
-mc_account_create (McProfile *profile)
-{
- McAccountMonitor *monitor;
- McAccount *account;
- McAccountPrivate *priv;
- McProtocol *protocol;
- McManager *manager;
- const gchar *manager_name, *protocol_name;
- GHashTable *params;
- GValue value = { 0 };
-
- protocol = mc_profile_get_protocol (profile);
- if (!protocol) return NULL;
- manager = mc_protocol_get_manager (protocol);
- if (!manager) return NULL;
-
- protocol_name = mc_protocol_get_name (protocol);
- manager_name = mc_manager_get_unique_name (manager);
- monitor = mc_account_monitor_new ();
- params = g_hash_table_new (g_str_hash, g_str_equal);
- account = _mc_account_monitor_create_account (monitor, manager_name,
- protocol_name, NULL,
- params);
- g_hash_table_destroy (params);
- g_object_unref (protocol);
- g_object_unref (monitor);
- g_object_unref (manager);
-
- if (account)
- {
- GError *error = NULL;
- priv = account->priv;
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_static_string (&value, mc_profile_get_unique_name (profile));
- mc_cli_dbus_properties_do_set (priv->proxy, -1,
- MC_IFACE_ACCOUNT_INTERFACE_COMPAT,
- MC_ACCOUNTS_GCONF_KEY_PROFILE,
- &value, &error);
- if (error)
- {
- g_warning ("setting profile on %s failed: %s",
- priv->unique_name, error->message);
- g_error_free (error);
- }
- }
- return account;
-}
-
-/**
- * mc_account_delete:
- * @account: The #McAccount.
- *
- * Delete the given account from the accounts configuration. The object itself
- * remains valid and must be free separately.
- *
- * Return value: %TRUE if the account was deleted, %FALSE otherwise.
- */
-gboolean
-mc_account_delete (McAccount *account)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GError *error = NULL;
-
- mc_account_set_enabled (account, FALSE);
-
- mc_cli_account_do_remove (priv->proxy, -1, &error);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * mc_accounts_list:
- *
- * Lists all configured accounts.
- *
- * Return value: a #GList of all accounts. Must be freed with
- * #mc_accounts_list_free.
- */
-GList *
-mc_accounts_list (void)
-{
- McAccountMonitor *monitor = mc_account_monitor_new ();
- GList *ret, *i;
-
- ret = _mc_account_monitor_list (monitor);
-
- for (i = ret; NULL != i; i = i->next)
- g_object_ref (G_OBJECT (i->data));
-
- g_object_unref (monitor);
- return ret;
-}
-
-static gboolean
-_filter_enabled (McAccount *acct, gpointer data)
-{
- gboolean enabled;
-
- g_return_val_if_fail (acct != NULL, FALSE);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (acct)->unique_name != NULL, FALSE);
-
- enabled = GPOINTER_TO_INT (data);
-
- return (mc_account_is_enabled (acct) == enabled);
-}
-
-/**
- * mc_accounts_list_by_enabled:
- * @enabled: a boolean to select if enabled accounts should be returned.
- *
- * Lists all enabled/disabled accounts.
- *
- * Return value: a #GList of all the enabled accounts. Must be freed with
- * #mc_accounts_list_free.
- */
-GList *
-mc_accounts_list_by_enabled (gboolean enabled)
-{
- GList *ret;
-
- ret = mc_accounts_list ();
- ret = mc_accounts_filter (ret, _filter_enabled, GINT_TO_POINTER (enabled));
-
- return ret;
-}
-
-static gboolean
-_filter_profile (McAccount *acct, gpointer data)
-{
- McAccountPrivate *priv = acct->priv;
- gchar *profile_name = data;
-
- return strcmp (priv->profile_name, profile_name) == 0;
-}
-
-/**
- * mc_accounts_list_by_profile:
- * @profile: a #McProfile.
- *
- * Lists all accounts of a #McProfile.
- *
- * Return value: a #GList of the accounts. Must be freed with
- * #mc_accounts_list_free.
- */
-GList *
-mc_accounts_list_by_profile (McProfile *profile)
-{
- const gchar *profile_name;
- GList *ret;
-
- g_return_val_if_fail (profile != NULL, NULL);
- profile_name = mc_profile_get_unique_name (profile);
- g_return_val_if_fail (profile_name != NULL, NULL);
-
- ret = mc_accounts_list ();
- ret = mc_accounts_filter (ret, _filter_profile, (gchar *)profile_name);
-
- return ret;
-}
-
-static gboolean
-_filter_vcard_field (McAccount *acct, gpointer data)
-{
- McProfile *profile;
- const gchar *vcard_field;
- const gchar *profile_vcard_field;
- gboolean ret;
-
- g_return_val_if_fail (acct != NULL, FALSE);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (acct)->unique_name != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- vcard_field = (const gchar *) data;
- profile = mc_account_get_profile (acct);
-
- if (profile == NULL)
- return FALSE;
-
- profile_vcard_field = mc_profile_get_vcard_field (profile);
-
- if (profile_vcard_field == NULL)
- ret = FALSE;
- else
- ret = (0 == strcmp (vcard_field, profile_vcard_field));
-
- g_object_unref (profile);
- return ret;
-}
-
-static gboolean
-_filter_secondary_vcard_field (McAccount *acct, gpointer data)
-{
- const gchar *vcard_field;
- GList *fields, *field;
- gboolean ret;
-
- g_return_val_if_fail (acct != NULL, FALSE);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (acct)->unique_name != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
-
- vcard_field = (const gchar *) data;
-
- fields = mc_account_get_secondary_vcard_fields (acct);
- if (fields == NULL) return FALSE;
-
- ret = FALSE;
- for (field = fields; field != NULL; field = field->next) {
- if (0 == strcmp(vcard_field, fields->data)) {
- ret = TRUE;
- }
- }
-
- g_list_foreach (fields, (GFunc)g_free, NULL);
- g_list_free (fields);
- return ret;
-}
-
-/**
- * mc_account_set_secondary_vcard_fields:
- *
- * Set all configured secondary vcard fields for this account.
- *
- * Returns: %TRUE on success, %FALSE otherwise.
- */
-gboolean
-mc_account_set_secondary_vcard_fields (McAccount *account, const GList *fields)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GValue value = { 0 };
- GError *error = NULL;
- gchar **v_fields;
- guint len, i;
-
- len = g_list_length ((GList *)fields);
- v_fields = g_malloc (sizeof (gchar *) * (len + 1));
- for (i = 0; fields; fields = fields->next, i++)
- v_fields[i] = g_strdup (fields->data);
- v_fields[i] = NULL;
-
- g_value_init (&value, G_TYPE_STRV);
- g_value_take_boxed (&value, v_fields);
- mc_cli_dbus_properties_do_set (priv->proxy, -1,
- MC_IFACE_ACCOUNT_INTERFACE_COMPAT,
- MC_ACCOUNTS_GCONF_KEY_SECONDARY_VCARD_FIELDS,
- &value, &error);
- g_value_unset (&value);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
- else
- return TRUE;
-}
-
-/**
- * mc_account_get_secondary_vcard_fields:
- * Get all configured secondairy vcard fields for this account.
- *
- * Return value: a #GList of all vcard fields (as char *). Is a copy, both data
- * and list must be freed by receiver.
- */
-GList *
-mc_account_get_secondary_vcard_fields (McAccount * acct)
-{
-#ifdef GET_SECONDARY_VCARD_FIELDS
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (acct);
- GValue *val_fields;
- GList *ret = NULL;
- gchar **fields, **field;
- GError *error = NULL;
-
- mc_cli_dbus_properties_do_get (priv->proxy, -1,
- MC_IFACE_ACCOUNT_INTERFACE_COMPAT,
- MC_ACCOUNTS_GCONF_KEY_SECONDARY_VCARD_FIELDS,
- &val_fields, &error);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return NULL;
- }
- fields = g_value_get_boxed (val_fields);
- g_free (val_fields);
-
- /* put the fields into a list */
- for (field = fields; *field != NULL; field++)
- ret = g_list_append (ret, *field);
- g_free (fields);
-
- return ret;
-#else
- g_warning ("%s is disabled due to spamming", G_STRFUNC);
- return NULL;
-#endif
-}
-
-/**
- * mc_accounts_list_by_vcard_field:
- * @vcard_field: the VCard field.
- *
- * Lists all accounts of a VCard field.
- *
- * Return value: a #GList of the accounts. Must be freed with
- * #mc_accounts_list_free.
- */
-GList *
-mc_accounts_list_by_vcard_field (const gchar *vcard_field)
-{
- GList *ret;
-
- ret = mc_accounts_list ();
- ret = mc_accounts_filter (ret, _filter_vcard_field, (gpointer) vcard_field);
-
- return ret;
-}
-
-/**
- * mc_accounts_list_by_secondary_vcard_field:
- * @vcard_field: the VCard field.
- *
- * List all accounts that can use the secondary VCard field given.
- *
- * Return value: A #GList of the accounts. Must be freed with #mc_accounts_list_free.
- */
-GList *
-mc_accounts_list_by_secondary_vcard_field (const gchar *vcard_field)
-{
- GList *ret;
-
- ret = mc_accounts_list ();
- ret = mc_accounts_filter (ret, _filter_secondary_vcard_field, (gpointer) vcard_field);
-
- return ret;
-}
-
-/**
- * mc_accounts_list_free:
- * @list: A #GList of #McAccount.
- *
- * Frees the lists of accounts returned by the mc_accounts_list* family of
- * functions.
- */
-void
-mc_accounts_list_free (GList *list)
-{
- GList *i;
-
- for (i = list; NULL != i; i = i->next)
- g_object_unref (G_OBJECT (i->data));
-
- g_list_free (list);
-}
-
-/**
- * mc_accounts_filter:
- * @accounts: a #GList of #McAccount.
- * @filter: a #McAccountFilter function.
- * @data: user data to be passed to the filter function.
- *
- * Filter a list of accounts according to whether a function returns TRUE,
- * freeing the list and any accounts which are filtered out.
- *
- * Return value: a #GList of the accounts. Must be freed with
- * #mc_accounts_list_free.
- */
-GList *
-mc_accounts_filter (GList *accounts,
- McAccountFilter filter,
- gpointer data)
-{
- GList *tmp, *ret = NULL;
-
- for (tmp = accounts; tmp != NULL; tmp = tmp->next)
- {
- McAccount *account = (McAccount *) tmp->data;
-
- if (filter (account, data))
- {
- ret = g_list_prepend (ret, account);
- }
- else
- {
- g_object_unref (account);
- }
- }
-
- g_list_free (accounts);
-
- return ret;
-}
-
-/**
- * mc_account_get_normalized_name:
- * @account: The #McAccount.
- *
- * Gets the normalized name for the account.
- *
- * Return value: the normalized name, or NULL.
- */
-const gchar *
-mc_account_get_normalized_name (McAccount *account)
-{
- McAccountPrivate *priv;
-
- g_return_val_if_fail (account != NULL, NULL);
- priv = MC_ACCOUNT_PRIV (account);
-
- return (priv->normalized_names) ? priv->normalized_names->data : NULL;
-}
-
-/**
- * mc_account_set_normalized_name:
- * @account: The #McAccount.
- * @name: The name to set.
- *
- * Sets the normalized name of the account.
- *
- * Return value: %TRUE, or %FALSE if some error occurs.
- */
-gboolean
-mc_account_set_normalized_name (McAccount *account, const gchar *name)
-{
- g_warning ("%s: only mission-control should call this function!",
- G_STRFUNC);
- return FALSE;
-}
-
-/**
- * mc_account_get_unique_name:
- * @account: The #McAccount.
- *
- * Gets the unique name for the account.
- *
- * Return value: the unique name, or NULL.
- */
-const gchar *
-mc_account_get_unique_name (McAccount *account)
-{
- g_return_val_if_fail (account != NULL, NULL);
-
- return MC_ACCOUNT_PRIV (account)->unique_name;
-}
-
-/**
- * mc_account_get_profile:
- * @account: The #McAccount.
- *
- * Get the #McProfile this #McAccount belongs to.
- *
- * Return value: the #McProfile, or NULL.
- */
-McProfile *
-mc_account_get_profile (McAccount *account)
-{
- McAccountPrivate *priv;
-
- g_return_val_if_fail (account != NULL, NULL);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (account)->unique_name != NULL,
- NULL);
-
- priv = MC_ACCOUNT_PRIV (account);
- if (G_UNLIKELY (!priv->profile_name))
- {
- GValue *val_profile;
- GError *error = NULL;
-
- mc_cli_dbus_properties_do_get (priv->proxy, -1,
- MC_IFACE_ACCOUNT_INTERFACE_COMPAT,
- MC_ACCOUNTS_GCONF_KEY_PROFILE,
- &val_profile, &error);
- if (error)
- {
- g_warning ("%s: getting profile for %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return NULL;
- }
- priv->profile_name = (gchar *)g_value_get_string (val_profile);
- g_free (val_profile);
- }
-
- return mc_profile_lookup (priv->profile_name);
-}
-
-/**
- * mc_account_get_display_name:
- * @account: The #McAccount.
- *
- * Gets the display name for the account.
- *
- * Return value: the display name, or NULL.
- */
-const gchar *
-mc_account_get_display_name (McAccount *account)
-{
- McAccountPrivate *priv;
-
- g_return_val_if_fail (account != NULL, NULL);
- priv = MC_ACCOUNT_PRIV (account);
-
- return (priv->display_names) ? priv->display_names->data : NULL;
-}
-
-/**
- * mc_account_set_display_name:
- * @account: The #McAccount.
- * @name: The name to set.
- *
- * Sets the display name of the account. If @name is NULL or an empty string,
- * the display name is unset.
- *
- * Return value: %TRUE, or %FALSE if some error occurs.
- */
-gboolean
-mc_account_set_display_name (McAccount *account, const gchar *name)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GValue value = { 0 };
- GError *error = NULL;
-
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_static_string (&value, name);
- mc_cli_dbus_properties_do_set (priv->proxy, -1,
- MC_IFACE_ACCOUNT,
- MC_ACCOUNTS_GCONF_KEY_DISPLAY_NAME,
- &value, &error);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
- else
- return TRUE;
-}
-
-/**
- * mc_account_is_enabled:
- * @account: The #McAccount.
- *
- * Checks if the account is enabled.
- *
- * Return value: %TRUE if enabled, %FALSE otherwise.
- */
-gboolean
-mc_account_is_enabled (McAccount *account)
-{
- g_return_val_if_fail (account != NULL, FALSE);
-
- return MC_ACCOUNT_PRIV (account)->enabled;
-}
-
-/**
- * mc_account_set_enabled:
- * @account: The #McAccount.
- * @enabled: whether the account must be enabled.
- *
- * Enables or disables an account.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_enabled (McAccount *account, gboolean enabled)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GValue value = { 0 };
- GError *error = NULL;
-
- g_value_init (&value, G_TYPE_BOOLEAN);
- g_value_set_boolean (&value, enabled);
- mc_cli_dbus_properties_do_set (priv->proxy, -1,
- MC_IFACE_ACCOUNT,
- MC_ACCOUNTS_GCONF_KEY_ENABLED,
- &value, &error);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
- else
- return TRUE;
-}
-
-static gboolean
-mc_account_get_param (McAccount *account, const gchar *name,
- GValue *dst_value)
-{
- GHashTable *parameters;
- GValue *value;
- gboolean ok = FALSE;
-
- parameters = mc_account_get_params (account);
- if (!parameters) return FALSE;
- value = g_hash_table_lookup (parameters, name);
- if (value)
- {
- g_value_init (dst_value, G_VALUE_TYPE (value));
- g_value_copy (value, dst_value);
- ok = TRUE;
- }
- g_hash_table_destroy (parameters);
- return ok;
-}
-
-/**
- * mc_account_get_param_boolean:
- * @account: The #McAccount.
- * @name: the parameter to retrieve.
- * @value: a pointer to the boolean variable.
- *
- * Gets a boolean parameter from the account settings.
- *
- * Return value: a #McAccountSettingState.
- */
-McAccountSettingState
-mc_account_get_param_boolean (McAccount *account,
- const gchar *name,
- gboolean *value)
-{
- McAccountSettingState ret;
- GValue val = { 0 };
-
- g_return_val_if_fail (account != NULL, MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (account)->unique_name != NULL,
- MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (name != NULL, MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (value != NULL, MC_ACCOUNT_SETTING_ABSENT);
-
- /* TODO: retreive type from protocol and check it matches */
-
- ret = MC_ACCOUNT_SETTING_ABSENT;
-
- if (mc_account_get_param (account, name, &val))
- {
- *value = g_value_get_boolean (&val);
- ret = MC_ACCOUNT_SETTING_FROM_ACCOUNT;
- }
- else
- {
- McProfile *profile;
- const gchar *def;
-
- profile = mc_account_get_profile (account);
- def = mc_profile_get_default_setting (profile, name);
-
- if (def != NULL)
- {
- if (strcmp (def, "true") == 0 || strcmp (def, "1") == 0)
- {
- *value = TRUE;
- ret = MC_ACCOUNT_SETTING_FROM_PROFILE;
- }
- else if (strcmp (def, "false") == 0 || strcmp (def, "0") == 0)
- {
- *value = FALSE;
- ret = MC_ACCOUNT_SETTING_FROM_PROFILE;
- }
- else
- {
- g_warning ("%s: unable to parse boolean %s on account %s parameter %s",
- G_STRFUNC, def, MC_ACCOUNT_PRIV (account)->unique_name,
- name);
- ret = MC_ACCOUNT_SETTING_ABSENT;
- }
- }
- g_object_unref (profile);
- }
-
- return ret;
-}
-
-static gboolean
-_get_system_http_proxy (gboolean https, gchar **host, guint *port)
-{
- gchar *ret_host;
- guint ret_port;
- GConfValue *value;
- GConfClient *client = gconf_client_get_default ();
-
- g_return_val_if_fail (client != NULL, FALSE);
-
- if (!https)
- {
- /* Plain HTTP. If use_http_proxy is not true, give up. */
-
- value = gconf_client_get (
- client, "/system/http_proxy/use_http_proxy", NULL);
-
- if (NULL == value)
- goto NONE;
-
- if (GCONF_VALUE_BOOL != value->type)
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- if (FALSE == gconf_value_get_bool (value))
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- gconf_value_free (value);
-
- /* If we're supposed to authenticate, give up. */
-
- value = gconf_client_get (
- client, "/system/http_proxy/use_authentication", NULL);
-
- if (NULL == value)
- goto NONE;
-
- if (GCONF_VALUE_BOOL != value->type)
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- if (TRUE == gconf_value_get_bool (value))
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- gconf_value_free (value);
- }
-
- /* If the proxy mode is not manual (i.e. it's none or automatic), give up. */
-
- value = gconf_client_get (client, "/system/proxy/mode", NULL);
-
- if (NULL == value)
- goto NONE;
-
- if (GCONF_VALUE_STRING != value->type)
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- if (0 != strcmp ("manual", gconf_value_get_string (value)))
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- gconf_value_free (value);
-
- if (https)
- {
- value = gconf_client_get (client, "/system/proxy/secure_host", NULL);
-
- if (NULL == value)
- goto NONE;
-
- if (GCONF_VALUE_STRING != value->type)
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- ret_host = g_strdup (gconf_value_get_string (value));
- gconf_value_free (value);
- value = NULL;
-
- value = gconf_client_get (client, "/system/proxy/secure_port", NULL);
-
- if (NULL == value)
- goto NONE;
-
- if (GCONF_VALUE_INT != value->type)
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- ret_port = gconf_value_get_int (value);
- gconf_value_free (value);
- }
- else
- {
- value = gconf_client_get (client, "/system/http_proxy/host", NULL);
-
- if (NULL == value)
- goto NONE;
-
- if (GCONF_VALUE_STRING != value->type)
- {
- gconf_value_free (value);
- goto NONE;
- }
-
- ret_host = g_strdup (gconf_value_get_string (value));
- gconf_value_free (value);
-
- value = gconf_client_get (client, "/system/http_proxy/port", NULL);
-
- if (NULL == value)
- goto NONE;
-
- if (GCONF_VALUE_INT != value->type)
- {
- gconf_value_free (value);
- g_free (ret_host);
- goto NONE;
- }
-
- ret_port = gconf_value_get_int (value);
- gconf_value_free (value);
- }
-
- if (0 == strcmp ("", ret_host) || ret_port <= 0)
- {
- g_free (ret_host);
- goto NONE;
- }
-
- g_object_unref (client);
- *host = ret_host;
- *port = ret_port;
- return TRUE;
-
-NONE:
- g_object_unref (client);
- return FALSE;
-}
-
-/**
- * mc_account_get_param_int:
- * @account: The #McAccount.
- * @name: the parameter to retrieve.
- * @value: a pointer to the integer variable.
- *
- * Gets a integer parameter from the account settings.
- *
- * Return value: a #McAccountSettingState.
- */
-McAccountSettingState
-mc_account_get_param_int (McAccount *account,
- const gchar *name,
- gint *value)
-{
- gchar *end;
- glong long_val;
- gint int_val;
- McProfile *profile;
- const gchar *def;
- GValue val = { 0 };
-
- g_return_val_if_fail (account != NULL, MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (account)->unique_name != NULL,
- MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (name != NULL, MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (value != NULL, MC_ACCOUNT_SETTING_ABSENT);
-
- /* TODO: retreive type from protocol and check it matches */
-
- if (mc_account_get_param (account, name, &val))
- {
- if (G_VALUE_TYPE (&val) == G_TYPE_INT)
- *value = g_value_get_int (&val);
- else if (g_value_type_transformable (G_VALUE_TYPE (&val), G_TYPE_INT))
- {
- GValue trans = { 0 };
-
- g_value_init (&trans, G_TYPE_INT);
- g_value_transform (&val, &trans);
- *value = g_value_get_int (&trans);
- }
- else
- {
- g_warning ("%s: param %s has type %s (expecting integer)",
- G_STRFUNC, name, G_VALUE_TYPE_NAME (&val));
- return MC_ACCOUNT_SETTING_ABSENT;
- }
- return MC_ACCOUNT_SETTING_FROM_ACCOUNT;
- }
-
- profile = mc_account_get_profile (account);
- def = mc_profile_get_default_setting (profile, name);
-
- if (def != NULL)
- {
- errno = 0;
- long_val = strtol (def, &end, 10);
- g_object_unref (profile);
-
- if (*def == '\0' || *end != '\0')
- {
- g_warning ("%s: unable to parse integer %s on account %s parameter %s",
- G_STRFUNC, def, MC_ACCOUNT_PRIV (account)->unique_name,
- name);
- return MC_ACCOUNT_SETTING_ABSENT;
- }
-
- int_val = long_val;
-
- if (int_val != long_val || errno == ERANGE)
- {
- g_warning ("%s: integer %s out of range on account %s parameter %s",
- G_STRFUNC, def, MC_ACCOUNT_PRIV (account)->unique_name,
- name);
- return MC_ACCOUNT_SETTING_ABSENT;
- }
-
- *value = int_val;
- return MC_ACCOUNT_SETTING_FROM_PROFILE;
- }
- g_object_unref (profile);
-
- if (0 == strcmp(name, "http-proxy-port") ||
- 0 == strcmp(name, "https-proxy-port"))
- {
- gchar *host;
- guint port;
- gboolean https;
-
- if (0 == strcmp (name, "https-proxy-port"))
- https = TRUE;
- else
- https = FALSE;
-
- if (_get_system_http_proxy (https, &host, &port))
- {
- *value = port;
- return MC_ACCOUNT_SETTING_FROM_PROXY;
- }
- }
-
- return MC_ACCOUNT_SETTING_ABSENT;
-}
-
-/**
- * mc_account_get_param_string:
- * @account: The #McAccount.
- * @name: the parameter to retrieve.
- * @value: a pointer to the string variable which will receive the setting.
- *
- * Gets a string parameter from the account settings. The string will have to
- * be freed with #g_free.
- *
- * Return value: a #McAccountSettingState.
- */
-McAccountSettingState
-mc_account_get_param_string (McAccount *account,
- const gchar *name,
- gchar **value)
-{
- McProfile *profile;
- const gchar *def;
- GValue val = { 0 };
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
-
- g_return_val_if_fail (account != NULL, MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (account)->unique_name != NULL,
- MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (name != NULL, MC_ACCOUNT_SETTING_ABSENT);
- g_return_val_if_fail (value != NULL, MC_ACCOUNT_SETTING_ABSENT);
-
- /* TODO: retreive type from protocol and check it matches */
-
- if (priv->last_name && strcmp (priv->last_name, name) == 0)
- {
- *value = g_strdup (priv->last_value);
- return MC_ACCOUNT_SETTING_FROM_ACCOUNT;
- }
- g_free (priv->last_name);
- priv->last_name = NULL;
- if (mc_account_get_param (account, name, &val))
- {
- *value = (gchar *)g_value_get_string (&val);
- g_free (priv->last_value);
- priv->last_name = g_strdup (name);
- priv->last_value = g_strdup (*value);
- return MC_ACCOUNT_SETTING_FROM_ACCOUNT;
- }
-
- profile = mc_account_get_profile (account);
- def = mc_profile_get_default_setting (profile, name);
-
- if (def != NULL)
- {
- *value = g_strdup (def);
- g_object_unref (profile);
- return MC_ACCOUNT_SETTING_FROM_PROFILE;
- }
- g_object_unref (profile);
-
- if (0 == strcmp(name, "http-proxy-server") ||
- 0 == strcmp(name, "https-proxy-server"))
- {
- gchar *host;
- guint port;
- gboolean https;
-
- if (0 == strcmp (name, "https-proxy-server"))
- https = TRUE;
- else
- https = FALSE;
-
- if (_get_system_http_proxy (https, &host, &port))
- {
- *value = host;
- return MC_ACCOUNT_SETTING_FROM_PROXY;
- }
- }
-
- return MC_ACCOUNT_SETTING_ABSENT;
-}
-
-static gboolean
-mc_account_set_param (McAccount *account, const gchar *name,
- const GValue *value)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- const gchar *unset[] = { NULL, NULL };
- GHashTable *set;
- GError *error = NULL;
-
- set = g_hash_table_new (g_str_hash, g_str_equal);
- if (value)
- g_hash_table_insert (set, (gpointer)name, (gpointer)value);
- else
- unset[0] = name;
- mc_cli_account_do_update_parameters (priv->proxy, -1,
- set, unset,
- &error);
- g_hash_table_destroy (set);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
- else
- return TRUE;
-}
-
-/**
- * mc_account_set_param_boolean:
- * @account: The #McAccount.
- * @name: the parameter to set.
- * @value: a boolean value.
- *
- * Sets a boolean parameter in the account settings.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_param_boolean (McAccount *account,
- const gchar *name,
- gboolean value)
-{
- GValue val = { 0 };
-
- g_value_init (&val, G_TYPE_BOOLEAN);
- g_value_set_boolean (&val, value);
- return mc_account_set_param (account, name, &val);
-}
-
-static inline GType
-get_param_type (McAccount *account, const gchar *name)
-{
- McProfile *profile;
- McProtocol *protocol;
- GType ret = G_TYPE_INT;
-
- profile = mc_account_get_profile (account);
- if (profile)
- {
- protocol = mc_profile_get_protocol (profile);
- if (protocol)
- {
- GSList *params, *param;
-
- params = mc_protocol_get_params (protocol);
- for (param = params; param != NULL; param = param->next)
- {
- McProtocolParam *p = param->data;
- if (strcmp (p->name, name) == 0)
- {
- switch (p->signature[0])
- {
- case DBUS_TYPE_INT16:
- case DBUS_TYPE_INT32:
- ret = G_TYPE_INT;
- break;
- case DBUS_TYPE_UINT16:
- case DBUS_TYPE_UINT32:
- ret = G_TYPE_UINT;
- break;
- }
- break;
- }
- }
- g_object_unref (protocol);
- }
- g_object_unref (profile);
- }
- return ret;
-}
-
-/**
- * mc_account_set_param_int:
- * @account: The #McAccount.
- * @name: the parameter to set.
- * @value: a integer value.
- *
- * Sets a integer parameter in the account settings.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_param_int (McAccount *account,
- const gchar *name,
- gint value)
-{
- GValue val = { 0 };
- GType type;
-
- type = get_param_type (account, name);
- g_value_init (&val, type);
- if (type == G_TYPE_INT)
- g_value_set_int (&val, value);
- else
- g_value_set_uint (&val, (guint)value);
- return mc_account_set_param (account, name, &val);
-}
-
-/**
- * mc_account_set_param_string:
- * @account: The #McAccount.
- * @name: the parameter to set.
- * @value: a string value.
- *
- * Sets a string parameter in the account settings.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_param_string (McAccount *account,
- const gchar *name,
- const gchar *value)
-{
- GValue val = { 0 };
-
- g_value_init (&val, G_TYPE_STRING);
- g_value_set_static_string (&val, value);
- return mc_account_set_param (account, name, &val);
-}
-
-/**
- * mc_account_unset_param:
- * @account: The #McAccount.
- * @name: the parameter to unset.
- *
- * Unsets (removes) a parameter from the account settings.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_unset_param (McAccount *account, const gchar *name)
-{
- return mc_account_set_param (account, name, NULL);
-}
-
-/**
- * mc_account_get_params:
- * @account: The #McAccount.
- *
- * Gets all the parameters for this account. The returned hash table must be
- * freed.
- *
- * Return value: a #GHashTable containing all the account settings, or NULL.
- */
-GHashTable *
-mc_account_get_params (McAccount *account)
-{
- GHashTable *parameters;
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GValue *val_parameters;
- GError *error = NULL;
-
- g_return_val_if_fail (account != NULL, NULL);
- g_return_val_if_fail (MC_ACCOUNT_PRIV (account)->unique_name != NULL,
- NULL);
-
- mc_cli_dbus_properties_do_get (priv->proxy, -1,
- MC_IFACE_ACCOUNT,
- MC_ACCOUNTS_GCONF_KEY_PARAMETERS,
- &val_parameters, &error);
- if (error)
- {
- g_warning ("%s: getting parameters for %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return NULL;
- }
-
- parameters = g_value_get_boxed (val_parameters);
-
- /* this does not free the hastable */
- g_free (val_parameters);
-
- return parameters;
-}
-
-/**
- * mc_account_is_complete:
- * @account: The #McAccount.
- *
- * Checks if all the mandatory parameters declared by the protocol are present
- * in this account's settings.
- *
- * Return value: a gboolean.
- */
-gboolean
-mc_account_is_complete (McAccount *account)
-{
- g_return_val_if_fail (account != NULL, FALSE);
-
- return MC_ACCOUNT_PRIV (account)->valid;
-}
-
-/**
- * mc_account_get_supported_presences:
- * @account: the #McAccount.
- *
- * Checks what presence states are supported by this account.
- *
- * Returns: a zero-terminated array listing all the supported #McPresence.
- * It must not be freed.
- */
-const McPresence *
-mc_account_get_supported_presences (McAccount *account)
-{
- McProfile *profile = mc_account_get_profile (account);
- const McPresence *presences;
-
- presences = mc_profile_get_supported_presences (profile);
- g_object_unref (profile);
- return presences;
-}
-
-/*
- * mc_account_supports_presence:
- * @account: The #McAccount.
- * @presence: The #McPresence.
- *
- * Tests whether the account supports the presence @presence.
- *
- * Returns: a #gboolean.
- */
-gboolean
-mc_account_supports_presence (McAccount *account, McPresence presence)
-{
- McProfile *profile = mc_account_get_profile (account);
- gboolean supported;
-
- supported = mc_profile_supports_presence (profile, presence);
- g_object_unref (profile);
- return supported;
-}
-
-/**
- * mc_account_set_avatar:
- * @account: The #McAccount.
- * @filename: the path of the image file to be used as avatar.
- * @mime_type: the MIME type of the image.
- *
- * Set the avatar for this account. If @filename is %NULL, the avatar is
- * cleared.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_avatar (McAccount *account, const gchar *filename,
- const gchar *mime_type)
-{
- gchar *data;
- gsize len;
- gboolean ret;
-
- g_return_val_if_fail (account != NULL, FALSE);
-
- if (filename)
- {
- if (!g_file_get_contents (filename, &data, &len, NULL))
- {
- g_warning ("%s: reading file %s failed", G_STRLOC, filename);
- return FALSE;
- }
- }
- else
- {
- data = NULL;
- len = 0;
- }
-
- ret = mc_account_set_avatar_from_data (account, data, len, mime_type);
- g_free (data);
- return ret;
-}
-
-/**
- * mc_account_set_avatar_from_data:
- * @account: The #McAccount.
- * @data: image binary contents.
- * @len: length of @data.
- * @mime_type: the MIME type of the image.
- *
- * Set the avatar for this account. If @data is %NULL, the avatar is cleared.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_avatar_from_data (McAccount *account, const gchar *data,
- gsize len, const gchar *mime_type)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GValue value = { 0 };
- GError *error = NULL;
- GArray avatar;
- GType type;
- GValueArray *va;
-
- avatar.data = (gchar *)data;
- avatar.len = len;
- type = dbus_g_type_get_struct ("GValueArray",
- dbus_g_type_get_collection ("GArray",
- G_TYPE_UCHAR),
- G_TYPE_STRING,
- G_TYPE_INVALID);
- g_value_init (&value, type);
- g_value_set_static_boxed (&value, dbus_g_type_specialized_construct (type));
- va = (GValueArray *) g_value_get_boxed (&value);
- g_value_take_boxed (va->values, &avatar);
- g_value_set_static_string (va->values + 1, mime_type);
- mc_cli_dbus_properties_do_set (priv->proxy, -1,
- MC_IFACE_ACCOUNT_INTERFACE_AVATAR,
- MC_ACCOUNTS_GCONF_KEY_AVATAR,
- &value, &error);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
- else
- return TRUE;
-}
-
-/**
- * mc_account_set_avatar_token:
- * @account: The #McAccount.
- * @token: string holding the Telepathy token for the avatar.
- *
- * Set the avatar token for this account. This function is to be used only by
- * the mission-control server.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_avatar_token (McAccount *account, const gchar *token)
-{
- g_warning ("%s: only mission-control should call this function!",
- G_STRFUNC);
- return FALSE;
-}
-
-/**
- * mc_account_set_avatar_mime_type:
- * @account: The #McAccount.
- * @mime_type: string holding the mime-type of the avatar.
- *
- * Set the avatar mime-type for this account. This function is to be used only
- * by the mission-control server.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_set_avatar_mime_type (McAccount *account, const gchar *mime_type)
-{
- g_warning ("%s: only mission-control should call this function!",
- G_STRFUNC);
- return FALSE;
-}
-
-/**
- * mc_account_get_avatar:
- * @account: The #McAccount.
- * @filename: address of the variable to hold the path of the image file used
- * as avatar.
- * @mime_type: address of the variable for the MIME type of the image.
- * @token: address of the variable for the Telepathy token of the avatar.
- *
- * Get the avatar for this account. Any of the parameters for the output can be
- * NULL, if that information is not needed.
- *
- * Return value: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_get_avatar (McAccount *account, gchar **filename,
- gchar **mime_type, gchar **token)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GValue *val_avatar;
- GError *error = NULL;
-
- if (filename)
- {
- mc_cli_dbus_properties_do_get (priv->proxy, -1,
- MC_IFACE_ACCOUNT_INTERFACE_COMPAT,
- MC_ACCOUNTS_GCONF_KEY_AVATAR_FILE,
- &val_avatar, &error);
- if (error)
- {
- g_warning ("%s: getting avatar file for %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
- *filename = (gchar *)g_value_get_string (val_avatar);
- g_free (val_avatar);
- }
-
- if (mime_type)
- {
- GValueArray *va;
-
- mc_cli_dbus_properties_do_get (priv->proxy, -1,
- MC_IFACE_ACCOUNT,
- MC_ACCOUNTS_GCONF_KEY_AVATAR,
- &val_avatar, &error);
-
- if (error)
- {
- g_warning ("%s: getting avatar for %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
-
- va = (GValueArray *) g_value_get_boxed (val_avatar);
- *mime_type = g_value_dup_string (va->values + 1);
- g_value_unset (val_avatar);
- g_free (val_avatar);
- }
-
- /* we cannot know the token, but it was used only for mission-control */
- if (token)
- {
- g_warning ("%s: only mission-control should retrieve the token!",
- G_STRFUNC);
- }
-
- return TRUE;
-}
-
-/**
- * mc_account_get_avatar_id:
- * @account: The #McAccount.
- *
- * Get the avatar ID for this account. The ID is a number that changes
- * everytime the avatar image changes.
- *
- * Returns: the avatar ID.
- */
-gint
-mc_account_get_avatar_id (McAccount *account)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
-
- return priv->avatar_id;
-}
-
-/**
- * mc_account_reset_avatar_id:
- * @account: The #McAccount.
- *
- * Calculates a new avatar ID for this account. This function is to be called
- * when the avatar image file has been changed by a direct modification of its
- * binary content.
- *
- * Returns: %TRUE, or %FALSE if some error occurred.
- */
-gboolean
-mc_account_reset_avatar_id (McAccount *account)
-{
- /* does nothing */
- return TRUE;
-}
-
-/**
- * mc_account_get_alias:
- * @account: The #McAccount.
- *
- * Gets the alias for the account.
- *
- * Return value: the alias (must be freed with g_free()), or NULL.
- */
-gchar *
-mc_account_get_alias (McAccount *account)
-{
- g_return_val_if_fail (account != NULL, NULL);
-
- return g_strdup (MC_ACCOUNT_PRIV (account)->alias);
-}
-
-/**
- * mc_account_set_alias:
- * @account: The #McAccount.
- * @alias: The alias to set.
- *
- * Sets the alias of the account.
- *
- * Return value: %TRUE, or %FALSE if some error occurs.
- */
-gboolean
-mc_account_set_alias (McAccount *account, const gchar *alias)
-{
- McAccountPrivate *priv = MC_ACCOUNT_PRIV (account);
- GValue value = { 0 };
- GError *error = NULL;
-
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_static_string (&value, alias);
- mc_cli_dbus_properties_do_set (priv->proxy, -1,
- MC_IFACE_ACCOUNT,
- MC_ACCOUNTS_GCONF_KEY_ALIAS,
- &value, &error);
- if (error)
- {
- g_warning ("%s on %s failed: %s",
- G_STRFUNC, priv->unique_name, error->message);
- g_error_free (error);
- return FALSE;
- }
- else
- return TRUE;
-}
-
diff --git a/libmissioncontrol/mc-account.h b/libmissioncontrol/mc-account.h
deleted file mode 100644
index 29cb838..0000000
--- a/libmissioncontrol/mc-account.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_ACCOUNT_H__
-#define __MC_ACCOUNT_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libmissioncontrol/mc-remap.h>
-
-G_BEGIN_DECLS
-
-#define MC_TYPE_ACCOUNT mc_account_get_type()
-
-#define MC_ACCOUNT(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MC_TYPE_ACCOUNT, McAccount))
-
-#define MC_ACCOUNT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MC_TYPE_ACCOUNT, McAccountwClass))
-
-#define MC_IS_ACCOUNT(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MC_TYPE_ACCOUNT))
-
-#define MC_IS_ACCOUNT_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MC_TYPE_ACCOUNT))
-
-#define MC_ACCOUNT_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MC_TYPE_ACCOUNT, McAccountwClass))
-
-typedef struct {
- GObject parent;
- gpointer priv;
-} McAccount;
-
-typedef struct {
- GObjectClass parent_class;
-} McAccountClass;
-
-GType mc_account_get_type (void);
-
-typedef enum
-{
- MC_ACCOUNT_SETTING_ABSENT = 0,
- MC_ACCOUNT_SETTING_FROM_ACCOUNT,
- MC_ACCOUNT_SETTING_FROM_PROFILE,
- MC_ACCOUNT_SETTING_FROM_PROXY,
-} McAccountSettingState;
-
-#include <libmissioncontrol/mc-profile.h>
-
-/* returns NULL if unique name does not exist */
-McAccount *mc_account_lookup (const gchar *unique_name);
-McAccount *mc_account_lookup_with_profile (McProfile *profile,
- const gchar *account);
-McAccount *mc_account_lookup_with_vcard_field (const gchar *vcard_field,
- const gchar *account);
-#ifndef MC_DISABLE_DEPRECATED
-void mc_account_free (McAccount* account);
-#endif
-void mc_account_clear_cache (void);
-
-/* returns newly-created account, enabled by default */
-McAccount *mc_account_create (McProfile *profile);
-
-/* this function only deletes the account from database,
- * the account struct itself must be freed separately */
-gboolean mc_account_delete (McAccount *account);
-
-/* lists returned by these functions should be freed with
- * mc_accounts_list_free */
-GList *mc_accounts_list (void);
-GList *mc_accounts_list_by_enabled (gboolean enabled);
-GList *mc_accounts_list_by_profile (McProfile *profile);
-GList *mc_accounts_list_by_vcard_field (const gchar *vcard_field);
-GList *mc_accounts_list_by_secondary_vcard_field (const gchar *vcard_field);
-void mc_accounts_list_free (GList *list);
-
-/* filter a list of accounts according to whether a function returns TRUE,
- * freeing the list and any accounts which are filtered out, and returning a
- * new list which must be freed with mc_accounts_list_free. */
-typedef gboolean (*McAccountFilter) (McAccount *account, gpointer data);
-GList *mc_accounts_filter (GList *accounts,
- McAccountFilter filter,
- gpointer data);
-
-/* a unique identifier string for this account */
-const gchar *mc_account_get_unique_name (McAccount *account);
-
-/* get profile */
-McProfile *mc_account_get_profile (McAccount *account);
-
-/* human-readable name */
-const gchar *mc_account_get_display_name (McAccount *account);
-gboolean mc_account_set_display_name (McAccount *account,
- const gchar *name);
-
-/* normalized name */
-const gchar *mc_account_get_normalized_name (McAccount *account);
-gboolean mc_account_set_normalized_name (McAccount *account,
- const gchar *name);
-
-/* whether account is enabled or disabled */
-gboolean mc_account_is_enabled (McAccount *account);
-gboolean mc_account_set_enabled (McAccount *account,
- const gboolean enabled);
-
-/* the following methods retrieve a parameter from the account or the
- * default from the profile if the account does not set the value */
-McAccountSettingState mc_account_get_param_boolean (McAccount *account,
- const gchar *name,
- gboolean *value);
-McAccountSettingState mc_account_get_param_int (McAccount *account,
- const gchar *name,
- gint *value);
-McAccountSettingState mc_account_get_param_string (McAccount *account,
- const gchar *name,
- gchar **value);
-
-/* for every parameter (both optional and mandatory) defined by the
- * protocol, get a hash table of the params from the account or
- * the default profile. each setting is stored in a GValue. */
-GHashTable *mc_account_get_params (McAccount *account);
-
-/* Set functions. Returns true if success, else false is returned */
-gboolean mc_account_set_param_boolean (McAccount *account,
- const gchar *name,
- gboolean value);
-gboolean mc_account_set_param_int (McAccount *account,
- const gchar *name,
- gint value);
-gboolean mc_account_set_param_string (McAccount *account,
- const gchar *name,
- const gchar *value);
-
-gboolean mc_account_unset_param (McAccount *account, const gchar *name);
-
-/* returns TRUE if the account information, along with the profile defaults
- * has all mandatory fields (declared by the protocol) set */
-gboolean mc_account_is_complete (McAccount *account);
-
-const McPresence *mc_account_get_supported_presences (McAccount *account);
-gboolean mc_account_supports_presence (McAccount *account,
- McPresence presence);
-
-gboolean mc_account_set_avatar (McAccount *account, const gchar *filename,
- const gchar *mime_type);
-gboolean mc_account_set_avatar_from_data (McAccount *account, const gchar *data,
- gsize len, const gchar *mime_type);
-gboolean mc_account_get_avatar (McAccount *account, gchar **filename,
- gchar **mime_type, gchar **token);
-
-gboolean mc_account_set_avatar_token (McAccount *account, const gchar *token);
-gboolean mc_account_set_avatar_mime_type (McAccount *account,
- const gchar *mime_type);
-
-gint mc_account_get_avatar_id (McAccount *account);
-gboolean mc_account_reset_avatar_id (McAccount *account);
-
-gboolean mc_account_set_alias (McAccount *account, const gchar *alias);
-gchar *mc_account_get_alias (McAccount *account);
-
-gboolean mc_account_set_secondary_vcard_fields (McAccount *account,
- const GList *fields);
-GList *mc_account_get_secondary_vcard_fields (McAccount * acct);
-/*
-void mc_account_add_secondary_vcard_field (McAccount * acct, const char * field);
-void mc_account_remove_secondary_vcard_field (McAccount * acct, const char * field);
-*/
-G_END_DECLS
-
-#endif /* __MC_ACCOUNT_H__ */
diff --git a/libmissioncontrol/mc-manager-priv.h b/libmissioncontrol/mc-manager-priv.h
deleted file mode 100644
index 4950699..0000000
--- a/libmissioncontrol/mc-manager-priv.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_MANAGER_PRIV_H__
-#define __MC_MANAGER_PRIV_H__
-
-#include "mc-protocol.h"
-
-McProtocol *
-_mc_manager_protocol_lookup (McManager *manager, const gchar *name);
-
-#endif /* __MC_MANAGER_PRIV_H__ */
diff --git a/libmissioncontrol/mc-manager.c b/libmissioncontrol/mc-manager.c
deleted file mode 100644
index 4a0c4bb..0000000
--- a/libmissioncontrol/mc-manager.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include "config.h"
-#undef MC_DISABLE_DEPRECATED
-#include "mc-manager.h"
-#define MC_DISABLE_DEPRECATED
-
-#include <string.h>
-#include <sys/types.h>
-
-#include <glib.h>
-#include <glib/gstdio.h>
-
-#include "mc-protocol.h"
-#include "mc-protocol-priv.h"
-
-#include "mc-manager-priv.h"
-
-#define MANAGER_SUFFIX ".manager"
-#define MANAGER_SUFFIX_LEN 8
-
-#define MC_MANAGER_PRIV(manager) ((McManagerPrivate *)manager->priv)
-
-G_DEFINE_TYPE (McManager, mc_manager, G_TYPE_OBJECT);
-
-static GHashTable *manager_cache = NULL;
-
-typedef struct {
- gchar *unique_name;
- gchar *filename;
-
- /* FIXME: bus_name and object_path shouldn't be needed anymore */
- gchar *bus_name;
- gchar *object_path;
- time_t mtime;
- GSList *protocols;
-} McManagerPrivate;
-
-static void
-mc_manager_finalize (GObject *object)
-{
- McManager *manager = MC_MANAGER(object);
- McManagerPrivate *priv = MC_MANAGER_PRIV (manager);
- GSList *i;
-
- g_free (priv->unique_name);
- g_free (priv->filename);
- g_free (priv->bus_name);
- g_free (priv->object_path);
-
- for (i = priv->protocols; NULL != i; i = i->next)
- g_object_unref (G_OBJECT (i->data));
-
- g_slist_free (priv->protocols);
-}
-
-static void
-mc_manager_class_init (McManagerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (McManagerPrivate));
- object_class->finalize = mc_manager_finalize;
-}
-
-static void
-mc_manager_init (McManager *self)
-{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
- MC_TYPE_MANAGER, McManagerPrivate);
-}
-
-static McManager *
-mc_manager_new (gchar *unique_name, gchar *bus_name, gchar *object_path,
- GSList *protocols)
-{
- McManager *new = g_object_new (MC_TYPE_MANAGER, NULL);
- McManagerPrivate *priv = MC_MANAGER_PRIV (new);
-
- priv->unique_name = unique_name;
- priv->bus_name = bus_name;
- priv->object_path = object_path;
- priv->protocols = protocols;
-
- return new;
-}
-
-static const gchar**
-_mc_manager_get_dirs (void)
-{
- GSList *dir_list = NULL, *slist;
- const gchar *dirname;
- static gchar **manager_dirs = NULL;
- guint n;
-
- if (manager_dirs) return (const gchar **)manager_dirs;
-
- dirname = g_getenv ("MC_MANAGER_DIR");
- if (dirname && g_file_test (dirname, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, (gchar *)dirname);
-
- if (MANAGERS_DIR[0] == '/')
- {
- if (g_file_test (MANAGERS_DIR, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, MANAGERS_DIR);
- }
- else
- {
- const gchar * const *dirs;
- gchar *dir;
-
- dir = g_build_filename (g_get_user_data_dir(), MANAGERS_DIR, NULL);
- if (g_file_test (dir, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, dir);
- else g_free (dir);
-
- dirs = g_get_system_data_dirs();
- for (dirname = *dirs; dirname; dirs++, dirname = *dirs)
- {
- dir = g_build_filename (dirname, MANAGERS_DIR, NULL);
- if (g_file_test (dir, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, dir);
- else g_free (dir);
- }
- }
-
- /* build the string array */
- n = g_slist_length (dir_list);
- manager_dirs = g_new (gchar *, n + 1);
- manager_dirs[n--] = NULL;
- for (slist = dir_list; slist; slist = slist->next)
- manager_dirs[n--] = slist->data;
- g_slist_free (dir_list);
- return (const gchar **)manager_dirs;
-}
-
-static gchar *
-_mc_manager_filename (const gchar *unique_name)
-{
- const gchar **manager_dirs;
- const gchar *dirname;
- gchar *filename, *filepath = NULL;
-
- manager_dirs = _mc_manager_get_dirs ();
- if (!manager_dirs) return NULL;
-
- filename = g_strconcat (unique_name, MANAGER_SUFFIX, NULL);
- for (dirname = *manager_dirs; dirname; manager_dirs++, dirname = *manager_dirs)
- {
- filepath = g_build_filename (dirname, filename, NULL);
- if (g_file_test (filepath, G_FILE_TEST_EXISTS)) break;
- g_free (filepath);
- filepath = NULL;
- }
- g_free (filename);
- return filepath;
-}
-
-#define PREFIX_PROTOCOL "Protocol "
-#define PREFIX_PROTOCOL_LEN 9
-#define PREFIX_PROTOCOL_OLD "Proto "
-#define PREFIX_PROTOCOL_OLD_LEN 6
-
-static GSList *
-_keyfile_get_protocols (GKeyFile *keyfile, const gchar *manager)
-{
- GSList *protocols = NULL;
- gchar **groups = NULL;
- gchar **i;
-
- groups = g_key_file_get_groups (keyfile, NULL);
-
- for (i = groups; NULL != *i; i++)
- {
- const gchar *name = NULL;
-
- if (0 == strncmp (*i, PREFIX_PROTOCOL, PREFIX_PROTOCOL_LEN))
- name = *i + PREFIX_PROTOCOL_LEN;
- else if (0 == strncmp (*i, PREFIX_PROTOCOL_OLD, PREFIX_PROTOCOL_OLD_LEN))
- name = *i + PREFIX_PROTOCOL_OLD_LEN;
-
- if (NULL != name)
- {
- McProtocol *protocol = _mc_protocol_from_keyfile (keyfile,
- manager, *i, name);
-
- if (protocol)
- protocols = g_slist_prepend (protocols, protocol);
- }
- }
-
- g_strfreev (groups);
- return protocols;
-}
-
-static McManager *
-_mc_manager_from_file (const gchar *unique_name, const gchar *filename)
-{
- GError *error = NULL;
- GKeyFile *keyfile;
- gchar *bus_name = NULL;
- gchar *object_path = NULL;
- GSList *protocols = NULL;
-
- keyfile = g_key_file_new ();
-
- if (!g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error))
- {
- g_debug ("%s: loading %s failed: %s", G_STRFUNC, filename, error->message);
- g_error_free (error);
- return NULL;
- }
-
- bus_name = g_key_file_get_string (
- keyfile, "ConnectionManager", "BusName", NULL);
- object_path = g_key_file_get_string (
- keyfile, "ConnectionManager", "ObjectPath", NULL);
-
- if (!bus_name || !object_path)
- {
- g_debug ("%s: failed to get name, bus name and object path from file",
- G_STRFUNC);
- g_free (bus_name);
- g_free (object_path);
- return NULL;
- }
-
- protocols = _keyfile_get_protocols (keyfile, unique_name);
- g_key_file_free (keyfile);
-
- return mc_manager_new (g_strdup (unique_name), bus_name, object_path,
- protocols);
-}
-
-static time_t
-_mc_manager_get_mtime (McManager *manager)
-{
- McManagerPrivate *priv = MC_MANAGER_PRIV (manager);
- return priv->mtime;
-}
-
-/**
- * mc_manager_lookup:
- * @unique_name: the unique name.
- *
- * Looks up for the #McManager having the given unique name.
- * The returned object's reference count is incremented.
- *
- * Returns: the #McManager, or NULL if not found.
- */
-McManager *
-mc_manager_lookup (const gchar *unique_name)
-{
- McManager *manager = NULL;
- gchar *filename;
- struct stat buf;
-
- g_return_val_if_fail (unique_name != NULL, NULL);
- g_return_val_if_fail (*unique_name != '\0', NULL);
-
- filename = _mc_manager_filename (unique_name);
-
- if (0 != g_stat (filename, &buf))
- goto OUT;
-
- if (NULL == manager_cache)
- manager_cache = g_hash_table_new_full (
- g_str_hash, g_str_equal, g_free, g_object_unref);
-
- manager = g_hash_table_lookup (manager_cache, unique_name);
-
- if (NULL != manager && _mc_manager_get_mtime (manager) >= buf.st_mtime)
- {
- g_object_ref (manager);
- goto OUT;
- }
-
- manager = _mc_manager_from_file (unique_name, filename);
-
- if (NULL != manager)
- {
- McManagerPrivate *priv;
- priv = MC_MANAGER_PRIV (manager);
- priv->mtime = buf.st_mtime;
- g_hash_table_replace (manager_cache, g_strdup (unique_name), manager);
- g_object_ref (manager);
- }
-
-OUT:
- g_free (filename);
- return manager;
-}
-
-/**
- * mc_manager_free:
- * @id: the #McManager.
- *
- * Frees (unrefs) the manager.
- * DEPRECATED, use g_object_unref() instead.
- */
-void
-mc_manager_free (McManager *id)
-{
- g_return_if_fail (id != NULL);
-
- g_object_unref (id);
-}
-
-/**
- * mc_manager_clear_cache:
- *
- * Clears the managers cache.
- */
-void
-mc_manager_clear_cache(void)
-{
- if (NULL == manager_cache)
- return;
-
- g_hash_table_destroy(manager_cache);
- manager_cache = NULL;
-}
-
-/**
- * mc_managers_list:
- *
- * Lists all configured managers. <emphasis>Currently this function returns
- * only the "gabble" manager</emphasis>.
- *
- * Returns: a #GList of the managers, to be freed with #mc_managers_free_list.
- */
-GList *
-mc_managers_list (void)
-{
- return g_list_prepend (NULL, mc_manager_lookup ("gabble"));
-}
-
-/**
- * mc_managers_free_list:
- * @list: a #GList of #McManager.
- *
- * Frees a list of managers.
- */
-void
-mc_managers_free_list (GList *list)
-{
- GList *tmp;
-
- for (tmp = list; tmp != NULL; tmp = tmp->next)
- mc_manager_free ((McManager *) tmp->data);
-
- g_list_free (list);
-}
-
-/**
- * mc_manager_get_unique_name:
- * @id: the #McManager.
- *
- * Gets the unique name of the manager.
- *
- * Returns: the unique name, as a string (not to be freed).
- */
-const gchar *
-mc_manager_get_unique_name (McManager *id)
-{
- g_return_val_if_fail (id != NULL, NULL);
-
- return MC_MANAGER_PRIV (id)->unique_name;
-}
-
-/**
- * mc_manager_get_bus_name:
- * @id: the #McManager.
- *
- * Gets the D-Bus bus name of the manager.
- *
- * Returns: the bus name, as a string (not to be freed).
- */
-const gchar *
-mc_manager_get_bus_name (McManager *id)
-{
- g_return_val_if_fail (id != NULL, NULL);
-
- return MC_MANAGER_PRIV (id)->bus_name;
-}
-
-/**
- * mc_manager_get_object_path:
- * @id: the #McManager.
- *
- * Gets the D-Bus object path of the manager.
- *
- * Returns: the object path, as a string (not to be freed).
- */
-const gchar *
-mc_manager_get_object_path (McManager *id)
-{
- g_return_val_if_fail (id != NULL, NULL);
-
- return MC_MANAGER_PRIV (id)->object_path;
-}
-
-McProtocol *
-_mc_manager_protocol_lookup (McManager *manager, const gchar *name)
-{
- GSList *i;
-
- g_return_val_if_fail (manager != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (*name != '\0', NULL);
-
- for (i = MC_MANAGER_PRIV (manager)->protocols; NULL != i; i = i->next)
- {
- McProtocol *protocol = (McProtocol *) i->data;
-
- if (0 == strcmp (name, mc_protocol_get_name (protocol)))
- {
- g_object_ref (protocol);
- return protocol;
- }
- }
-
- return NULL;
-}
-
-/**
- * mc_manager_get_filename:
- * @id: the #McManager.
- *
- * Gets the file path of the manager.
- *
- * Returns: the file path, as a string (not to be freed).
- */
-const gchar *
-mc_manager_get_filename (McManager *id)
-{
- McManagerPrivate *priv = MC_MANAGER_PRIV (id);
-
- g_return_val_if_fail (id != NULL, NULL);
-
- if (!priv->filename)
- priv->filename = _mc_manager_filename (priv->unique_name);
-
- return priv->filename;
-}
-
diff --git a/libmissioncontrol/mc-manager.h b/libmissioncontrol/mc-manager.h
deleted file mode 100644
index f151165..0000000
--- a/libmissioncontrol/mc-manager.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_MANAGER_H__
-#define __MC_MANAGER_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libmissioncontrol/mc-remap.h>
-
-G_BEGIN_DECLS
-
-#define MC_TYPE_MANAGER mc_manager_get_type()
-
-#define MC_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MC_TYPE_MANAGER, McManager))
-
-#define MC_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MC_TYPE_MANAGER, McManagerClass))
-
-#define MC_IS_MANAGER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MC_TYPE_MANAGER))
-
-#define MC_IS_MANAGER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MC_TYPE_MANAGER))
-
-#define MC_MANAGER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MC_TYPE_MANAGER, McManagerClass))
-
-typedef struct {
- GObject parent;
- gpointer priv;
-} McManager;
-
-typedef struct {
- GObjectClass parent_class;
-} McManagerClass;
-
-GType mc_manager_get_type (void);
-
-McManager *mc_manager_lookup (const gchar *unique_name);
-#ifndef MC_DISABLE_DEPRECATED
-void mc_manager_free (McManager *id);
-#endif
-void mc_manager_clear_cache (void);
-
-/* get all managers; returns a list of McManager *s */
-GList *mc_managers_list (void);
-void mc_managers_free_list (GList *list);
-
-const gchar *mc_manager_get_unique_name (McManager *id);
-const gchar *mc_manager_get_bus_name (McManager *id);
-const gchar *mc_manager_get_object_path (McManager *id);
-const gchar *mc_manager_get_filename (McManager *id);
-
-G_END_DECLS
-
-#endif /* __MC_MANAGER_H__ */
diff --git a/libmissioncontrol/mc-profile.c b/libmissioncontrol/mc-profile.c
deleted file mode 100644
index cc54732..0000000
--- a/libmissioncontrol/mc-profile.c
+++ /dev/null
@@ -1,1075 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include "config.h"
-#undef MC_DISABLE_DEPRECATED
-#include "mc-profile.h"
-#define MC_DISABLE_DEPRECATED
-
-#include <glib.h>
-#include <glib/gstdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <libintl.h>
-
-#include "mc-enum-types.h"
-
-#define PROFILE_SUFFIX ".profile"
-#define PROFILE_SUFFIX_LEN 8
-#define PROFILE_GROUP "Profile"
-
-#define MC_PROFILE_PRIV(profile) ((McProfilePrivate *)profile->priv)
-
-G_DEFINE_TYPE (McProfile, mc_profile, G_TYPE_OBJECT);
-
-static GHashTable *profile_cache = NULL;
-
-const GDebugKey capabilities[] = {
- { "chat-p2p", MC_PROFILE_CAPABILITY_CHAT_P2P },
- { "chat-room", MC_PROFILE_CAPABILITY_CHAT_ROOM },
- { "chat-room-list", MC_PROFILE_CAPABILITY_CHAT_ROOM_LIST },
- { "voice-p2p", MC_PROFILE_CAPABILITY_VOICE_P2P },
- { "contact-search", MC_PROFILE_CAPABILITY_CONTACT_SEARCH },
- { "split-account", MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT },
- { "registration-ui", MC_PROFILE_CAPABILITY_REGISTRATION_UI },
- { "supports-avatars", MC_PROFILE_CAPABILITY_SUPPORTS_AVATARS },
- { "supports-alias", MC_PROFILE_CAPABILITY_SUPPORTS_ALIAS },
- { "supports-roster", MC_PROFILE_CAPABILITY_SUPPORTS_ROSTER },
- { "video-p2p", MC_PROFILE_CAPABILITY_VIDEO_P2P },
-};
-
-typedef struct {
- gchar *unique_name;
- gboolean loaded;
- gchar *configuration_ui;
- gchar *display_name;
- gchar *icon_name;
- gchar *branding_icon_name;
- gchar *manager;
- gchar *protocol;
- gchar *vcard_field;
- gchar *default_account_domain;
- gchar *avatar_mime_type;
- gchar *default_account_name;
- gint priority;
- gboolean vcard_default;
- McProfileCapabilityFlags capabilities;
- GHashTable *default_settings;
- GHashTable *vcard_mangle_hash;
- GArray *supported_presences;
- time_t mtime;
-} McProfilePrivate;
-
-static void
-mc_profile_init (McProfile *self)
-{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
- MC_TYPE_PROFILE, McProfilePrivate);
-}
-
-static void
-mc_profile_finalize (GObject *object)
-{
- McProfile *self = MC_PROFILE(object);
- McProfilePrivate *priv;
- g_return_if_fail (self != NULL);
-
- priv = MC_PROFILE_PRIV (self);
- g_free (priv->unique_name);
- g_free (priv->configuration_ui);
- g_free (priv->display_name);
- g_free (priv->icon_name);
- g_free (priv->branding_icon_name);
- g_free (priv->manager);
- g_free (priv->protocol);
- g_free (priv->vcard_field);
- g_free (priv->default_account_domain);
- g_free (priv->avatar_mime_type);
- g_free (priv->default_account_name);
- g_hash_table_destroy (priv->default_settings);
- g_hash_table_destroy (priv->vcard_mangle_hash);
- g_array_free (priv->supported_presences, TRUE);
-}
-
-static void
-mc_profile_class_init (McProfileClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (McProfilePrivate));
- object_class->finalize = mc_profile_finalize;
-}
-
-/**
- * mc_profile_clear_cache:
- *
- * Clears the profiles cache.
- */
-void
-mc_profile_clear_cache(void)
-{
- if (NULL == profile_cache)
- return;
-
- g_hash_table_destroy(profile_cache);
- profile_cache = NULL;
-}
-
-static gchar * _mc_profile_filename (const gchar *name);
-
-static time_t
-_mc_profile_mtime (McProfile *profile)
-{
- McProfilePrivate *priv = MC_PROFILE_PRIV (profile);
- return priv->mtime;
-}
-
-static McProfile *
-_mc_profile_new (const gchar *unique_name)
-{
- McProfile *profile = NULL;
- McProfilePrivate *priv;
- struct stat buf;
- gchar *filename = _mc_profile_filename (unique_name);
-
- if (0 != g_stat (filename, &buf))
- goto OUT;
-
- if (NULL == profile_cache)
- profile_cache = g_hash_table_new_full (
- g_str_hash, g_str_equal, g_free, g_object_unref);
-
- profile = g_hash_table_lookup (profile_cache, unique_name);
-
- if (NULL != profile && _mc_profile_mtime (profile) >= buf.st_mtime)
- {
- g_object_ref (profile);
- goto OUT;
- }
-
- profile = (McProfile *) g_object_new (MC_TYPE_PROFILE, NULL);
- priv = MC_PROFILE_PRIV (profile);
- priv->unique_name = g_strdup (unique_name);
- priv->mtime = buf.st_mtime;
- g_hash_table_replace (profile_cache, g_strdup (unique_name), profile);
- g_object_ref (profile);
-
-OUT:
- g_free (filename);
- return profile;
-}
-
-static const gchar**
-_mc_profile_get_dirs (void)
-{
- GSList *dir_list = NULL, *slist;
- const gchar *dirname;
- static gchar **profile_dirs = NULL;
- guint n;
-
- if (profile_dirs) return (const gchar **)profile_dirs;
-
- dirname = g_getenv ("MC_PROFILE_DIR");
- if (dirname && g_file_test (dirname, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, (gchar *)dirname);
-
- if (PROFILES_DIR[0] == '/')
- {
- if (g_file_test (PROFILES_DIR, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, PROFILES_DIR);
- }
- else
- {
- const gchar * const *dirs;
- gchar *dir;
-
- dir = g_build_filename (g_get_user_data_dir(), PROFILES_DIR, NULL);
- if (g_file_test (dir, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, dir);
- else g_free (dir);
-
- dirs = g_get_system_data_dirs();
- for (dirname = *dirs; dirname; dirs++, dirname = *dirs)
- {
- dir = g_build_filename (dirname, PROFILES_DIR, NULL);
- if (g_file_test (dir, G_FILE_TEST_IS_DIR))
- dir_list = g_slist_prepend (dir_list, dir);
- else g_free (dir);
- }
- }
-
- /* build the string array */
- n = g_slist_length (dir_list);
- profile_dirs = g_new (gchar *, n + 1);
- profile_dirs[n--] = NULL;
- for (slist = dir_list; slist; slist = slist->next)
- profile_dirs[n--] = slist->data;
- g_slist_free (dir_list);
- return (const gchar **)profile_dirs;
-}
-
-static gchar *
-_mc_profile_filename (const gchar *name)
-{
- const gchar **profile_dirs;
- const gchar *dirname;
- gchar *filename, *filepath = NULL;
-
- profile_dirs = _mc_profile_get_dirs ();
- if (!profile_dirs) return NULL;
-
- filename = g_strconcat (name, PROFILE_SUFFIX, NULL);
- for (dirname = *profile_dirs; dirname; profile_dirs++, dirname = *profile_dirs)
- {
- filepath = g_build_filename (dirname, filename, NULL);
- if (g_file_test (filepath, G_FILE_TEST_EXISTS)) break;
- g_free (filepath);
- filepath = NULL;
- }
- g_free (filename);
- return filepath;
-}
-
-static gboolean
-_mc_profile_load (McProfile *profile)
-{
- gchar *filename;
- GKeyFile *keyfile;
- GError *error = NULL;
- gchar *caps, *localization_domain;
- gchar **keys, **tmp;
- McProfilePrivate *priv;
- gchar **presences_str;
- GEnumClass *presences_class;
- gsize length;
- guint i;
-
- priv = MC_PROFILE_PRIV (profile);
-
- if (priv->loaded)
- return TRUE;
-
- filename = _mc_profile_filename (priv->unique_name);
-
- keyfile = g_key_file_new ();
- if (!g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error))
- {
- g_debug ("%s: loading %s failed: %s", G_STRFUNC, filename, error->message);
- g_error_free (error);
- return FALSE;
- }
-
- priv->configuration_ui = g_key_file_get_string (keyfile, PROFILE_GROUP, "ConfigurationUI", NULL);
- priv->display_name = g_key_file_get_string (keyfile, PROFILE_GROUP, "DisplayName", NULL);
- priv->icon_name = g_key_file_get_string (keyfile, PROFILE_GROUP, "IconName", NULL);
- priv->branding_icon_name = g_key_file_get_string (keyfile, PROFILE_GROUP, "BrandingIconName", NULL);
- priv->manager = g_key_file_get_string (keyfile, PROFILE_GROUP, "Manager", NULL);
- priv->protocol = g_key_file_get_string (keyfile, PROFILE_GROUP, "Protocol", NULL);
- priv->vcard_field = g_key_file_get_string (keyfile, PROFILE_GROUP, "VCardField", NULL);
- priv->vcard_default = g_key_file_get_boolean (keyfile, PROFILE_GROUP, "VCardDefault", NULL);
- priv->default_account_domain = g_key_file_get_string (keyfile, PROFILE_GROUP, "DefaultAccountDomain", NULL);
- priv->avatar_mime_type = g_key_file_get_string (keyfile, PROFILE_GROUP, "AvatarMimeType", NULL);
- priv->default_account_name = g_key_file_get_string (keyfile, PROFILE_GROUP, "DefaultAccountName", NULL);
- priv->priority = g_key_file_get_integer (keyfile, PROFILE_GROUP, "Priority", NULL);
- localization_domain = g_key_file_get_string (keyfile, PROFILE_GROUP, "LocalizationDomain", NULL);
- if (localization_domain)
- {
- gchar *display_name;
-
- display_name = g_strdup (dgettext (localization_domain,
- priv->display_name));
- g_free (priv->display_name);
- priv->display_name = display_name;
- g_free (localization_domain);
- }
-
- g_key_file_set_list_separator (keyfile, ',');
- presences_str = g_key_file_get_string_list (keyfile, PROFILE_GROUP,
- "SupportedPresences", &length,
- NULL);
- if (!presences_str) length = 0;
- presences_class = g_type_class_ref (MC_TYPE_PRESENCE);
- priv->supported_presences = g_array_sized_new (TRUE, FALSE,
- sizeof (McPresence), length);
- for (i = 0; i < length; i++)
- {
- McPresence presence;
- GEnumValue *value;
- gchar *presence_str;
-
- presence_str = g_strstrip (presences_str[i]);
- value = g_enum_get_value_by_nick (presences_class,
- presence_str);
- if (!value)
- {
- g_warning ("Unrecognized presence `%s'", presence_str);
- continue;
- }
- presence = value->value;
- g_array_append_val (priv->supported_presences, presence);
- }
- g_type_class_unref (presences_class);
- g_strfreev (presences_str);
-
- /* :D */
- caps = g_key_file_get_string (keyfile, PROFILE_GROUP, "Capabilities", NULL);
- if (caps)
- {
- g_strdelimit (caps, " ,;", ':');
- priv->capabilities =
- g_parse_debug_string (caps, capabilities,
- sizeof (capabilities) / sizeof (GDebugKey));
- g_free (caps);
- }
-
- /* fill in the defaul settings hash */
- priv->default_settings = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) g_free);
- keys = g_key_file_get_keys (keyfile, PROFILE_GROUP, 0, NULL);
- for (tmp = keys; *tmp != NULL; tmp++)
- {
- gchar *key = *tmp;
- if (0 == g_ascii_strncasecmp ("Default-", key, 8))
- {
- gchar *k, *v;
- k = g_strdup (key+8);
- v = g_key_file_get_string (keyfile, PROFILE_GROUP, key, NULL);
- g_hash_table_insert (MC_PROFILE_PRIV (profile)->default_settings, k, v);
- }
- }
- g_strfreev (keys);
-
- /* fill in the vcard mangling hashtable */
- priv->vcard_mangle_hash = g_hash_table_new_full (
- g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) g_free);
-
- keys = g_key_file_get_keys (keyfile, PROFILE_GROUP, 0, NULL);
- for (tmp = keys; *tmp != NULL; tmp++)
- {
- gchar *key = *tmp;
- if (0 == g_ascii_strncasecmp ("Mangle-", key, 7))
- {
- gchar *k, *v;
- k = g_strdup (key + 7);
- v = g_key_file_get_string (keyfile, PROFILE_GROUP, key, NULL);
- g_hash_table_insert (MC_PROFILE_PRIV (profile)->vcard_mangle_hash, k, v);
- /* g_debug("inserted mangle: %s -> %s", k, v); */
- }
- }
- g_strfreev (keys);
-
- g_key_file_free (keyfile);
- g_free (filename);
-
- priv->loaded = TRUE;
- return TRUE;
-}
-
-/**
- * mc_profile_lookup:
- * @unique_name: The unique name of the profile.
- *
- * Get the profile whose unique name is the one specified. If no profile with
- * that name exists, a new one is created. The returned object's reference
- * count is incremented.
- *
- * Return value: The #McProfile.
- */
-McProfile *
-mc_profile_lookup (const gchar *unique_name)
-{
- g_return_val_if_fail (unique_name != NULL, NULL);
- g_return_val_if_fail (*unique_name != '\0', NULL);
-
- return _mc_profile_new (unique_name);
-}
-
-/**
- * mc_profile_lookup_default_for_vcard_field:
- * @vcard_field: The vcard field.
- *
- * Get the profile whose vcard field is the one specified.
- * The returned object's reference count is incremented.
- *
- * Return value: The #McProfile.
- */
-McProfile *
-mc_profile_lookup_default_for_vcard_field (const gchar *vcard_field)
-{
- McProfile *ret = NULL;
- GList *list, *tmp;
-
- g_return_val_if_fail (vcard_field != NULL, NULL);
- g_return_val_if_fail (*vcard_field != '\0', NULL);
-
- list = mc_profiles_list ();
-
- for (tmp = list;
- tmp != NULL;
- tmp = tmp->next)
- {
- McProfile *cur = (McProfile *) tmp->data;
- McProfilePrivate *priv = MC_PROFILE_PRIV (cur);
-
- /* free the profile if we've found the desired value,
- * or we're unable to load this one */
- if (ret != NULL ||
- !_mc_profile_load (cur))
- {
- g_object_unref (cur);
- continue;
- }
-
- /* store the profile if it's the desired one,
- * free it otherwise */
- if (priv->vcard_default &&
- 0 == strcmp (priv->vcard_field, vcard_field))
- {
- ret = cur;
- break;
- }
- else
- {
- g_object_unref (cur);
- }
- }
-
- g_list_free (list);
-
- return ret;
-}
-
-/**
- * mc_profile_free:
- * @id: The #McProfile.
- *
- * Frees (unref) the given profile.
- * DEPRECATED, use g_object_unref() instead.
- */
-void
-mc_profile_free (McProfile *id)
-{
- g_object_unref (id);
-}
-
-/**
- * mc_profiles_list:
- *
- * Lists all configured profiles.
- *
- * Returns: a #GList of the profiles (must be freed with #mc_profiles_free_list).
- */
-GList *
-mc_profiles_list (void)
-{
- GDir *dir;
- GError *error = NULL;
- GList *ret = NULL;
- const gchar *filename, *dirname, **profile_dirs;
-
- profile_dirs = _mc_profile_get_dirs ();
- if (!profile_dirs) return NULL;
-
- for (dirname = *profile_dirs; dirname; profile_dirs++, dirname = *profile_dirs)
- {
- dir = g_dir_open(dirname, 0, &error);
- if (!dir)
- {
- g_warning ("%s: unable to open directory %s: %s",
- G_STRFUNC, dirname, error->message);
- g_error_free (error);
- continue;
- }
-
- while ((filename = g_dir_read_name(dir)) != NULL)
- {
- gchar *unique_name;
- McProfile *profile;
-
- if (!g_str_has_suffix (filename, PROFILE_SUFFIX))
- continue;
-
- unique_name = g_strndup (filename,
- strlen(filename) - PROFILE_SUFFIX_LEN);
- profile = _mc_profile_new (unique_name);
- g_free (unique_name);
-
- if (profile)
- ret = g_list_prepend (ret, profile);
- }
-
- g_dir_close (dir);
- }
-
- return ret;
-}
-
-/**
- * mc_profiles_list_by_vcard_field:
- * @vcard_field: The vcard field.
- *
- * Lists all configured profiles with the given vcard field..
- *
- * Returns: a #GList of the profiles (must be freed with #mc_profiles_free_list).
- */
-GList *
-mc_profiles_list_by_vcard_field (const gchar *vcard_field)
-{
- GList *all, *tmp, *ret;
-
- g_return_val_if_fail (vcard_field != NULL, NULL);
- g_return_val_if_fail (*vcard_field != '\0', NULL);
-
- all = mc_profiles_list ();
- ret = NULL;
-
- for (tmp = all;
- tmp != NULL;
- tmp = tmp->next)
- {
- McProfile *cur = (McProfile *) tmp->data;
- McProfilePrivate *priv = MC_PROFILE_PRIV (cur);
-
- if (!_mc_profile_load (cur))
- {
- g_object_unref (cur);
- continue;
- }
-
- if (priv->vcard_field && 0 == strcmp (vcard_field, priv->vcard_field))
- {
- ret = g_list_prepend (ret, cur);
- }
- else
- {
- g_object_unref (cur);
- }
- }
-
- g_list_free (all);
-
- return ret;
-}
-
-/**
- * mc_profiles_list_by_protocol:
- * @protocol: string id of the protocol.
- *
- * Lists all configured profiles for the given protocol.
- *
- * Returns: a #GList of the profiles (must be freed with #mc_profiles_free_list).
- */
-GList *
-mc_profiles_list_by_protocol (const gchar *protocol)
-{
- GList *all, *tmp, *ret;
-
- g_return_val_if_fail (protocol != NULL, NULL);
- g_return_val_if_fail (*protocol != '\0', NULL);
-
- all = mc_profiles_list ();
- ret = NULL;
-
- for (tmp = all;
- tmp != NULL;
- tmp = tmp->next)
- {
- McProfile *cur = (McProfile *) tmp->data;
- McProfilePrivate *priv = MC_PROFILE_PRIV (cur);
-
- if (!_mc_profile_load (cur))
- {
- g_object_unref (cur);
- continue;
- }
-
- if (priv->protocol && 0 == strcmp (protocol, priv->protocol))
- {
- ret = g_list_prepend (ret, cur);
- }
- else
- {
- g_object_unref (cur);
- }
- }
-
- g_list_free (all);
-
- return ret;
-}
-
-/**
- * mc_profiles_free_list:
- * @list: The #GList of #McProfile.
- *
- * Frees a list of profiles.
- */
-void
-mc_profiles_free_list (GList *list)
-{
- GList *tmp;
-
- for (tmp = list; tmp != NULL; tmp = tmp->next)
- {
- McProfile *p = tmp->data;
- g_object_unref (p);
- }
-
- g_list_free (list);
-}
-
-/**
- * mc_profile_get_unique_name:
- * @id: The #McProfile.
- *
- * Get the unique name of the profile.
- *
- * Returns: a string representing the unique name (must not be freed).
- */
-const gchar *
-mc_profile_get_unique_name (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return MC_PROFILE_PRIV(id)->unique_name;
-}
-
-/**
- * mc_profile_get_configuration_ui:
- * @id: The #McProfile.
- *
- * Get the configuration ui of the profile.
- *
- * Returns: a string representing the configuration ui (must not be freed).
- */
-const gchar *
-mc_profile_get_configuration_ui (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return MC_PROFILE_PRIV (id)->configuration_ui;
-}
-
-/**
- * mc_profile_get_display_name:
- * @id: The #McProfile.
- *
- * Get the display name of the profile.
- *
- * Returns: a string representing the display name (must not be freed).
- */
-const gchar *
-mc_profile_get_display_name (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return MC_PROFILE_PRIV (id)->display_name;
-}
-
-/**
- * mc_profile_get_icon_name:
- * @id: The #McProfile.
- *
- * Get the icon name of the profile.
- *
- * Returns: a string representing the icon name (must not be freed).
- */
-const gchar *
-mc_profile_get_icon_name (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return MC_PROFILE_PRIV (id)->icon_name;
-}
-
-/**
- * mc_profile_get_branding_icon_name:
- * @id: The #McProfile.
- *
- * Get the branding icon name of the profile.
- *
- * Returns: a string representing the branding icon name (must not be freed).
- */
-const gchar *
-mc_profile_get_branding_icon_name (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return MC_PROFILE_PRIV (id)->branding_icon_name;
-}
-
-/**
- * mc_profile_get_supported_presences:
- * @id: The #McProfile.
- *
- * Checks what presence states are supported by this profile.
- *
- * Returns: a zero-terminated array listing all the supported #McPresence.
- * It must not be freed.
- */
-const McPresence *
-mc_profile_get_supported_presences (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return (McPresence *)(MC_PROFILE_PRIV (id)->supported_presences->data);
-}
-
-/*
- * mc_profile_supports_presence:
- * @id: The #McProfile.
- * @presence: The #McPresence.
- *
- * Tests whether the profile supports the presence @presence.
- *
- * Returns: a #gboolean.
- */
-gboolean
-mc_profile_supports_presence (McProfile *id, McPresence presence)
-{
- const McPresence *presences;
-
- presences = mc_profile_get_supported_presences (id);
- if (!presences) return FALSE;
-
- while (*presences)
- {
- if (*presences == presence)
- return TRUE;
- presences++;
- }
- return FALSE;
-}
-
-/**
- * mc_profile_get_protocol:
- * @id: The #McProfile.
- *
- * gets the protocol in use for this profile.
- *
- * Returns: a #McProtocol, or NULL if some error occurs.
- */
-McProtocol *
-mc_profile_get_protocol (McProfile *id)
-{
- McManager *manager;
- McProtocol *protocol;
- McProfilePrivate *priv = MC_PROFILE_PRIV (id);
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- manager = mc_manager_lookup (priv->manager);
- if (!manager) return NULL;
-
- protocol = mc_protocol_lookup (manager, priv->protocol);
- g_object_unref (manager);
-
- g_return_val_if_fail (protocol != NULL, NULL);
- return protocol;
-}
-
-/**
- * mc_profile_get_protocol_name:
- * @id: The #McProfile.
- *
- * Get the protocol name of the profile.
- *
- * Returns: a string representing the protocol name (must not be freed).
- */
-const gchar *
-mc_profile_get_protocol_name (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return MC_PROFILE_PRIV (id)->protocol;
-}
-
-/**
- * mc_profile_get_vcard_field:
- * @id: The #McProfile.
- *
- * Get the vcard field of the profile.
- *
- * Returns: a string representing the vcard field (must not be freed).
- */
-const gchar *
-mc_profile_get_vcard_field (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return MC_PROFILE_PRIV (id)->vcard_field;
-}
-
-/**
- * mc_profile_get_default_account_domain:
- * @id: The #McProfile.
- *
- * Get the default account domain of the profile.
- *
- * Returns: a string representing the default account domain (must not be
- * freed).
- */
-const gchar *
-mc_profile_get_default_account_domain (McProfile *id)
-{
- McProfilePrivate *priv = MC_PROFILE_PRIV (id);
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
- g_return_val_if_fail (
- priv->capabilities & MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT, NULL);
-
- return priv->default_account_domain;
-}
-
-/**
- * mc_profile_get_avatar_mime_type:
- * @id: The #McProfile.
- *
- * Get the preferred MIME type for the avatar.
- *
- * Returns: a string representing the MIME type (must not be freed).
- */
-const gchar *
-mc_profile_get_avatar_mime_type (McProfile *id)
-{
- McProfilePrivate *priv = MC_PROFILE_PRIV (id);
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return priv->avatar_mime_type;
-}
-
-/**
- * mc_profile_get_default_account_name:
- * @id: The #McProfile.
- *
- * Get the default account display name.
- *
- * Returns: a string representing the default account display name (must not be
- * freed).
- */
-const gchar *
-mc_profile_get_default_account_name (McProfile *id)
-{
- McProfilePrivate *priv = MC_PROFILE_PRIV (id);
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return priv->default_account_name;
-}
-
-/**
- * mc_profile_get_priority:
- * @id: The #McProfile.
- *
- * Get the priority of the profile, as an integer number.
- *
- * Returns: the profile priority (0 meaning normal).
- */
-gint
-mc_profile_get_priority (McProfile *id)
-{
- McProfilePrivate *priv = MC_PROFILE_PRIV (id);
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, 0);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, 0);
-
- return priv->priority;
-}
-
-/**
- * mc_profile_is_default_for_vcard_field:
- * @id: The #McProfile.
- *
- * Checks if this is the default profile for the given vcard field.
- *
- * Returns: a gboolean.
- */
-gboolean
-mc_profile_is_default_for_vcard_field (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, FALSE);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, FALSE);
-
- return MC_PROFILE_PRIV (id)->vcard_default;
-}
-
-/**
- * mc_profile_get_capabilities:
- * @id: The #McProfile.
- *
- * Gets the capabilities of this profile.
- *
- * Returns: a combination of #McProfileCapabilityFlags.
- */
-McProfileCapabilityFlags
-mc_profile_get_capabilities (McProfile *id)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, 0);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, 0);
-
- return MC_PROFILE_PRIV (id)->capabilities;
-}
-
-/**
- * mc_profile_get_default_setting:
- * @id: The #McProfile.
- * @setting: The setting for which default value has to be retrieved.
- *
- * Get the default value of a setting of the profile.
- *
- * Returns: a string representing the default setting (must not be freed).
- */
-const gchar *
-mc_profile_get_default_setting (McProfile *id, const gchar *setting)
-{
- McProtocol *proto;
- GSList *params, *tmp;
- McProtocolParam *param;
- const gchar *def;
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
- g_return_val_if_fail (setting != NULL, NULL);
- g_return_val_if_fail (*setting != '\0', NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- def = (const gchar *) g_hash_table_lookup (MC_PROFILE_PRIV (id)->default_settings, setting);
-
- if (def)
- {
- return def;
- }
-
- proto = mc_profile_get_protocol (id);
- if (!proto) return NULL;
- params = mc_protocol_get_params (proto);
-
- for (tmp = params; tmp != NULL; tmp = tmp->next)
- {
- param = (McProtocolParam *) tmp->data;
-
- if ((NULL != param) && (NULL != param->name)
- && (0 == strcmp(param->name, setting)))
- {
- def = param->def;
- }
- }
-
- mc_protocol_free_params_list (params);
- return def;
-}
-
-/**
- * mc_profile_get_vcard_mangle:
- * @id: The #McProfile.
- * @vcard_field: The vcard field for which to get the mangle
- *
- * Get a mangle to transform a foreign address to a handle this profile understands
- *
- * Returns: a string representing the mangle from the profile (must not be freed).
- */
-const gchar *
-mc_profile_get_vcard_mangle (McProfile *id, const gchar *vcard_field)
-{
- gboolean profile_loaded;
-
- g_return_val_if_fail (id != NULL, NULL);
- g_return_val_if_fail (vcard_field != NULL, NULL);
- g_return_val_if_fail (*vcard_field != '\0', NULL);
-
- profile_loaded = _mc_profile_load (id);
- g_return_val_if_fail (profile_loaded, NULL);
-
- return (const gchar *) g_hash_table_lookup (MC_PROFILE_PRIV (id)->vcard_mangle_hash, vcard_field);
-}
-
diff --git a/libmissioncontrol/mc-profile.h b/libmissioncontrol/mc-profile.h
deleted file mode 100644
index 3309ae4..0000000
--- a/libmissioncontrol/mc-profile.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_PROFILE_H__
-#define __MC_PROFILE_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libmissioncontrol/mc-protocol.h>
-
-G_BEGIN_DECLS
-
-typedef enum
-{
- MC_PROFILE_CAPABILITY_NONE = 0,
- MC_PROFILE_CAPABILITY_CHAT_P2P = 1 << 0,
- MC_PROFILE_CAPABILITY_CHAT_ROOM = 1 << 1,
- MC_PROFILE_CAPABILITY_CHAT_ROOM_LIST = 1 << 2,
- MC_PROFILE_CAPABILITY_VOICE_P2P = 1 << 3,
- MC_PROFILE_CAPABILITY_CONTACT_SEARCH = 1 << 4,
- MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT = 1 << 5,
- MC_PROFILE_CAPABILITY_REGISTRATION_UI = 1 << 6,
- MC_PROFILE_CAPABILITY_SUPPORTS_AVATARS = 1 << 7,
- MC_PROFILE_CAPABILITY_SUPPORTS_ALIAS = 1 << 8,
- MC_PROFILE_CAPABILITY_SUPPORTS_ROSTER = 1 << 9,
- MC_PROFILE_CAPABILITY_VIDEO_P2P = 1 << 10,
-} McProfileCapabilityFlags;
-
-typedef struct {
- GObject parent;
- gpointer priv;
-} McProfile;
-
-#define MC_TYPE_PROFILE mc_profile_get_type()
-
-#define MC_PROFILE(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MC_TYPE_PROFILE, McProfile))
-
-#define MC_PROFILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MC_TYPE_PROFILE, McProfilewClass))
-
-#define MC_IS_PROFILE(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MC_TYPE_PROFILE))
-
-#define MC_IS_PROFILE_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MC_TYPE_PROFILE))
-
-#define MC_PROFILE_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MC_TYPE_PROFILE, McProfilewClass))
-
-typedef struct {
- GObjectClass parent_class;
-} McProfileClass;
-
-#include <libmissioncontrol/mission-control.h>
-
-GType mc_profile_get_type (void);
-
-/* to find one profile */
-McProfile *mc_profile_lookup (const gchar *unique_name);
-McProfile *mc_profile_lookup_default_for_vcard_field (const gchar *vcard_field);
-#ifndef MC_DISABLE_DEPRECATED
-void mc_profile_free (McProfile *id);
-#endif
-void mc_profile_clear_cache (void);
-
-/* to find many profiles */
-GList *mc_profiles_list (void);
-GList *mc_profiles_list_by_vcard_field (const gchar *vcard_field);
-GList *mc_profiles_list_by_protocol (const gchar *protocol);
-void mc_profiles_free_list (GList *list);
-
-const gchar *mc_profile_get_unique_name (McProfile *id);
-const gchar *mc_profile_get_configuration_ui (McProfile *id);
-const gchar *mc_profile_get_display_name (McProfile *id);
-const gchar *mc_profile_get_icon_name (McProfile *id);
-const gchar *mc_profile_get_branding_icon_name (McProfile *id);
-const gchar *mc_profile_get_vcard_field (McProfile *id);
-const gchar *mc_profile_get_default_account_domain (McProfile *id);
-const gchar *mc_profile_get_avatar_mime_type (McProfile *id);
-const McPresence *mc_profile_get_supported_presences (McProfile *id);
-gboolean mc_profile_supports_presence (McProfile *id, McPresence presence);
-McProtocol *mc_profile_get_protocol (McProfile *id);
-gint mc_profile_get_priority (McProfile *id);
-const gchar *mc_profile_get_default_account_name (McProfile *id);
-
-/* only use this protocol name instead of the real McProfile if you do
- * not care about being able to discover the correct connection manager
- * and hence which options are valid when connecting a certain account.
- * without the manager name also, the protocol name is not sufficient
- * to look up an McProfile. this is intentional. */
-const gchar *mc_profile_get_protocol_name (McProfile *id);
-
-gboolean mc_profile_is_default_for_vcard_field (McProfile *id);
-McProfileCapabilityFlags mc_profile_get_capabilities (McProfile *id);
-const gchar *mc_profile_get_default_setting (McProfile *id, const gchar *setting);
-const gchar *mc_profile_get_vcard_mangle (McProfile *id, const gchar *vcard_field);
-
-G_END_DECLS
-
-#endif /* __MC_PROFILE_H__ */
diff --git a/libmissioncontrol/mc-protocol-priv.h b/libmissioncontrol/mc-protocol-priv.h
deleted file mode 100644
index 9be7739..0000000
--- a/libmissioncontrol/mc-protocol-priv.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_PROTOCOL_PRIV_H__
-#define __MC_PROTOCOL_PRIV_H__
-
-McProtocol * _mc_protocol_from_keyfile (
- GKeyFile *keyfile, const gchar *manager_name, const gchar *group_name,
- const gchar *unique_name);
-
-#endif /* __MC_PROTOCOL_PRIV_H__ */
-
diff --git a/libmissioncontrol/mc-protocol.c b/libmissioncontrol/mc-protocol.c
deleted file mode 100644
index 2ccb13a..0000000
--- a/libmissioncontrol/mc-protocol.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include "config.h"
-#undef MC_DISABLE_DEPRECATED
-#include "mc-protocol.h"
-#define MC_DISABLE_DEPRECATED
-
-#define DBUS_API_SUBJECT_TO_CHANGE 1
-
-#include <dbus/dbus.h>
-#include <glib.h>
-#include <string.h>
-
-#include "mc-manager.h"
-#include "mc-manager-priv.h"
-
-#include "mc-protocol-priv.h"
-
-#define MC_PROTOCOL_PRIV(protocol) ((McProtocolPrivate *)protocol->priv)
-
-G_DEFINE_TYPE (McProtocol, mc_protocol, G_TYPE_OBJECT);
-
-typedef struct
-{
- gchar *manager;
- gchar *name;
- GSList *params;
-} McProtocolPrivate;
-
-static void
-mc_protocol_init (McProtocol *self)
-{
- self->priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
- MC_TYPE_PROTOCOL, McProtocolPrivate);
-}
-
-static McProtocol *
-_mc_protocol_new (const gchar *manager, const gchar *name, GSList *params)
-{
- McProtocol *new = g_object_new (MC_TYPE_PROTOCOL, NULL);
- McProtocolPrivate *priv = MC_PROTOCOL_PRIV (new);
-
- priv->manager = g_strdup (manager);
- priv->name = g_strdup (name);
- priv->params = params;
- return new;
-}
-
-static void
-mc_protocol_finalize (GObject *object)
-{
- McProtocol *protocol = MC_PROTOCOL (object);
- McProtocolPrivate *priv = MC_PROTOCOL_PRIV (protocol);
- McProtocolParam *param;
- GSList *i;
-
- g_free (priv->manager);
- g_free (priv->name);
-
- for (i = priv->params; NULL != i; i = i->next)
- {
- param = (McProtocolParam *) i->data;
-
- g_free (i->data);
- }
-
- g_slist_free (priv->params);
-}
-
-static void
-mc_protocol_class_init (McProtocolClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (McProtocolPrivate));
- object_class->finalize = mc_protocol_finalize;
-}
-
-/**
- * mc_protocol_lookup:
- * @id: The #McManager.
- * @protocol: The protocol name.
- *
- * Looks up the protocol having the given name in the manager's supported
- * protocols. The returned object's reference count is incremented.
- *
- * Returns: the #McProtocol, or NULL if not found.
- */
-McProtocol *
-mc_protocol_lookup (McManager *manager, const gchar *protocol)
-{
- return _mc_manager_protocol_lookup (manager, protocol);
-}
-
-/**
- * mc_protocol_free:
- * @id: The #McProtocol.
- *
- * Frees (unrefs) the protocol.
- * DEPRECATED, use g_object_unref() instead.
- */
-void
-mc_protocol_free (McProtocol *id)
-{
- g_return_if_fail (id != NULL);
-
- g_object_unref (id);
-}
-
-/**
- * mc_protocols_list:
- *
- * Lists all supported protocols. <emphasis>This currently lists all protocols
- * supported by the "gabble" manager</emphasis>.
- *
- * Returns: a #GList of #McProtocol, to be freed with #mc_protocols_free_list.
- */
-GList *
-mc_protocols_list (void)
-{
- return mc_protocols_list_by_manager (mc_manager_lookup ("gabble"));
-}
-
-/**
- * mc_protocols_list_by_manager:
- * @id: a #McManager.
- *
- * Lists all protocols supported by the given manager.
- *
- * Returns: a #GList of #McProtocol, to be freed with #mc_protocols_free_list.
- */
-GList *
-mc_protocols_list_by_manager (McManager *id)
-{
- return g_list_prepend (NULL, mc_protocol_lookup (id, "jabber"));
-}
-
-/**
- * mc_protocols_free_list:
- * @list: a #GList of #McProtocol.
- *
- * Frees a list of protocols.
- */
-void
-mc_protocols_free_list (GList *list)
-{
- GList *tmp;
-
- for (tmp = list; tmp != NULL; tmp = tmp->next)
- g_object_unref ((McProtocol *) tmp->data);
-
- g_list_free (list);
-}
-
-/**
- * mc_protocol_get_manager:
- * @id: The #McProtocol.
- *
- * Gets the manager for this protocol.
- *
- * Returns: the #McManager, or NULL if some error occurred.
- */
-McManager *
-mc_protocol_get_manager (McProtocol *id)
-{
- g_return_val_if_fail (id != NULL, NULL);
-
- return mc_manager_lookup (MC_PROTOCOL_PRIV (id)->manager);
-}
-
-/**
- * mc_protocol_get_name:
- * @id: The #McProtocol.
- *
- * Gets the name of this protocol.
- *
- * Returns: a string representing the name (not to be freed)
- */
-const gchar *
-mc_protocol_get_name (McProtocol *id)
-{
- g_return_val_if_fail (id != NULL, NULL);
-
- return MC_PROTOCOL_PRIV (id)->name;
-}
-
-/**
- * mc_protocol_get_params:
- * @protocol: The #McProtocol.
- *
- * Gets the parameters for this protocol.
- *
- * Returns: a #GList of #McProtocolParam, to be freed with
- * #mc_protocol_free_params_list.
- */
-GSList *
-mc_protocol_get_params (McProtocol *protocol)
-{
- McProtocolPrivate *priv = MC_PROTOCOL_PRIV (protocol);
-
- return g_slist_copy (priv->params);
-}
-
-/**
- * mc_protocol_free_params_list:
- * @list: The #GList.
- *
- * Frees a list of #McProtocolParam.
- */
-void
-mc_protocol_free_params_list (GSList *list)
-{
- g_slist_free (list);
-}
-
-static McProtocolParam *
-_parse_parameter (const gchar *name, const gchar *s)
-{
- McProtocolParam *new;
- gchar **bits;
- gchar **i;
-
- bits = g_strsplit (s, " ", 0);
-
- if (NULL == *bits)
- {
- g_debug ("%s: param \"%s\" has no signature", G_STRFUNC, name);
- return NULL;
- }
-
- if (1 != strlen (*bits))
- {
- g_debug ("%s: param \"%s\" has invalid signature", G_STRFUNC, name);
- return NULL;
- }
-
- new = g_new0 (McProtocolParam, 1);
- new->name = g_strdup (name);
- new->signature = g_strdup (*bits);
- new->def = NULL;
-
- for (i = bits + 1; NULL != *i; i++)
- {
- if (0 == strcmp (*i, "required"))
- new->flags |= MC_PROTOCOL_PARAM_REQUIRED;
- else if (0 == strcmp (*i, "register"))
- new->flags |= MC_PROTOCOL_PARAM_REGISTER;
- else
- g_debug ("%s: unrecognised parameter flag \"%s\"", G_STRFUNC, *i);
- }
-
- g_strfreev (bits);
- return new;
-}
-
-#define PREFIX_PARAM "param-"
-#define PREFIX_PARAM_LEN 6
-#define PREFIX_DEFAULT "default-"
-#define PREFIX_DEFAULT_LEN 8
-
-static gint
-find_param_by_name_func(gconstpointer a, gconstpointer b)
-{
- McProtocolParam *param = (McProtocolParam *) a;
- const gchar *name = (const gchar *) b;
-
- return !((NULL != param->name) && (NULL != name)
- && (0 == strcmp(param->name, name)));
-}
-
-McProtocol *
-_mc_protocol_from_keyfile (GKeyFile *keyfile, const gchar *manager_name,
- const gchar *group_name, const gchar *name)
-{
- GSList *params = NULL;
- gchar **keys;
- gchar **i;
-
- g_assert (name);
- keys = g_key_file_get_keys (keyfile, group_name, NULL, NULL);
-
- if (!keys)
- {
- g_debug ("%s: failed to get keys from file", G_STRFUNC);
- return NULL;
- }
-
- for (i = keys; NULL != *i; i++)
- {
- McProtocolParam *param;
- const gchar *key = *i;
- gchar *value = g_key_file_get_string (keyfile, group_name, key, NULL);
-
- if (0 == strncmp (key, PREFIX_PARAM, PREFIX_PARAM_LEN))
- {
- key += PREFIX_PARAM_LEN;
- param = _parse_parameter (key, value);
-
- if (param)
- params = g_slist_prepend (params, param);
- }
- else if (0 == strncmp (key, PREFIX_DEFAULT, PREFIX_DEFAULT_LEN))
- {
- GSList *node;
-
- key += PREFIX_DEFAULT_LEN;
- node = g_slist_find_custom (params, key, find_param_by_name_func);
-
- if (node)
- {
- param = (McProtocolParam *) node->data;
-
- if (!param->def)
- param->def = g_strdup(value);
- else
- g_warning("%s: encountered multiple default values for parameter \"%s\"", G_STRFUNC, name);
- }
- }
- else
- {
- g_debug ("%s: unrecognised protocol key \"%s\"", G_STRFUNC, key);
- }
-
- g_free (value);
- }
-
- g_strfreev (keys);
-
- return _mc_protocol_new (manager_name, name, params);
-}
-
-/**
- * mc_protocol_print:
- * @protocol: the #McProtocol.
- *
- * Prints the protocol name and all protocol parameters via #g_print.
- */
-void
-mc_protocol_print (McProtocol *protocol)
-{
- GSList *i;
-
- g_print ("protocol: %s\n", mc_protocol_get_name (protocol));
-
- for (i = mc_protocol_get_params (protocol); NULL != i; i = i->next)
- {
- McProtocolParam *param = (McProtocolParam *) i->data;
-
- g_print (" %s:%s:%s\n", param->signature, param->name, param->def);
- }
-}
-
diff --git a/libmissioncontrol/mc-protocol.h b/libmissioncontrol/mc-protocol.h
deleted file mode 100644
index 013b5a4..0000000
--- a/libmissioncontrol/mc-protocol.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_PROTOCOL_H__
-#define __MC_PROTOCOL_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libmissioncontrol/mc-manager.h>
-
-G_BEGIN_DECLS
-
-#define MC_TYPE_PROTOCOL mc_protocol_get_type()
-
-#define MC_PROTOCOL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MC_TYPE_PROTOCOL, McProtocol))
-
-#define MC_PROTOCOL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MC_TYPE_PROTOCOL, McProtocolClass))
-
-#define MC_IS_PROTOCOL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MC_TYPE_PROTOCOL))
-
-#define MC_IS_PROTOCOL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MC_TYPE_PROTOCOL))
-
-#define MC_PROTOCOL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MC_TYPE_PROTOCOL, McProtocolClass))
-
-GType mc_protocol_get_type (void);
-
-typedef struct {
- GObject parent;
- gpointer priv;
-} McProtocol;
-
-typedef struct {
- GObjectClass parent_class;
-} McProtocolClass;
-
-/* protocols are only unique within the context of a particular manager */
-McProtocol *mc_protocol_lookup (McManager *id, const gchar *protocol);
-#ifndef MC_DISABLE_DEPRECATED
-void mc_protocol_free (McProtocol *id);
-#endif
-
-GList *mc_protocols_list (void);
-GList *mc_protocols_list_by_manager (McManager *id);
-void mc_protocols_free_list (GList *list);
-
-McManager *mc_protocol_get_manager (McProtocol *id);
-const gchar *mc_protocol_get_name (McProtocol *id);
-
-enum
-{
- MC_PROTOCOL_PARAM_REQUIRED = 1 << 0,
- MC_PROTOCOL_PARAM_REGISTER = 1 << 1
-};
-
-/* return type for params */
-typedef struct
-{
- const gchar *name;
- const gchar *signature;
- const gchar *def;
- guint flags;
-} McProtocolParam;
-
-/* Returns list of McProtocolParam. */
-GSList *mc_protocol_get_params (McProtocol *protocol);
-
-/* Frees the lists above and all data */
-void mc_protocol_free_params_list (GSList *list);
-
-void mc_protocol_print (McProtocol *protocol);
-
-G_END_DECLS
-
-#endif /* __MC_PROTOCOL_H__ */
diff --git a/libmissioncontrol/mc-remap.h b/libmissioncontrol/mc-remap.h
deleted file mode 100644
index f44603f..0000000
--- a/libmissioncontrol/mc-remap.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2008 Nokia Corporation.
- *
- * Contact: Alberto Mardegan <alberto.mardegan at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_REMAP_H__
-#define __MC_REMAP_H__
-
-
-#define mc_account_create omc_account_create
-#define mc_account_delete omc_account_delete
-#define mc_account_free omc_account_free
-#define mc_account_get_alias omc_account_get_alias
-#define mc_account_get_avatar omc_account_get_avatar
-#define mc_account_get_avatar_id omc_account_get_avatar_id
-#define mc_account_get_display_name omc_account_get_display_name
-#define mc_account_get_normalized_name omc_account_get_normalized_name
-#define mc_account_get_param_boolean omc_account_get_param_boolean
-#define mc_account_get_param_int omc_account_get_param_int
-#define mc_account_get_param_string omc_account_get_param_string
-#define mc_account_get_params omc_account_get_params
-#define mc_account_get_profile omc_account_get_profile
-#define mc_account_get_secondary_vcard_fields omc_account_get_secondary_vcard_fields
-#define mc_account_get_supported_presences omc_account_get_supported_presences
-#define mc_account_get_type omc_account_get_type
-#define mc_account_get_unique_name omc_account_get_unique_name
-#define mc_account_is_complete omc_account_is_complete
-#define mc_account_is_enabled omc_account_is_enabled
-#define mc_account_lookup omc_account_lookup
-#define mc_account_lookup_with_profile omc_account_lookup_with_profile
-#define mc_account_lookup_with_vcard_field omc_account_lookup_with_vcard_field
-#define mc_account_manager_proxy_get_type omc_account_manager_proxy_get_type
-#define mc_account_monitor_get_supported_presences omc_account_monitor_get_supported_presences
-#define mc_account_monitor_get_type omc_account_monitor_get_type
-#define mc_account_monitor_new omc_account_monitor_new
-#define mc_account_proxy_get_type omc_account_proxy_get_type
-#define mc_account_reset_avatar_id omc_account_reset_avatar_id
-#define mc_account_set_alias omc_account_set_alias
-#define mc_account_set_avatar omc_account_set_avatar
-#define mc_account_set_avatar_from_data omc_account_set_avatar_from_data
-#define mc_account_set_avatar_mime_type omc_account_set_avatar_mime_type
-#define mc_account_set_avatar_token omc_account_set_avatar_token
-#define mc_account_set_display_name omc_account_set_display_name
-#define mc_account_set_enabled omc_account_set_enabled
-#define mc_account_set_normalized_name omc_account_set_normalized_name
-#define mc_account_set_param_boolean omc_account_set_param_boolean
-#define mc_account_set_param_int omc_account_set_param_int
-#define mc_account_set_param_string omc_account_set_param_string
-#define mc_account_set_secondary_vcard_fields omc_account_set_secondary_vcard_fields
-#define mc_account_supports_presence omc_account_supports_presence
-#define mc_account_unset_param omc_account_unset_param
-#define mc_accounts_filter omc_accounts_filter
-#define mc_accounts_list omc_accounts_list
-#define mc_accounts_list_by_enabled omc_accounts_list_by_enabled
-#define mc_accounts_list_by_profile omc_accounts_list_by_profile
-#define mc_accounts_list_by_secondary_vcard_field omc_accounts_list_by_secondary_vcard_field
-#define mc_accounts_list_by_vcard_field omc_accounts_list_by_vcard_field
-#define mc_accounts_list_free omc_accounts_list_free
-#define mc_cli_account_call_remove omc_cli_account_call_remove
-#define mc_cli_account_call_update_parameters omc_cli_account_call_update_parameters
-#define mc_cli_account_connect_to_account_property_changed omc_cli_account_connect_to_account_property_changed
-#define mc_cli_account_connect_to_removed omc_cli_account_connect_to_removed
-#define mc_cli_account_do_remove omc_cli_account_do_remove
-#define mc_cli_account_do_update_parameters omc_cli_account_do_update_parameters
-#define mc_cli_account_interface_avatar_connect_to_avatar_changed omc_cli_account_interface_avatar_connect_to_avatar_changed
-#define mc_cli_account_manager_call_create_account omc_cli_account_manager_call_create_account
-#define mc_cli_account_manager_connect_to_account_removed omc_cli_account_manager_connect_to_account_removed
-#define mc_cli_account_manager_connect_to_account_validity_changed omc_cli_account_manager_connect_to_account_validity_changed
-#define mc_cli_account_manager_do_create_account omc_cli_account_manager_do_create_account
-#define mc_cli_dbus_properties_do_get omc_cli_dbus_properties_do_get
-#define mc_cli_dbus_properties_do_get_all omc_cli_dbus_properties_do_get_all
-#define mc_cli_dbus_properties_do_set omc_cli_dbus_properties_do_set
-#define mc_filter_flag_get_type omc_filter_flag_get_type
-#define mc_filter_priority_get_type omc_filter_priority_get_type
-#define mc_iface_quark_account omc_iface_quark_account
-#define mc_iface_quark_account_interface_avatar omc_iface_quark_account_interface_avatar
-#define mc_iface_quark_account_interface_compat omc_iface_quark_account_interface_compat
-#define mc_iface_quark_account_interface_conditions omc_iface_quark_account_interface_conditions
-#define mc_iface_quark_account_manager omc_iface_quark_account_manager
-#define mc_iface_quark_account_manager_interface_query omc_iface_quark_account_manager_interface_query
-#define mc_make_resident omc_make_resident
-#define mc_manager_clear_cache omc_manager_clear_cache
-#define mc_manager_free omc_manager_free
-#define mc_manager_get_bus_name omc_manager_get_bus_name
-#define mc_manager_get_filename omc_manager_get_filename
-#define mc_manager_get_object_path omc_manager_get_object_path
-#define mc_manager_get_type omc_manager_get_type
-#define mc_manager_get_unique_name omc_manager_get_unique_name
-#define mc_manager_lookup omc_manager_lookup
-#define mc_managers_free_list omc_managers_free_list
-#define mc_managers_list omc_managers_list
-#define mc_presence_get_type omc_presence_get_type
-#define mc_profile_clear_cache omc_profile_clear_cache
-#define mc_profile_free omc_profile_free
-#define mc_profile_get_avatar_mime_type omc_profile_get_avatar_mime_type
-#define mc_profile_get_branding_icon_name omc_profile_get_branding_icon_name
-#define mc_profile_get_capabilities omc_profile_get_capabilities
-#define mc_profile_get_configuration_ui omc_profile_get_configuration_ui
-#define mc_profile_get_default_account_domain omc_profile_get_default_account_domain
-#define mc_profile_get_default_account_name omc_profile_get_default_account_name
-#define mc_profile_get_default_setting omc_profile_get_default_setting
-#define mc_profile_get_display_name omc_profile_get_display_name
-#define mc_profile_get_icon_name omc_profile_get_icon_name
-#define mc_profile_get_priority omc_profile_get_priority
-#define mc_profile_get_protocol omc_profile_get_protocol
-#define mc_profile_get_protocol_name omc_profile_get_protocol_name
-#define mc_profile_get_supported_presences omc_profile_get_supported_presences
-#define mc_profile_get_type omc_profile_get_type
-#define mc_profile_get_unique_name omc_profile_get_unique_name
-#define mc_profile_get_vcard_field omc_profile_get_vcard_field
-#define mc_profile_get_vcard_mangle omc_profile_get_vcard_mangle
-#define mc_profile_is_default_for_vcard_field omc_profile_is_default_for_vcard_field
-#define mc_profile_lookup omc_profile_lookup
-#define mc_profile_lookup_default_for_vcard_field omc_profile_lookup_default_for_vcard_field
-#define mc_profile_supports_presence omc_profile_supports_presence
-#define mc_profiles_free_list omc_profiles_free_list
-#define mc_profiles_list omc_profiles_list
-#define mc_profiles_list_by_protocol omc_profiles_list_by_protocol
-#define mc_profiles_list_by_vcard_field omc_profiles_list_by_vcard_field
-#define mc_protocol_free omc_protocol_free
-#define mc_protocol_free_params_list omc_protocol_free_params_list
-#define mc_protocol_get_manager omc_protocol_get_manager
-#define mc_protocol_get_name omc_protocol_get_name
-#define mc_protocol_get_params omc_protocol_get_params
-#define mc_protocol_get_type omc_protocol_get_type
-#define mc_protocol_lookup omc_protocol_lookup
-#define mc_protocol_print omc_protocol_print
-#define mc_protocols_free_list omc_protocols_free_list
-#define mc_protocols_list omc_protocols_list
-#define mc_protocols_list_by_manager omc_protocols_list_by_manager
-#define mc_signals_marshal_VOID__STRING_STRING omc_signals_marshal_VOID__STRING_STRING
-#define mc_status_get_type omc_status_get_type
-#define mc_type_dbus_struct_uss omc_type_dbus_struct_uss
-
-#define McAccount OmcAccount
-#define McAccountClass OmcAccountClass
-#define McProfile OmcProfile
-#define McProfileClass OmcProfileClass
-
-#endif
-
diff --git a/libmissioncontrol/mc-signals-marshal.list b/libmissioncontrol/mc-signals-marshal.list
deleted file mode 100644
index 72f9937..0000000
--- a/libmissioncontrol/mc-signals-marshal.list
+++ /dev/null
@@ -1 +0,0 @@
-VOID:STRING,STRING
diff --git a/libmissioncontrol/mc.c b/libmissioncontrol/mc.c
deleted file mode 100644
index 3914604..0000000
--- a/libmissioncontrol/mc.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <gmodule.h>
-#include <telepathy-glib/dbus.h>
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/proxy-subclass.h>
-
-
-#include "mc.h"
-
-#define LIBRARY_FILE G_STRINGIFY(LIBDIR) "/libmissioncontrol-config.so." G_STRINGIFY(LIBVERSION)
-
-/**
- * mc_make_resident:
- *
- * This function is a workaround for problems with mc getting loaded twice
- * into the same process, such as when the control panel loads a plugin which
- * uses mc after it has already been loaded and unloaded. In order to
- * prevent g_type_register_static being called twice, this function can be
- * called to make mc be redident in memory for the lifetime of the process.
- */
-
-void
-mc_make_resident (void)
-{
- GModule *module = g_module_open (LIBRARY_FILE, 0);
- if (NULL == module)
- {
- g_critical("%s: g_module_open() failed: %s", G_STRFUNC, g_module_error());
- }
- g_module_make_resident (module);
-}
-
-gboolean
-mc_cli_dbus_properties_do_get (gpointer proxy,
- gint timeout_ms,
- const gchar *in_Interface_Name,
- const gchar *in_Property_Name,
- GValue **out_Value,
- GError **error)
-{
- DBusGProxy *iface;
- GQuark interface = TP_IFACE_QUARK_DBUS_PROPERTIES;
- GValue *o_Value = g_new0 (GValue, 1);
-
- g_return_val_if_fail (TP_IS_PROXY (proxy), FALSE);
-
- iface = tp_proxy_borrow_interface_by_id
- ((TpProxy *) proxy, interface, error);
-
- if (iface == NULL)
- return FALSE;
-
- if(dbus_g_proxy_call_with_timeout (iface,
- "Get",
- timeout_ms,
- error,
- G_TYPE_STRING, in_Interface_Name,
- G_TYPE_STRING, in_Property_Name,
- G_TYPE_INVALID,
- G_TYPE_VALUE, o_Value,
- G_TYPE_INVALID))
- {
- *out_Value = o_Value;
- return TRUE;
- }
- else
- {
- g_free (o_Value);
- return FALSE;
- }
-}
-
-
-gboolean
-mc_cli_dbus_properties_do_get_all (gpointer proxy,
- gint timeout_ms,
- const gchar *in_Interface_Name,
- GHashTable **out_Properties,
- GError **error)
-{
- DBusGProxy *iface;
- GQuark interface = TP_IFACE_QUARK_DBUS_PROPERTIES;
- GHashTable *o_Properties;
-
- g_return_val_if_fail (TP_IS_PROXY (proxy), FALSE);
-
- iface = tp_proxy_borrow_interface_by_id
- ((TpProxy *) proxy, interface, error);
-
- if (iface == NULL)
- return FALSE;
-
- if (dbus_g_proxy_call_with_timeout (iface,
- "GetAll",
- timeout_ms,
- error,
- G_TYPE_STRING, in_Interface_Name,
- G_TYPE_INVALID,
- (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)), &o_Properties,
- G_TYPE_INVALID))
- {
- *out_Properties = o_Properties;
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-
-gboolean
-mc_cli_dbus_properties_do_set (gpointer proxy,
- gint timeout_ms,
- const gchar *in_Interface_Name,
- const gchar *in_Property_Name,
- const GValue *in_Value,
- GError **error)
-{
- DBusGProxy *iface;
- GQuark interface = TP_IFACE_QUARK_DBUS_PROPERTIES;
-
- g_return_val_if_fail (TP_IS_PROXY (proxy), FALSE);
-
- iface = tp_proxy_borrow_interface_by_id
- ((TpProxy *) proxy, interface, error);
-
- if (iface == NULL)
- return FALSE;
-
- return dbus_g_proxy_call_with_timeout (iface,
- "Set",
- timeout_ms,
- error,
- G_TYPE_STRING, in_Interface_Name,
- G_TYPE_STRING, in_Property_Name,
- G_TYPE_VALUE, in_Value,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
-}
-
-
diff --git a/libmissioncontrol/mc.h b/libmissioncontrol/mc.h
deleted file mode 100644
index d17f709..0000000
--- a/libmissioncontrol/mc.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef __MC_H__
-#define __MC_H__
-
-#include <glib-object.h>
-#include <libmissioncontrol/mc-remap.h>
-
-G_BEGIN_DECLS
-
-void mc_make_resident (void);
-
-gboolean mc_cli_dbus_properties_do_get (gpointer proxy,
- gint timeout_ms,
- const gchar *in_Interface_Name,
- const gchar *in_Property_Name,
- GValue **out_Value,
- GError **error);
-
-gboolean mc_cli_dbus_properties_do_get_all (gpointer proxy,
- gint timeout_ms,
- const gchar *in_Interface_Name,
- GHashTable **out_Properties,
- GError **error);
-
-gboolean mc_cli_dbus_properties_do_set (gpointer proxy,
- gint timeout_ms,
- const gchar *in_Interface_Name,
- const gchar *in_Property_Name,
- const GValue *in_Value,
- GError **error);
-
-G_END_DECLS
-#endif
-
diff --git a/libmissioncontrol/mission-control-signals-marshal.list b/libmissioncontrol/mission-control-signals-marshal.list
deleted file mode 100644
index d9c6f25..0000000
--- a/libmissioncontrol/mission-control-signals-marshal.list
+++ /dev/null
@@ -1,7 +0,0 @@
-VOID:UINT,UINT,UINT,STRING
-VOID:STRING,UINT
-VOID:UINT,UINT
-VOID:UINT,STRING,UINT
-VOID:UINT
-VOID:UINT,UINT,STRING,UINT,STRING
-VOID:UINT,STRING
diff --git a/libmissioncontrol/mission-control.c b/libmissioncontrol/mission-control.c
deleted file mode 100644
index e73cae3..0000000
--- a/libmissioncontrol/mission-control.c
+++ /dev/null
@@ -1,1454 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include "mc-client-lib-gen.h"
-#include "mission-control.h"
-#include "mission-control-signals-marshal.h"
-#include <glib.h>
-#include <string.h>
-#include <telepathy-glib/dbus.h>
-
-static void _handle_mcd_errors (DBusGProxy * missioncontrol, guint serial,
- gchar *client_id, guint reason,
- gpointer userdata);
-
-static gboolean check_for_accounts (MissionControl * self);
-
-static GObjectClass *parent_class = NULL;
-/* A simple counter for execution order tracking; must be global per process */
-static guint last_operation_id;
-static GList *instances = NULL;
-static DBusConnection *dbus_connection = NULL;
-static TpDBusDaemon *dbus_daemon = NULL;
-static gboolean mc_is_running = FALSE;
-
-/* Signals */
-
-enum
-{
- ERROR,
- SERVICE_ENDED,
- LAST_SIGNAL
-};
-
-static guint libmc_signals[LAST_SIGNAL] = { 0 };
-
-struct dbus_cb_data {
- McCallback callback;
- gpointer user_data;
-};
-
-struct idle_cb_data {
- MissionControl *self;
- McCallback callback;
- GError *error;
- gpointer user_data;
- guint id;
-};
-
-struct get_current_status_cb_data {
- McGetCurrentStatusCallback callback;
- gpointer user_data;
-};
-
-#define INVOKE_CALLBACK(mc, callback, data, code, ...) \
- if (callback) { \
- GError *error = NULL; \
- error = g_error_new (MC_ERROR, code, __VA_ARGS__); \
- queue_callback (mc, callback, error, data); \
- }
-
-static void
-free_idle_cb_data (gpointer data)
-{
- struct idle_cb_data *cbdata = data;
-
- if (cbdata->error)
- g_error_free (cbdata->error);
- g_free (cbdata);
-}
-
-static gboolean
-invoke_callback (gpointer data)
-{
- struct idle_cb_data *cbdata = data;
-
- cbdata->callback (cbdata->self, cbdata->error, cbdata->user_data);
- cbdata->error = NULL;
- g_hash_table_remove (cbdata->self->active_callbacks,
- GINT_TO_POINTER (cbdata->id));
- return FALSE;
-}
-
-static void
-queue_callback (MissionControl *self, McCallback callback,
- GError *error, gpointer user_data)
-{
- struct idle_cb_data *data;
-
- data = g_malloc (sizeof (struct idle_cb_data));
- data->self = self;
- data->callback = callback;
- data->error = error;
- data->user_data = user_data;
- data->id = g_idle_add (invoke_callback, data);
- g_hash_table_insert (self->active_callbacks, GINT_TO_POINTER (data->id),
- data);
-}
-
-static void
-dbus_async_cb (DBusGProxy * proxy, GError * error, gpointer userdata)
-{
- struct dbus_cb_data *cb_data = (struct dbus_cb_data *)userdata;
-
- if (error)
- g_debug ("%s: Error: %s (%u)", G_STRFUNC, error->message, error->code);
-
- if (cb_data->callback)
- cb_data->callback ((MissionControl *)proxy, error, cb_data->user_data);
- else
- {
- /* there's callback to free the error; we must do that ourselves */
- if (error)
- g_error_free (error);
- }
-
- g_free (cb_data);
-}
-
-static DBusHandlerResult
-dbus_filter_func (DBusConnection *connection,
- DBusMessage *message,
- gpointer data)
-{
- DBusHandlerResult result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
- if (dbus_message_is_signal (message,
- "org.freedesktop.DBus",
- "NameOwnerChanged")) {
- const gchar *name = NULL;
- const gchar *prev_owner = NULL;
- const gchar *new_owner = NULL;
- DBusError error = {0};
-
- dbus_error_init (&error);
-
- if (!dbus_message_get_args (message,
- &error,
- DBUS_TYPE_STRING,
- &name,
- DBUS_TYPE_STRING,
- &prev_owner,
- DBUS_TYPE_STRING,
- &new_owner,
- DBUS_TYPE_INVALID)) {
-
- g_debug ("error: %s", error.message);
- dbus_error_free (&error);
-
- return result;
- }
-
- if (name &&
- strcmp (name, MISSION_CONTROL_SERVICE) == 0)
- {
- if (prev_owner && prev_owner[0] != '\0')
- {
- GList *list;
-
- for (list = instances; list; list = list->next)
- g_signal_emit (list->data, libmc_signals[SERVICE_ENDED], 0);
- }
- mc_is_running = new_owner && (new_owner[0] != '\0');
- }
- }
-
- return result;
-}
-
-GQuark mission_control_error_quark (void)
-{
- static GQuark quark = 0;
- if (quark == 0)
- quark = g_quark_from_static_string ("mission-control-quark");
- return quark;
-}
-
-static void instance_finalized (gpointer data, GObject *object)
-{
- instances = g_list_remove (instances, object);
- if (!instances)
- {
- if (dbus_daemon)
- {
- g_object_unref (dbus_daemon);
- dbus_daemon = NULL;
- }
- dbus_connection_remove_filter (dbus_connection, dbus_filter_func,
- NULL);
- dbus_connection_unref (dbus_connection);
- dbus_connection = NULL;
- }
-}
-
-static void initialize_dbus_filter (DBusGConnection *connection)
-{
- DBusError error;
-
- /* Add a filter to detect the service exits and emit the ServiceEnded
- * signal accordingly */
- dbus_connection = dbus_g_connection_get_connection (connection);
- dbus_connection_ref (dbus_connection);
- dbus_error_init (&error);
- dbus_connection_add_filter (dbus_connection,
- dbus_filter_func,
- NULL, NULL);
- dbus_bus_add_match (dbus_connection,
- "type='signal'," "interface='org.freedesktop.DBus',"
- "member='NameOwnerChanged'", &error);
- if (dbus_error_is_set (&error))
- {
- g_warning ("Match rule adding failed");
- dbus_error_free (&error);
- }
-
- mc_is_running = dbus_bus_name_has_owner (dbus_connection,
- MISSION_CONTROL_SERVICE, NULL);
-}
-
-static void
-_missioncontrol_register_signal_marshallers (void)
-{
- /* Register the AccountStatusChanged signal */
- dbus_g_object_register_marshaller
- (mission_control_signals_marshal_VOID__UINT_UINT_UINT_STRING,
- G_TYPE_NONE, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING,
- G_TYPE_INVALID);
- /* Register the error signal */
- dbus_g_object_register_marshaller
- (mission_control_signals_marshal_VOID__UINT_STRING_UINT, G_TYPE_NONE,
- G_TYPE_UINT, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
- /* Register the PresenceStatusRequested/Actual signal */
- dbus_g_object_register_marshaller
- (mission_control_signals_marshal_VOID__UINT, G_TYPE_NONE, G_TYPE_UINT,
- G_TYPE_INVALID);
- /* Register the StatusActual signal */
- dbus_g_object_register_marshaller
- (mission_control_signals_marshal_VOID__UINT_UINT, G_TYPE_NONE,
- G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
- /* Register the UsedChannelsCountChanged signal */
- dbus_g_object_register_marshaller
- (mission_control_signals_marshal_VOID__STRING_UINT, G_TYPE_NONE,
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
-#ifndef NO_NEW_PRESENCE_SIGNALS
- /* Register the AccountPresenceChanged signal */
- dbus_g_object_register_marshaller
- (mission_control_signals_marshal_VOID__UINT_UINT_STRING_UINT_STRING,
- G_TYPE_NONE, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_UINT,
- G_TYPE_STRING, G_TYPE_INVALID);
- /* Register the PresenceChanged signal */
- dbus_g_object_register_marshaller
- (mission_control_signals_marshal_VOID__UINT_STRING, G_TYPE_NONE,
- G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID);
-#endif
-}
-
-static void
-mission_control_init (GTypeInstance * instance, gpointer g_class)
-{
- MissionControl *self = MISSIONCONTROL (instance);
- self->first_run = TRUE;
-
- self->active_callbacks =
- g_hash_table_new_full (g_direct_hash, g_direct_equal,
- (GDestroyNotify)g_source_remove,
- free_idle_cb_data);
-}
-
-
-static void
-mission_control_dispose (GObject * obj)
-{
- MissionControl *self = MISSIONCONTROL (obj);
-
- if (self->first_run)
- {
- self->first_run = FALSE;
- }
-
- if (self->active_callbacks)
- {
- g_hash_table_destroy (self->active_callbacks);
- self->active_callbacks = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- {
- G_OBJECT_CLASS (parent_class)->dispose (obj);
- }
-}
-
-
-static void
-mission_control_class_init (MissionControlClass * klass)
-{
- GObjectClass *obj = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
- obj->set_property = parent_class->set_property;
- obj->get_property = parent_class->get_property;
- obj->dispose = mission_control_dispose;
- _missioncontrol_register_signal_marshallers ();
-
- /**
- * MissionControl::Error:
- * @self: The #MissionControl object.
- * @operation_id: The unique ID of the operation which caused the error.
- * When this signal is emitted to report a failure in handling a channel,
- * this parameter holds the same @operation_id returned by the channel
- * request function call.
- * @error_code: The #MCError code describing the error.
- *
- * This signal is emitted when an error is raised from the mission-control
- * server. This is not raised in response to some API call failing (they
- * already provide a way to report errors), but rather for informing the
- * client of some unexpected event, such as a channel handler failing.
- */
- libmc_signals[ERROR] =
- g_signal_new ("Error",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
- 0,
- NULL, NULL,
- mission_control_signals_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
-
- /**
- * MissionControl::ServiceEnded:
- * @self: The #MissionControl object
- *
- * This signal is emitted when a mission-control server process has exited.
- */
- libmc_signals[SERVICE_ENDED] =
- g_signal_new ("ServiceEnded",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-
-GType
-mission_control_get_type (void)
-{
- static GType type = 0;
- if (type == 0)
- {
- static const GTypeInfo info = {
- sizeof (MissionControlClass),
- NULL,
- NULL,
- (GClassInitFunc) mission_control_class_init,
- NULL,
- NULL,
- sizeof (MissionControl),
- 0,
- (GInstanceInitFunc) mission_control_init
- };
- type = g_type_register_static (DBUS_TYPE_G_PROXY,
- "MissionControl", &info, 0);
- }
- return type;
-}
-
-
-/**
- * mission_control_new:
- * @connection: The D-BUS connection for this object
- *
- * Creates a new Mission Control client library object.
- *
- * Return value: A new mc (Mission Control) library object, or NULL if unsuccesful
- */
-MissionControl *
-mission_control_new (DBusGConnection * connection)
-{
- MissionControl *mc_obj = NULL;
-
- g_return_val_if_fail (connection != NULL, NULL);
-
- /* Create the proxy object that is used for performing
- * the method calls on the Mission Control service */
-
- mc_obj = g_object_new (MISSIONCONTROL_TYPE,
- "name", MISSION_CONTROL_SERVICE,
- "path", MISSION_CONTROL_PATH,
- "interface", MISSION_CONTROL_IFACE,
- "connection", connection, NULL);
- if (!instances)
- {
- /* this is the first instance created in this process:
- * perform some global initializations */
- initialize_dbus_filter (connection);
- dbus_daemon = tp_dbus_daemon_new (connection);
- }
- /* Add the object to the list of living MC instances, and add a watch for
- * its finalization */
- instances = g_list_prepend (instances, mc_obj);
- g_object_weak_ref (G_OBJECT (mc_obj), instance_finalized, NULL);
-
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "AccountStatusChanged",
- G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,
- G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "McdError", G_TYPE_UINT,
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (DBUS_G_PROXY (mc_obj), "McdError",
- G_CALLBACK (_handle_mcd_errors), mc_obj, NULL);
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "PresenceStatusRequested",
- G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "PresenceStatusActual",
- G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "UsedChannelsCountChanged",
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "StatusActual",
- G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
-#ifndef NO_NEW_PRESENCE_SIGNALS
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "AccountPresenceChanged",
- G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING,
- G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (DBUS_G_PROXY (mc_obj), "PresenceChanged",
- G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID);
-#endif
- return mc_obj;
-}
-
-
-/**
- * mission_control_set_presence:
- * @self: The #MissionControl object.
- * @presence: Integer specifying the presence status code
- * @message: Optional presence associated message
- * @callback: a #McCallback function to be notified about any errors
- * @user_data: data to be passed to the @callback function
- *
- * Sets presence for the accounts.
- */
-void
-mission_control_set_presence (MissionControl * self,
- McPresence presence, const gchar * message,
- McCallback callback, gpointer user_data)
-{
- struct dbus_cb_data *cb_data;
-
- /* Check whether we have any accounts to set presence for */
- if (!check_for_accounts (self))
- {
- INVOKE_CALLBACK (self, callback, user_data, MC_NO_ACCOUNTS_ERROR, " ");
- return;
- }
-
- cb_data = g_malloc (sizeof (struct dbus_cb_data));
- g_assert (cb_data != NULL);
- cb_data->callback = callback;
- cb_data->user_data = user_data;
- mission_control_dbus_set_presence_async (DBUS_G_PROXY (self),
- (gint) presence, message,
- dbus_async_cb, cb_data);
-}
-
-/**
- * mission_control_get_presence:
- * @self: The #MissionControl object.
- * @error: address where an error can be returned, or NULL.
- *
- * Gets the currently requested presence status.
- *
- * Return value: The currently requested presence status
- */
-McPresence
-mission_control_get_presence (MissionControl * self, GError **error)
-{
- /* To indicate failure, we set the presence to unset */
- McPresence presence = MC_PRESENCE_UNSET;
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that we're offline without starting it to perform the
- * query. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return MC_PRESENCE_OFFLINE;
- }
-
- if (!mission_control_dbus_get_presence (DBUS_G_PROXY (self),
- &presence, error))
- {
- presence = MC_PRESENCE_UNSET;
- }
-
- return presence;
-}
-
-/**
- * mission_control_get_presence_message:
- * @self: The #MissionControl object.
- * @error: address where an error can be returned, or NULL.
- *
- * Gets the currently requested presence message.
- *
- * Returns: The currently requested presence message
- */
-gchar *
-mission_control_get_presence_message (MissionControl * self, GError **error)
-{
- gchar *message;
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that we're offline without starting it to perform the
- * query. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return NULL;
- }
-
- if (!mission_control_dbus_get_presence_message (DBUS_G_PROXY (self),
- &message, error))
- {
- message = NULL;
- }
-
- return message;
-}
-
-/**
- * mission_control_get_presence_actual:
- * @self: The #MissionControl object.
- * @error: address where an error can be returned, or NULL.
- *
- * Gets the actual presence status.
- *
- * Return value: The actual presence status
- */
-McPresence
-mission_control_get_presence_actual (MissionControl * self, GError **error)
-{
- /* To indicate failure, we set the presence to unset */
- McPresence presence = MC_PRESENCE_UNSET;
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that we're offline without starting it to perform the
- * query. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return MC_PRESENCE_OFFLINE;
- }
-
- if (!mission_control_dbus_get_presence_actual (DBUS_G_PROXY (self),
- &presence, error))
- {
- presence = MC_PRESENCE_UNSET;
- }
-
- return presence;
-}
-
-/**
- * mission_control_get_presence_message_actual:
- * @self: The #MissionControl object.
- * @error: address where an error can be returned, or NULL.
- *
- * Gets the actual presence message.
- *
- * Returns: The actual presence message
- */
-gchar *
-mission_control_get_presence_message_actual (MissionControl * self,
- GError **error)
-{
- gchar *message;
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that we're offline without starting it to perform the
- * query. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return NULL;
- }
-
- if (!mission_control_dbus_get_presence_message_actual (DBUS_G_PROXY (self),
- &message, error))
- {
- message = NULL;
- }
-
- return message;
-}
-
-/**
- * mission_control_request_channel:
- * @self: The #MissionControl object.
- * @account: The account which will join a new channel or request
- * joining to an existing channel
- * @type: a D-Bus interface name representing base channel type
- * @handle: The handle we want to initiate the communication with
- * @handle_type: The type of the handle we are initiating the
- * communication with. See #TelepathyHandleType
- * @callback: a #McCallback function to be notified about any errors
- * @user_data: data to be passed to the @callback function
- *
- * Requests creation of a new channel, or join to an existing channel.
- *
- * Return value: An operation ID which can be used to cancel the request using
- * #mission_control_cancel_channel_request.
- */
-guint
-mission_control_request_channel (MissionControl * self,
- McAccount * account,
- const gchar * type,
- guint handle,
- TpHandleType handle_type,
- McCallback callback,
- gpointer user_data)
-{
- struct dbus_cb_data *cb_data;
- const gchar *account_name = mc_account_get_unique_name (account);
- last_operation_id++;
-
- if (account_name == NULL)
- {
- INVOKE_CALLBACK (self, callback, user_data, MC_INVALID_ACCOUNT_ERROR,
- " ");
- return last_operation_id;
- }
-
- /* Check whether we have any accounts to request channel for */
- if (!check_for_accounts (self))
- {
- INVOKE_CALLBACK (self, callback, user_data, MC_NO_ACCOUNTS_ERROR, " ");
- return last_operation_id;
- }
-
- cb_data = g_malloc (sizeof (struct dbus_cb_data));
- g_assert (cb_data != NULL);
- cb_data->callback = callback;
- cb_data->user_data = user_data;
- mission_control_dbus_request_channel_async (DBUS_G_PROXY (self),
- account_name,
- type, handle, handle_type,
- last_operation_id,
- dbus_async_cb,
- cb_data);
-
- return last_operation_id;
-}
-
-
-/**
- * mission_control_request_channel_with_string_handle:
- * @self: The #MissionControl object.
- * @account: The account which will join a new channel or request joining to an
- * existing channel
- * @type: a D-Bus interface name representing base channel type
- * @handle: The handle we want to initiate the communication with
- * @vcard_field: The vcard_field of the handle, may be null for default profile
- * vcard field
- * @handle_type: The type of the handle we are initiating the communication
- * with. See #TelepathyHandleType
- * @callback: a #McCallback function to be notified about any errors
- * @user_data: data to be passed to the @callback function
- *
- * Requests creation of a new channel, or join to an existing channel. Differs
- * from the plain #mission_control_request_channel by taking handles as
- * strings, which will be resolved to integers by MC.
- *
- * Return value: An operation ID which can be used to cancel the request using
- * #mission_control_cancel_channel_request.
- */
-guint
-mission_control_request_channel_with_string_handle_and_vcard_field (MissionControl * self,
- McAccount * account,
- const gchar * type,
- const gchar * handle,
- const gchar * vcard_field,
- TpHandleType
- handle_type,
- McCallback callback,
- gpointer user_data)
-{
- struct dbus_cb_data *cb_data;
- const gchar *account_name = mc_account_get_unique_name (account);
- char * mangled_handle = NULL;
-
- last_operation_id++;
-
- if (account_name == NULL)
- {
- INVOKE_CALLBACK (self, callback, user_data, MC_INVALID_ACCOUNT_ERROR,
- " ");
- return last_operation_id;
- }
-
- /* Check whether we have any accounts to request channel for */
- if (!check_for_accounts (self))
- {
- INVOKE_CALLBACK (self, callback, user_data, MC_NO_ACCOUNTS_ERROR, " ");
- return last_operation_id;
- }
-
- /* mangle the handle with the vcard_field */
- if (vcard_field != NULL) {
- McProfile *profile = mc_account_get_profile (account);
-
- if (G_LIKELY (profile))
- {
- const char * profile_vcard_field = mc_profile_get_vcard_field (profile);
-
- /* TODO: this is where from the profiles or from the provisioning
- * we must figure out how to actually mangle user addresses from
- * foreign vcard fields to something the connection manager will
- * understand.
- * For now this is just lowercasing the vcard field and prepending
- * it to the address
- */
-
- /* only mangle if it is not the default vcard field */
- if (profile_vcard_field == NULL ||
- strcmp(vcard_field, profile_vcard_field) != 0) {
-
- const char * mangle = mc_profile_get_vcard_mangle(profile, vcard_field);
- g_debug("MANGLE: %s", mangle);
- if (mangle) {
- mangled_handle = g_strdup_printf(mangle, handle);
- } else {
- if (strcmp(vcard_field, "TEL") == 0) {
- /* TEL mangling */
- char ** split = g_strsplit_set(handle, " -,.:;", -1);
- mangled_handle = g_strjoinv("", split);
- g_strfreev(split);
- } else {
- /* generic mangling */
- char * lower_vcard_field = g_utf8_strdown(vcard_field, -1);
- mangled_handle = g_strdup_printf("%s:%s", lower_vcard_field, handle);
- g_free(lower_vcard_field);
- }
- }
- g_debug ("%s: mangling: %s (%s)", G_STRFUNC, mangled_handle, vcard_field);
- }
- g_object_unref (profile);
- }
- }
-
- cb_data = g_malloc (sizeof (struct dbus_cb_data));
- g_assert (cb_data != NULL);
- cb_data->callback = callback;
- cb_data->user_data = user_data;
-
- mission_control_dbus_request_channel_with_string_handle_async(
- DBUS_G_PROXY (self),
- account_name,
- type,
- (mangled_handle)?mangled_handle:handle,
- handle_type,
- last_operation_id,
- dbus_async_cb, cb_data);
-
- g_free(mangled_handle);
-
- return last_operation_id;
-}
-
-
-/**
- * see @mission_control_request_channel_with_string_handle_and_vcard_field.
- */
-guint
-mission_control_request_channel_with_string_handle (MissionControl * self,
- McAccount * account,
- const gchar * type,
- const gchar * handle,
- TpHandleType
- handle_type,
- McCallback callback,
- gpointer user_data)
-{
- return mission_control_request_channel_with_string_handle_and_vcard_field(
- self,
- account,
- type,
- handle,
- NULL,
- handle_type,
- callback,
- user_data);
-}
-
-
-/**
- * mission_control_cancel_channel_request:
- * @self: The #MissionControl object.
- * @operation_id: the operation id of the request to cancel, as returned
- * by #mission_control_request_channel_with_string_handle.
- * @error: address where an error can be returned, or NULL.
- *
- * Cancel a channel request; a process can only cancel the requests that were
- * originated by itself.
- *
- * Returns: %TRUE on success, %FALSE otherwise.
- */
-gboolean
-mission_control_cancel_channel_request (MissionControl *self,
- guint operation_id,
- GError **error)
-{
- return mission_control_dbus_cancel_channel_request (DBUS_G_PROXY (self),
- operation_id,
- error);
-}
-
-/**
- * mission_control_connect_all_with_default_presence:
- * @self: The #MissionControl object.
- * @callback: a #McCallback function to be notified about any errors
- * @user_data: data to be passed to the @callback function
- *
- * Connect all accounts using default presence,
- * or HIDDEN if default presence is OFFLINE.
- * If accounts are already connected do nothing.
- */
-void
-mission_control_connect_all_with_default_presence (MissionControl * self,
- McCallback callback,
- gpointer user_data)
-{
- struct dbus_cb_data *cb_data;
-
- /* Check whether we have any accounts to set presence for */
- if (!check_for_accounts (self))
- {
- INVOKE_CALLBACK (self, callback, user_data, MC_NO_ACCOUNTS_ERROR,
- " ");
- return;
- }
-
- cb_data = g_malloc (sizeof (struct dbus_cb_data));
- g_assert (cb_data != NULL);
- cb_data->callback = callback;
- cb_data->user_data = user_data;
- mission_control_dbus_connect_all_with_default_presence_async
- (DBUS_G_PROXY (self),
- dbus_async_cb, cb_data);
-}
-
-/**
- * mission_control_get_connection_status:
- * @self: The #MissionControl object.
- * @account: The account whose connection status is inspected
- * @error: address where an error can be returned, or NULL.
- *
- * Request a status code describing the status of the connection that the
- * provided account currently uses.
- *
- * Return value: A status code describing the status of the specified connection
- * eg. CONNECTED = 0, CONNECTING = 1, DISCONNECTED = 2
- */
-guint
-mission_control_get_connection_status (MissionControl * self,
- McAccount * account,
- GError **error)
-{
- /* XXX TP_CONN_STATUS_DISCONNECTED is used as an UNKNOWN status is not
- * available */
- guint conn_status = TP_CONNECTION_STATUS_DISCONNECTED;
- const gchar *account_name = mc_account_get_unique_name (account);
-
- if (account_name == NULL)
- {
- g_set_error (error, MC_ERROR, MC_INVALID_ACCOUNT_ERROR, " ");
- return conn_status;
- }
-
- /* Check whether we have any accounts to connection status for */
- if (!check_for_accounts (self))
- {
- g_set_error (error, MC_ERROR, MC_NO_ACCOUNTS_ERROR, " ");
- return conn_status;
- }
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that we're offline. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return TP_CONNECTION_STATUS_DISCONNECTED;
- }
-
- mission_control_dbus_get_connection_status (DBUS_G_PROXY (self),
- account_name,
- &conn_status, error);
- return conn_status;
-}
-
-/**
- * mission_control_get_online_connections:
- * @self: The #MissionControl object.
- * @error: address where an error can be returned, or NULL.
- *
- * Request an array of the accounts that have an active connection.
- *
- * Return value: A list of McAccounts corresponding to the online
- * connections
- */
-GSList *
-mission_control_get_online_connections (MissionControl * self, GError **error)
-{
- GSList *online_conns = NULL;
- gchar **names = NULL, **name;
-
- /* Check whether we have any accounts, otherwise we do not have
- * connections either */
-
- if (!check_for_accounts (self))
- {
- g_set_error (error, MC_ERROR, MC_NO_ACCOUNTS_ERROR, " ");
- return NULL;
- }
-
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_NO_MATCHING_CONNECTION_ERROR,
- "MC not running");
- return NULL;
- }
-
- if (!mission_control_dbus_get_online_connections (DBUS_G_PROXY (self),
- &names, error))
- {
- return NULL;
- }
- /* Create McAccounts with all the account names */
- for (name = names; *name != NULL; name++)
- {
- McAccount *acc = mc_account_lookup (*name);
-
- if (acc != NULL)
- {
- online_conns = g_slist_prepend (online_conns, acc);
- }
- }
- g_strfreev (names);
-
- return online_conns;
-}
-
-/**
- * mission_control_get_connection:
- * @self: The #MissionControl object.
- * @account: The account the connection is created for.
- * @error: address where an error can be returned, or NULL.
- *
- * DEPRECATED: do not use, will be removed soon.
- * Use mission_control_get_tpconnection instead.
- *
- * Gets a connection object for the specified account name.
- *
- * Return value: An existing TpConn object, NULL if the account is not connected
- */
-TpConn *
-mission_control_get_connection (MissionControl * self, McAccount * account,
- GError **error)
-{
- TpConn *tp_conn = NULL;
- gchar *bus_name = NULL, *obj_path = NULL;
- const gchar *account_name = mc_account_get_unique_name (account);
- DBusGConnection *connection = NULL;
- guint status;
-
- if (account_name == NULL)
- {
- g_set_error (error, MC_ERROR, MC_INVALID_ACCOUNT_ERROR, " ");
- return NULL;
- }
-
- /* Check whether we have any accounts to request connection for */
- if (!check_for_accounts (self))
- {
- g_set_error (error, MC_ERROR, MC_NO_ACCOUNTS_ERROR, " ");
- return NULL;
- }
-
- /* If MC isn't running there won't be any connections. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return NULL;
- }
-
- g_object_get (G_OBJECT (self), "connection", &connection, NULL);
-
- if (connection == NULL)
- {
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR,
- "Cannot get D-BUS connection");
- return NULL;
- }
-
- /* Match the account name and corresponding connection parameters in
- * Mission Control */
-
- if (!mission_control_dbus_get_connection (DBUS_G_PROXY (self), account_name,
- &bus_name, &obj_path, error))
- {
- dbus_g_connection_unref (connection);
- return NULL;
- }
-
- /* Create a local copy of the TpConn object from the acquired information.
- * We do not need to use the connect method via a connection manager,
- * because the connection is already initialized by MissionControl. */
-
- tp_conn = tp_conn_new_without_connect (connection, bus_name, obj_path,
- &status, NULL);
-
- if (tp_conn == NULL)
- {
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR,
- "Cannot get telepathy connection");
- }
-
- g_free (bus_name);
- g_free (obj_path);
- dbus_g_connection_unref (connection);
-
- return tp_conn;
-}
-
-/**
- * mission_control_get_account_for_connection:
- * @self: The #MissionControl object.
- * @connection: connection object to get the account for
- * @error: address where an error can be returned, or NULL.
- *
- * DEPRECATED: do not use, will be removed soon.
- * Use mission_control_get_account_for_tpconnection instead.
- *
- * Gets the account corresponding to the connection object.
- * Note that as a result the caller owns a reference to the account object.
- *
- * Return value: The matching account object, NULL on error
- */
-McAccount *
-mission_control_get_account_for_connection (MissionControl * self,
- TpConn * connection,
- GError **error)
-{
- const gchar *connection_object_path;
- gchar *account_unique_name;
- McAccount *account;
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that there are no accounts or connections in that case
- * without starting it to perform the query. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return NULL;
- }
-
- connection_object_path = dbus_g_proxy_get_path (DBUS_G_PROXY (connection));
-
- if (!mission_control_dbus_get_account_for_connection (DBUS_G_PROXY (self),
- connection_object_path,
- &account_unique_name,
- error))
- {
- g_warning ("%s: Getting account for the connection failed", G_STRFUNC);
- return NULL;
- }
-
- account = mc_account_lookup (account_unique_name);
-
- g_free (account_unique_name);
-
- return account;
-}
-
-/**
- * mission_control_get_tpconnection:
- * @self: The #MissionControl object.
- * @account: The account the connection is created for.
- * @error: address where an error can be returned, or NULL.
- *
- * Gets a connection object for the specified account name.
- *
- * Return value: An existing TpConnection object, NULL if the account is not
- * connected
- */
-TpConnection *
-mission_control_get_tpconnection (MissionControl * self, McAccount * account,
- GError **error)
-{
- TpConnection *tp_conn = NULL;
- gchar *bus_name = NULL, *obj_path = NULL;
- const gchar *account_name = mc_account_get_unique_name (account);
-
- if (account_name == NULL)
- {
- g_set_error (error, MC_ERROR, MC_INVALID_ACCOUNT_ERROR, " ");
- return NULL;
- }
-
- /* Check whether we have any accounts to request connection for */
- if (!check_for_accounts (self))
- {
- g_set_error (error, MC_ERROR, MC_NO_ACCOUNTS_ERROR, " ");
- return NULL;
- }
-
- /* If MC isn't running there won't be any connections. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return NULL;
- }
-
- /* Match the account name and corresponding connection parameters in
- * Mission Control */
-
- if (!mission_control_dbus_get_connection (DBUS_G_PROXY (self), account_name,
- &bus_name, &obj_path, error))
- {
- return NULL;
- }
-
- /* Create a local copy of the TpConnection object from the acquired
- * information.
- * We do not need to use the connect method via a connection manager,
- * because the connection is already initialized by MissionControl. */
- tp_conn = tp_connection_new (dbus_daemon, bus_name, obj_path, error);
-
- g_free (bus_name);
- g_free (obj_path);
-
- return tp_conn;
-}
-
-/**
- * mission_control_get_account_for_tpconnection:
- * @self: The #MissionControl object.
- * @connection: connection object to get the account for
- * @error: address where an error can be returned, or NULL.
- *
- * Gets the account corresponding to the connection object.
- * Note that as a result the caller owns a reference to the account object.
- *
- * Return value: The matching account object, NULL on error
- */
-McAccount *
-mission_control_get_account_for_tpconnection (MissionControl * self,
- TpConnection *connection,
- GError **error)
-{
- const gchar *connection_object_path;
- gchar *account_unique_name;
- McAccount *account;
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that there are no accounts or connections in that case
- * without starting it to perform the query. */
- if (!mc_is_running)
- {
- g_debug ("%s: MC not running.", G_STRFUNC);
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return NULL;
- }
-
- connection_object_path = TP_PROXY (connection)->object_path;
-
- if (!mission_control_dbus_get_account_for_connection (DBUS_G_PROXY (self),
- connection_object_path,
- &account_unique_name,
- error))
- {
- g_warning ("%s: Getting account for the connection failed", G_STRFUNC);
- return NULL;
- }
-
- account = mc_account_lookup (account_unique_name);
-
- g_free (account_unique_name);
-
- return account;
-}
-
-/**
- * mission_control_get_used_channels_count:
- * @self: The #MissionControl object.
- * @type: Type of the counted channels as a GQuark (see the defines in
- * tp-chan.h)
- * @error: address where an error can be returned, or NULL.
- *
- * Counts the number of active channels of specified type.
- *
- * Return value: The number of channels currently in use (negative if the query
- * fails)
- */
-gint mission_control_get_used_channels_count(MissionControl *self,
- GQuark type, GError **error)
-{
- gint ret;
-
- /* Check whether Mission Control is running; if not, there should be
- no active channels without starting it to perform the query. */
-
- if (!mc_is_running)
- {
- g_set_error (error, MC_ERROR, MC_DISCONNECTED_ERROR, "MC not running");
- return 0;
- }
-
- /* We'll have to convert the quark here to a string, because it will
- not match the quarks in another process */
-
- if (!mission_control_dbus_get_used_channels_count(DBUS_G_PROXY(self),
- g_quark_to_string(type),
- (guint *)&ret,
- error))
- {
- /* We'll have to make a difference between a failed request and 0
- channels in use */
- return -1;
- }
-
- return ret;
-}
-
-static void
-get_current_status_cb (DBusGProxy * proxy,
- McStatus status,
- McPresence presence,
- McPresence requested_presence,
- GPtrArray *accounts_array,
- GError *error, gpointer userdata)
-{
- struct get_current_status_cb_data *cb_data = (struct get_current_status_cb_data *)userdata;
- McAccountStatus *accounts, *account;
- GType type;
- gsize n_accounts;
- guint i;
-
- if (error)
- g_debug ("%s: Error: %s (%u)", G_STRFUNC, error->message, error->code);
-
- type = dbus_g_type_get_struct ("GValueArray", G_TYPE_STRING, G_TYPE_UINT,
- G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
- accounts = g_new (McAccountStatus, accounts_array->len);
-
- for (i = 0, account = accounts; i < accounts_array->len; i++, account++)
- {
- GValue account_value = { 0, };
-
- g_value_init (&account_value, type);
- g_value_take_boxed (&account_value,
- g_ptr_array_index (accounts_array, i));
- dbus_g_type_struct_get (&account_value,
- 0, &account->unique_name,
- 1, &account->status,
- 2, &account->presence,
- 3, &account->reason,
- G_MAXUINT);
- g_value_unset (&account_value);
- }
- n_accounts = accounts_array->len;
-
- g_ptr_array_free (accounts_array, TRUE);
- cb_data->callback ((MissionControl *)proxy,
- status, presence, requested_presence,
- accounts, n_accounts,
- error, cb_data->user_data);
-
- g_free (cb_data);
-}
-
-/**
- * mission_control_get_current_status:
- * @self: The #MissionControl object.
- * @callback: a #McGetCurrentStatusCallback function which will be called with
- * the requested information.
- * @user_data: data to be passed to the @callback function
- *
- * Queries the status of all the enabled accounts, as well as the global
- * presence and status. This information will be returned in the registered
- * @callback, which will be resposible for freeing all the dynamic data.
- */
-void
-mission_control_get_current_status (MissionControl * self,
- McGetCurrentStatusCallback callback,
- gpointer user_data)
-{
- struct get_current_status_cb_data *cb_data;
-
- /* Check whether Mission Control is running; if not, it's safe to
- * say that we're offline without starting it to perform the
- * query. */
- g_assert (callback != NULL);
- if (!mc_is_running)
- {
- GError *error = NULL;
- g_debug ("%s: MC not running.", G_STRFUNC);
- error = g_error_new (MC_ERROR, MC_DISCONNECTED_ERROR, " ");
- callback (self, 0, 0, 0, NULL, 0, error, user_data);
- return;
- }
-
- cb_data = g_malloc (sizeof (struct get_current_status_cb_data));
- g_assert (cb_data != NULL);
- cb_data->callback = callback;
- cb_data->user_data = user_data;
- mission_control_dbus_get_current_status_async (DBUS_G_PROXY (self),
- get_current_status_cb,
- cb_data);
-}
-
-/**
- * mission_control_free_account_statuses:
- * @accounts: The array of #McAccountStatus.
- *
- * Frees the @accounts array.
- */
-void
-mission_control_free_account_statuses (McAccountStatus *accounts)
-{
- McAccountStatus *account;
-
- for (account = accounts; account != NULL; account++)
- g_free (account->unique_name);
- g_free (accounts);
-}
-
-
-/* We handle errors coming via MCD here. If the pid for the error
- matches our pid, we will emit the signal, otherwise we just
- silently ignore it to avoid other instances using libmissioncontrol
- getting confused */
-
-static void
-_handle_mcd_errors (DBusGProxy * missioncontrol, guint serial,
- gchar *client_id,
- guint reason, gpointer userdata)
-{
- MissionControl *self = (MissionControl *) userdata;
- DBusGConnection *connection;
- const gchar *self_client_id = NULL;
-
- g_object_get (G_OBJECT (missioncontrol), "connection", &connection, NULL);
-
- if (!connection)
- return;
-
- self_client_id = dbus_bus_get_unique_name (
- dbus_g_connection_get_connection (connection));
- dbus_g_connection_unref (connection);
-
- g_debug ("%s: client id is %s (error comes for %s)", G_STRFUNC, self_client_id, client_id);
- if (client_id == NULL || (self_client_id != NULL &&
- strcmp(client_id, self_client_id) == 0))
- {
- g_signal_emit_by_name (self, "Error", serial, reason);
- }
-}
-
-
-/* A helper function to determine if there are valid accounts. Mainly
- useful for avoiding useless launches of Mission Control */
-
-static gboolean
-check_for_accounts (MissionControl * self)
-{
- GList *enabled_accounts = mc_accounts_list_by_enabled (TRUE);
-
- /* Do we have any enabled accounts? If not, fail. */
-
- /* ? Should we add another error definition for situations where we
- * have accounts, but none of them are enabled? */
-
- if (!enabled_accounts || g_list_length (enabled_accounts) == 0)
- {
- mc_accounts_list_free (enabled_accounts);
- g_debug ("%s: No enabled accounts", G_STRFUNC);
- return FALSE;
- }
-
- mc_accounts_list_free (enabled_accounts);
- return TRUE;
-}
-
-/**
- * mission_control_remote_avatar_changed:
- * @self: the #MissionControl object.
- * @connection: connection object which received the avatar update.
- * @contact_id: the Telepathy self contact handle.
- * @token: the Telepathy token for the new avatar.
- * @error: address where an error can be returned, or NULL.
- *
- * DEPRECATED. Do not use.
- */
-gboolean
-mission_control_remote_avatar_changed (MissionControl *self,
- TpConnection *connection, guint contact_id,
- const gchar *token, GError **error)
-{
- return FALSE;
-}
-
-gboolean
-mission_control_register_filter (MissionControl *self,
- const gchar *bus_name,
- const gchar *object_path,
- const gchar *channel_type,
- McFilterPriority priority,
- McFilterFlag flags,
- GError **error)
-{
- return mission_control_dbus_register_filter (DBUS_G_PROXY (self),
- bus_name, object_path,
- channel_type,
- priority, flags,
- error);
-}
-
-
diff --git a/libmissioncontrol/mission-control.h b/libmissioncontrol/mission-control.h
deleted file mode 100644
index f11d353..0000000
--- a/libmissioncontrol/mission-control.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef MISSION_CONTROL_LIB_H
-#define MISSION_CONTROL_LIB_H
-
-#ifndef DBUS_API_SUBJECT_TO_CHANGE
-#define DBUS_API_SUBJECT_TO_CHANGE
-#endif
-
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus.h>
-#include <libtelepathy/tp-conn.h>
-#include <telepathy-glib/connection.h>
-#include <telepathy-glib/channel.h>
-
-#include <libmissioncontrol/dbus-api.h>
-
-#define MISSIONCONTROL_TYPE (mission_control_get_type ())
-
-#define MISSIONCONTROL(obj) (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), MISSIONCONTROL_TYPE, \
- MissionControl))
-
-#define MISSIONCONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
- ((klass), MISSIONCONTROL_TYPE, \
- MissionControlClass))
-
-#define IS_MISSIONCONTROL(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), MISSIONCONTROL_TYPE))
-
-#define IS_MISSIONCONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE \
- ((klass), MISSIONCONTROL_TYPE))
-
-#define MISSIONCONTROL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
- ((obj), MISSIONCONTROL_TYPE, \
- MissionControlClass))
-
-#define MC_ERROR (mission_control_error_quark())
-
-typedef struct _missioncontrol MissionControl;
-typedef struct _missioncontrolclass MissionControlClass;
-
-typedef enum {
- MC_DISCONNECTED_ERROR,
- MC_INVALID_HANDLE_ERROR,
- MC_NO_MATCHING_CONNECTION_ERROR,
- MC_INVALID_ACCOUNT_ERROR,
- MC_PRESENCE_FAILURE_ERROR,
- MC_NO_ACCOUNTS_ERROR,
- MC_NETWORK_ERROR,
- MC_CONTACT_DOES_NOT_SUPPORT_VOICE_ERROR,
- MC_LOWMEM_ERROR,
- MC_CHANNEL_REQUEST_GENERIC_ERROR,
- MC_CHANNEL_BANNED_ERROR,
- MC_CHANNEL_FULL_ERROR,
- MC_CHANNEL_INVITE_ONLY_ERROR,
- MC_LAST_ERROR /*< skip >*/
-} MCError;
-
-typedef enum {
- MC_PRESENCE_UNSET,
- MC_PRESENCE_OFFLINE,
- MC_PRESENCE_AVAILABLE,
- MC_PRESENCE_AWAY,
- MC_PRESENCE_EXTENDED_AWAY,
- MC_PRESENCE_HIDDEN,
- MC_PRESENCE_DO_NOT_DISTURB,
- LAST_MC_PRESENCE /*< skip >*/
-} McPresence;
-
-typedef enum {
- MC_STATUS_DISCONNECTED,
- MC_STATUS_CONNECTING,
- MC_STATUS_CONNECTED,
-} McStatus;
-
-typedef enum {
- MC_FILTER_PRIORITY_CRITICAL = 0,
- MC_FILTER_PRIORITY_SYSTEM = 1000,
- MC_FILTER_PRIORITY_NOTICE = 2000,
- MC_FILTER_PRIORITY_DIALOG = 3000,
- MC_FILTER_PRIORITY_MONITOR = 4000
-} McFilterPriority;
-
-typedef enum {
- MC_FILTER_FLAG_INCOMING = 1 << 0,
- MC_FILTER_FLAG_OUTGOING = 1 << 1
-} McFilterFlag;
-#define MC_FILTER_FLAG_OUTCOMING MC_FILTER_FLAG_OUTGOING
-
-struct _missioncontrol
-{
- DBusGProxy parent;
-
- gboolean first_run;
- GHashTable *active_callbacks;
-};
-
-
-struct _missioncontrolclass
-{
- DBusGProxyClass parent_class;
-};
-
-typedef struct _McAccountStatus {
- gchar *unique_name;
- TpConnectionStatus status;
- McPresence presence;
- TpConnectionStatusReason reason;
-} McAccountStatus;
-
-typedef void (*McCallback) (MissionControl *mc,
- GError *error,
- gpointer user_data);
-
-#include <libmissioncontrol/mc-account.h>
-
-GQuark mission_control_error_quark (void);
-GType mission_control_get_type (void);
-
-
-MissionControl *mission_control_new (DBusGConnection *connection);
-
-void mission_control_set_presence (MissionControl *self,
- McPresence presence,
- const gchar *message,
- McCallback callback,
- gpointer user_data);
-
-McPresence mission_control_get_presence (MissionControl *self, GError **error);
-gchar *mission_control_get_presence_message (MissionControl *self,
- GError **error);
-McPresence mission_control_get_presence_actual (MissionControl *self,
- GError **error);
-gchar *mission_control_get_presence_message_actual (MissionControl *self,
- GError **error);
-
-guint mission_control_request_channel (MissionControl *self,
- McAccount *account,
- const gchar *type,
- guint handle,
- TpHandleType handle_type,
- McCallback callback,
- gpointer user_data);
-
-guint mission_control_request_channel_with_string_handle (MissionControl *self,
- McAccount *account,
- const gchar *type,
- const gchar *handle,
- TpHandleType handle_type,
- McCallback callback,
- gpointer user_data);
-
-guint mission_control_request_channel_with_string_handle_and_vcard_field (MissionControl *self,
- McAccount *account,
- const gchar *type,
- const gchar *handle,
- const gchar *vcard_field,
- TpHandleType handle_type,
- McCallback callback,
- gpointer user_data);
-
-gboolean mission_control_cancel_channel_request (MissionControl *self,
- guint operation_id,
- GError **error);
-
-void mission_control_connect_all_with_default_presence (MissionControl *self,
- McCallback callback,
- gpointer user_data);
-
-guint mission_control_get_connection_status (MissionControl *self,
- McAccount *account,
- GError **error);
-
-GSList *mission_control_get_online_connections (MissionControl *self,
- GError **error);
-
-TpConn *mission_control_get_connection (MissionControl *self,
- McAccount *account, GError **error);
-
-McAccount *mission_control_get_account_for_connection (MissionControl *self,
- TpConn *connection,
- GError **error);
-
-TpConnection *mission_control_get_tpconnection (MissionControl *self,
- McAccount *account,
- GError **error);
-
-McAccount *mission_control_get_account_for_tpconnection (MissionControl *self,
- TpConnection *connection,
- GError **error);
-
-gint mission_control_get_used_channels_count (MissionControl *self,
- GQuark type, GError **error);
-
-typedef void (*McGetCurrentStatusCallback) (MissionControl *mc,
- McStatus status,
- McPresence presence,
- McPresence requested_presence,
- McAccountStatus *accounts,
- gsize n_accounts,
- GError *error,
- gpointer user_data);
-
-void mission_control_get_current_status (MissionControl *self,
- McGetCurrentStatusCallback callback,
- gpointer user_data);
-
-void mission_control_free_account_statuses (McAccountStatus *accounts);
-
-gboolean mission_control_remote_avatar_changed (MissionControl *self,
- TpConnection *connection,
- guint contact_id,
- const gchar *token,
- GError **error);
-
-gboolean mission_control_register_filter (MissionControl *self,
- const gchar *bus_name,
- const gchar *object_path,
- const gchar *channel_type,
- McFilterPriority priority,
- McFilterFlag flags,
- GError **error);
-
-#endif
diff --git a/libmissioncontrol/svc-nmc4.h b/libmissioncontrol/svc-nmc4.h
deleted file mode 100644
index 1d7ed94..0000000
--- a/libmissioncontrol/svc-nmc4.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * svc-nmc4.h - the Nokia Mission Control 4.x D-Bus interface (service side)
- *
- * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
- * Copyright (C) 2008 Nokia Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __LIBMISSIONCONTROL_SVC_NMC4_H__
-#define __LIBMISSIONCONTROL_SVC_NMC4_H__
-
-/* auto-generated stubs */
-#include <libmissioncontrol/_gen/svc-nmc4.h>
-
-#endif
diff --git a/libmissioncontrol/test.c b/libmissioncontrol/test.c
deleted file mode 100644
index 100753d..0000000
--- a/libmissioncontrol/test.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <utime.h>
-
-#include <glib.h>
-
-#include "mc.h"
-#include "mc-account.h"
-#include "mc-account-monitor.h"
-#include "mc-profile.h"
-
-static void
-test_profile (void)
-{
- McProfile *profile1, *profile2;
- McProtocol *protocol;
- const gchar * protocol_name;
-
- profile1 = mc_profile_lookup ("testprofile");
- g_assert (profile1);
- g_assert (0 == strcmp ("testprofile",
- mc_profile_get_unique_name (profile1)));
- protocol_name = mc_profile_get_protocol_name (profile1);
- g_assert (0 == strcmp ("testproto", protocol_name));
- protocol = mc_profile_get_protocol (profile1);
- g_assert (protocol);
- g_assert (0 == strcmp ("testproto", mc_protocol_get_name (protocol)));
- profile2 = mc_profile_lookup ("testprofile");
- g_assert (profile1 == profile2);
-
- g_object_unref (profile1);
- g_object_unref (profile2);
-}
-
-static void
-test_profile_list (void)
-{
- GList *list, *i;
- McProfile *profile1, *profile2;
-
- list = mc_profiles_list ();
- g_assert (3 == g_list_length (list));
- i = list;
- profile1 = (McProfile *) i->data;
- i = i->next;
- profile2 = (McProfile *) i->data;
- g_assert (0 == strcmp ("jabber",
- mc_profile_get_unique_name (profile1)));
- g_assert (0 == strcmp ("google-talk",
- mc_profile_get_unique_name (profile2)));
- g_assert (0 == strcmp ("testprofile",
- mc_profile_get_unique_name ((McProfile *) i->next->data)));
-
- mc_profiles_free_list (list);
-
- list = mc_profiles_list ();
- g_assert (3 == g_list_length (list));
- i = list;
- g_assert (profile1 == (McProfile *) i->data);
- i = i->next;
- g_assert (profile2 == (McProfile *) i->data);
-
- mc_profiles_free_list (list);
-}
-
-static void
-test_profile_stat (void)
-{
- McProfile *profile1, *profile2;
-
- profile1 = mc_profile_lookup ("jabber");
- utime ("../test/jabber.profile", NULL);
- profile2 = mc_profile_lookup("jabber");
- g_assert (profile1 != profile2);
-}
-
-static void
-check_account_param (gpointer key, gpointer value, gpointer data)
-{
- if (0 == strcmp (key, "account"))
- {
- g_assert (G_VALUE_HOLDS_STRING (value));
- g_assert (0 == strcmp ("daf at foo", g_value_get_string (value)));
- return;
- }
-
- if (0 == strcmp (key, "password"))
- {
- g_assert (G_VALUE_HOLDS_STRING (value));
- g_assert (0 == strcmp ("badger", g_value_get_string (value)));
- return;
- }
-
- g_warning ("got unexpected parameter \"%s\" for account", (gchar *) key);
-}
-
-static void
-test_account (void)
-{
- McAccount *account1, *account2;
-
- account1 = mc_account_lookup ("jabber1");
- g_assert (account1);
- g_assert (0 == strcmp ("jabber1", mc_account_get_unique_name (account1)));
- account2 = mc_account_lookup ("jabber1");
- g_assert (account2);
- g_assert (account1 == account2);
-
- g_assert (mc_account_set_param_string(account1, "account", "daf at foo"));
- g_assert (mc_account_set_param_string(account1, "password", "badger"));
-
- g_hash_table_foreach(
- mc_account_get_params(account1), check_account_param, account1);
-
- g_object_unref(account1);
- g_object_unref(account2);
-}
-
-static gint
-account_has_name (gconstpointer account_p, gconstpointer name_p)
-{
- McAccount *account = (McAccount *) account_p;
- const gchar *name = (gchar *) name_p;
-
- return strcmp (mc_account_get_unique_name (account), name);
-}
-
-static void
-test_mc_account_list (void)
-{
- GList *accounts;
- McAccount *account;
- McProfile *profile;
- const gchar *name;
-
- profile = mc_profile_lookup ("jabber");
- account = mc_account_create (profile);
- sleep(1);
- while (g_main_context_iteration (NULL, FALSE));
- name = mc_account_get_unique_name (account);
- accounts = mc_accounts_list ();
- g_assert (NULL != g_list_find_custom (accounts, name, account_has_name));
- mc_accounts_list_free (accounts);
- mc_account_delete (account);
-}
-
-static void
-cb_account_created(McAccountMonitor *monitor, gchar *name, gpointer data)
-{
- GSList **created = (GSList **) data;
- *created = g_slist_append (*created, g_strdup (name));
- /*printf ("account created: %s\n", name); */
-}
-
-static void
-cb_account_deleted(McAccountMonitor *monitor, gchar *name, gpointer data)
-{
- GSList **deleted = (GSList **) data;
- *deleted = g_slist_append (*deleted, g_strdup (name));
- /*printf ("account deleted: %s\n", name); */
-}
-
-static void
-cb_account_enabled (McAccountMonitor *monitor, gchar *name, gpointer data)
-{
- GSList **enabled = (GSList **) data;
- *enabled = g_slist_append (*enabled, g_strdup (name));
- /* printf ("account enabled: %s\n", name); */
-}
-
-static void
-cb_account_disabled (McAccountMonitor *monitor, gchar *name, gpointer data)
-{
- GSList **disabled = (GSList **) data;
- *disabled = g_slist_append (*disabled, g_strdup (name));
- /* printf ("account disabled: %s\n", name); */
-}
-
-static void
-cb_account_changed (McAccountMonitor *monitor, gchar *name, gpointer data)
-{
- GSList **disabled = (GSList **) data;
- *disabled = g_slist_append (*disabled, g_strdup (name));
-}
-
-static void
-test_account_monitor (void)
-{
- McAccountMonitor *monitor;
- McProfile *profile1, *profile2;
- McAccount *account1, *account2;
- GSList *created = NULL;
- GSList *deleted = NULL;
- GSList *enabled = NULL;
- GSList *disabled = NULL;
- GSList *changed = NULL;
- const gchar *name1, *name2;
-
- monitor = mc_account_monitor_new ();
- g_signal_connect (monitor, "account-created", (GCallback) cb_account_created, &created);
- g_signal_connect (monitor, "account-deleted", (GCallback) cb_account_deleted, &deleted);
- g_signal_connect (monitor, "account-enabled", (GCallback) cb_account_enabled, &enabled);
- g_signal_connect (monitor, "account-disabled", (GCallback) cb_account_disabled, &disabled);
- g_signal_connect (monitor, "account-changed", (GCallback) cb_account_changed, &changed);
-
- profile1 = mc_profile_lookup ("jabber");
- g_assert (NULL != profile1);
- g_assert (NULL != mc_profile_get_protocol (profile1));
-
- profile2 = mc_profile_lookup ("google-talk");
- g_assert (NULL != mc_profile_get_protocol (profile2));
- g_assert (NULL != profile2);
-
- /* test 1: creating */
-
- account1 = mc_account_create (profile1);
- name1 = mc_account_get_unique_name (account1);
- /* printf ("new account: %s\n", name1);*/
-
- account2 = mc_account_create (profile2);
- name2 = mc_account_get_unique_name (account2);
- /* printf ("new account: %s\n", name2); */
-
- sleep(1);
- while (g_main_context_iteration (NULL, FALSE));
-
- g_assert (2 == g_slist_length (created));
- g_assert (0 == g_slist_length (deleted));
- g_assert (2 == g_slist_length (enabled));
- g_assert (0 == g_slist_length (disabled));
- g_assert (0 < g_slist_length (changed));
-
- g_assert (NULL != g_slist_find_custom (created, name1, (GCompareFunc) strcmp));
- g_assert (NULL != g_slist_find_custom (created, name2, (GCompareFunc) strcmp));
-
- g_assert (NULL != g_slist_find_custom (enabled, name1, (GCompareFunc) strcmp));
- g_assert (NULL != g_slist_find_custom (enabled, name2, (GCompareFunc) strcmp));
-
- created = deleted = enabled = disabled = changed = NULL;
-
- /* test 2: disabling */
-
- mc_account_set_enabled (account1, FALSE);
- mc_account_set_enabled (account2, FALSE);
-
- sleep(1);
- while (g_main_context_iteration (NULL, FALSE));
-
- g_assert (0 == g_slist_length (created));
- g_assert (0 == g_slist_length (deleted));
- g_assert (0 == g_slist_length (enabled));
- g_assert (2 == g_slist_length (disabled));
- g_assert (0 == g_slist_length (changed));
-
- g_assert (NULL != g_slist_find_custom (disabled, name1, (GCompareFunc) strcmp));
- g_assert (NULL != g_slist_find_custom (disabled, name2, (GCompareFunc) strcmp));
-
- created = deleted = enabled = disabled = changed = NULL;
-
- /* test 3: re-enabling */
-
- mc_account_set_enabled (account1, TRUE);
- mc_account_set_enabled (account2, TRUE);
-
- sleep(1);
- while (g_main_context_iteration (NULL, FALSE));
-
- g_assert (0 == g_slist_length (created));
- g_assert (0 == g_slist_length (deleted));
- g_assert (2 == g_slist_length (enabled));
- g_assert (0 == g_slist_length (disabled));
- g_assert (0 == g_slist_length (changed));
-
- g_assert (NULL != g_slist_find_custom (enabled, name1, (GCompareFunc) strcmp));
- g_assert (NULL != g_slist_find_custom (enabled, name2, (GCompareFunc) strcmp));
-
- created = deleted = enabled = disabled = changed = NULL;
-
- /* test 4: deleting */
-
- mc_account_delete (account2);
- mc_account_delete (account1);
-
- sleep(1);
- while (g_main_context_iteration (NULL, FALSE));
-
- g_assert (0 == g_slist_length (created));
- g_assert (2 == g_slist_length (deleted));
- g_assert (0 == g_slist_length (enabled));
- g_assert (2 == g_slist_length (disabled));
- g_assert (0 < g_slist_length (changed));
-
-
- g_assert (NULL != g_slist_find_custom (deleted, name1, (GCompareFunc) strcmp));
- g_assert (NULL != g_slist_find_custom (deleted, name2, (GCompareFunc) strcmp));
-
- g_object_unref (profile1);
- g_object_unref (profile2);
- g_object_unref (account1);
- g_object_unref (account2);
- g_object_unref (monitor);
-}
-
-static void
-test_manager (void)
-{
- McManager *manager1, *manager2;
-
- manager1 = mc_manager_lookup ("testmanager");
- g_assert (manager1);
- g_assert (0 ==
- strcmp ("testmanager", mc_manager_get_unique_name (manager1)));
-
- g_assert (0 == strcmp ("testmanager",
- mc_manager_get_unique_name (manager1)));
- g_assert (0 == strcmp ("org.freedesktop.Telepathy.ConnectionManager.test",
- mc_manager_get_bus_name (manager1)));
- g_assert (0 == strcmp ("/org/freedesktop/Telepathy/ConnectionManager/test",
- mc_manager_get_object_path (manager1)));
-
- manager2 = mc_manager_lookup ("testmanager");
- g_assert (manager2);
- g_assert (manager1 == manager2);
-
- g_object_unref (manager1);
- g_object_unref (manager2);
-}
-
-static void
-test_protocol (void)
-{
- McManager *manager1, *manager2;
- McProtocol *protocol1, *protocol2;
- GSList *params;
- McProtocolParam expected_params[] = {
- {"account", "s", NULL,
- MC_PROTOCOL_PARAM_REQUIRED | MC_PROTOCOL_PARAM_REGISTER},
- {"password", "s", NULL,
- MC_PROTOCOL_PARAM_REQUIRED | MC_PROTOCOL_PARAM_REGISTER},
- {"server", "s", NULL,
- MC_PROTOCOL_PARAM_REQUIRED},
- {"port", "q", NULL, 0},
- {"register", "b", NULL, 0},
- {NULL, NULL, NULL, 0}
- }, *i;
-
- manager1 = mc_manager_lookup ("testmanager");
- manager2 = mc_manager_lookup ("testmanager");
- protocol1 = mc_protocol_lookup (manager1, "testproto");
- protocol2 = mc_protocol_lookup (manager2, "testproto");
- g_assert (protocol1 == protocol2);
-
- params = mc_protocol_get_params (protocol1);
-
- for (i = expected_params; i->name; i++)
- {
- GSList *j;
- gboolean found = FALSE;
-
- for (j = params; j; j = j->next)
- {
- McProtocolParam *p = (McProtocolParam *) j->data;
-
- if (0 == strcmp (i->name, p->name))
- {
- found = TRUE;
- g_assert (0 == strcmp (i->name, p->name));
- g_assert (0 == strcmp (i->signature, p->signature));
- }
- }
-
- g_assert (found);
- }
-
- mc_protocol_free_params_list (params);
-
- g_object_unref (manager1);
- g_object_unref (manager2);
- g_object_unref (protocol1);
- g_object_unref (protocol2);
-}
-
-int
-main (int argc, char **argv)
-{
- g_setenv ("MC_PROFILE_DIR", "../test", FALSE);
- g_setenv ("MC_MANAGER_DIR", "../test", FALSE);
-
- g_type_init ();
-
- mc_make_resident ();
- mc_make_resident ();
-
- test_profile ();
- test_profile_list ();
- test_profile_stat ();
- test_account ();
- test_mc_account_list ();
-
- /* this is a hack to workaround an apparent race condition when catching
- * GConf signals in the process that caused them */
- sleep(1);
- while (g_main_context_iteration (NULL, FALSE));
-
- test_account_monitor ();
- test_manager ();
- test_protocol ();
-
- mc_profile_clear_cache ();
- mc_account_clear_cache ();
- mc_manager_clear_cache ();
-
- return 0;
-}
-
-
diff --git a/test/mc-client.c b/test/mc-client.c
deleted file mode 100644
index 28da27c..0000000
--- a/test/mc-client.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 8 -*- */
-/*
- * This file is part of mission-control
- *
- * Copyright (C) 2007 Nokia Corporation.
- *
- * Contact: Naba Kumar <naba.kumar at nokia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include "libmissioncontrol/mission-control.h"
-
-
-static void
-on_service_ended (MissionControl *mc)
-{
- g_debug ("Mission control has ended");
-}
-
-static void
-account_status_changed_cb (GObject *object,
- TelepathyConnectionStatus status,
- McPresence presence,
- TelepathyConnectionStatusReason reason,
- const gchar *account,
- gpointer data)
-{
- g_debug ("Account status changed: %s, status = %u, presence = %u, reason = %u",
- account, status, presence, reason);
-}
-
-static void mc_callback (MissionControl *mc, GError *error, gpointer data)
-{
- if (error)
- {
- g_debug ("%s: got error code %u (%s), data is %p", G_STRFUNC,
- error->code, error->message, data);
- g_error_free (error);
- }
- else
- g_debug ("%s: data is %p", G_STRFUNC, data);
-}
-
-int
-main (int argc, char **argv)
-{
- MissionControl *mc;
- DBusGConnection *dbus_conn = NULL;
- GMainLoop *main_loop;
-
- g_type_init ();
- dbus_conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
-
- mc = mission_control_new (dbus_conn);
- g_signal_connect (mc, "ServiceEnded", G_CALLBACK (on_service_ended), NULL);
- dbus_g_proxy_connect_signal (DBUS_G_PROXY (mc),
- "AccountStatusChanged",
- G_CALLBACK (account_status_changed_cb),
- NULL, NULL); /* NULL is for a DestroyNotify */
-
- mission_control_connect_all_with_default_presence (mc, mc_callback, NULL);
- main_loop = g_main_loop_new (NULL, FALSE);
- g_main_loop_run (main_loop);
-
- return 0;
-}
-
-
--
1.5.6.5
More information about the telepathy-commits
mailing list