diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-07-04 13:50:23 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-07-04 17:25:15 +0200 |
commit | c44986c2179c142350f317eb212e22f415ee88bd (patch) | |
tree | 9beea6b24f5bd82e152d13806adb0f867ef25c0a | |
parent | 48824e96b9ccb1b08bf421b248277e382c102f28 (diff) | |
download | telepathy-logger-c44986c2179c142350f317eb212e22f415ee88bd.tar.gz |
Drop TplChannelFactory
-rw-r--r-- | telepathy-logger/Makefile.am | 2 | ||||
-rw-r--r-- | telepathy-logger/channel-factory-internal.h | 55 | ||||
-rw-r--r-- | telepathy-logger/channel-factory.c | 106 |
3 files changed, 0 insertions, 163 deletions
diff --git a/telepathy-logger/Makefile.am b/telepathy-logger/Makefile.am index 6bc36e5..7f1d44d 100644 --- a/telepathy-logger/Makefile.am +++ b/telepathy-logger/Makefile.am @@ -56,8 +56,6 @@ libtelepathy_logger_la_SOURCES = \ call-event-internal.h \ channel-internal.h \ channel.c \ - channel-factory.c \ - channel-factory-internal.h \ client-factory.c \ client-factory-internal.h \ conf.c \ diff --git a/telepathy-logger/channel-factory-internal.h b/telepathy-logger/channel-factory-internal.h deleted file mode 100644 index 01fdb19..0000000 --- a/telepathy-logger/channel-factory-internal.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2009 Collabora Ltd. - * - * 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 - * - * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> - */ - -#ifndef __TPL_CHANNEL_FACTORY_H__ -#define __TPL_CHANNEL_FACTORY_H__ - -#include <glib-object.h> -#include <telepathy-glib/telepathy-glib.h> - -#include <telepathy-logger/channel-internal.h> - -#define TPL_CHANNEL_FACTORY_ERROR g_quark_from_static_string ( \ - "tpl-channel-factory-error-quark") -typedef enum -{ - /* generic error */ - TPL_CHANNEL_FACTORY_ERROR_FAILED, - TPL_CHANNEL_FACTORY_ERROR_CHANNEL_TYPE_NOT_HANDLED -} TplChannelFactoryError; - - -typedef TplChannel* (*TplChannelConstructor) (TpConnection *conn, - const gchar *object_path, GHashTable *tp_chan_props, TpAccount *tp_acc, - GError **error); -typedef TplChannel* (*TplChannelFactory) (const gchar *chan_type, - TpConnection *conn, const gchar *object_path, GHashTable *tp_chan_props, - TpAccount *tp_acc, GError **error); - -void _tpl_channel_factory_init (void); -void _tpl_channel_factory_deinit (void); -void _tpl_channel_factory_add (const gchar *type, - TplChannelConstructor constructor); -TplChannelConstructor _tpl_channel_factory_lookup (const gchar *type); -TplChannel * _tpl_channel_factory_build (const gchar *channel_type, - TpConnection *conn, const gchar *object_path, GHashTable *tp_chan_props, - TpAccount *tp_acc, GError **error); - -#endif /* __TPL_CHANNEL_FACTORY_H__ */ diff --git a/telepathy-logger/channel-factory.c b/telepathy-logger/channel-factory.c deleted file mode 100644 index 60ad7ef..0000000 --- a/telepathy-logger/channel-factory.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2009 Collabora Ltd. - * - * 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 - * - * Authors: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> - */ - -#include "config.h" -#include "channel-factory-internal.h" - -#include <telepathy-glib/telepathy-glib.h> - -#include <telepathy-logger/text-channel-internal.h> - -#define DEBUG_FLAG TPL_DEBUG_CHANNEL -#include <telepathy-logger/debug-internal.h> -#include <telepathy-logger/util-internal.h> - -static GHashTable *channel_table = NULL; - -void -_tpl_channel_factory_init (void) -{ - g_return_if_fail (channel_table == NULL); - - channel_table = g_hash_table_new_full (g_str_hash, - (GEqualFunc) g_str_equal, g_free, NULL); -} - - -void -_tpl_channel_factory_add (const gchar *type, - TplChannelConstructor constructor) -{ - gchar *key; - - g_return_if_fail (!TPL_STR_EMPTY (type)); - g_return_if_fail (constructor != NULL); - g_return_if_fail (channel_table != NULL); - - key = g_strdup (type); - - if (g_hash_table_lookup (channel_table, type) != NULL) - { - g_warning ("Type %s already mapped. replacing constructor.", type); - g_hash_table_replace (channel_table, key, constructor); - } - else - g_hash_table_insert (channel_table, key, constructor); -} - - -TplChannelConstructor -_tpl_channel_factory_lookup (const gchar *type) -{ - g_return_val_if_fail (!TPL_STR_EMPTY (type), NULL); - g_return_val_if_fail (channel_table != NULL, NULL); - - return g_hash_table_lookup (channel_table, type); -} - -void -_tpl_channel_factory_deinit (void) -{ - g_return_if_fail (channel_table != NULL); - - g_hash_table_unref (channel_table); - channel_table = NULL; -} - -TplChannel * -_tpl_channel_factory_build (const gchar *channel_type, - TpConnection *conn, - const gchar *object_path, - GHashTable *tp_chan_props, - TpAccount *tp_acc, - GError **error) -{ - TplChannelConstructor chan_constructor; - - g_return_val_if_fail (channel_table != NULL, NULL); - - chan_constructor = _tpl_channel_factory_lookup (channel_type); - if (chan_constructor == NULL) - { - g_set_error (error, TPL_CHANNEL_FACTORY_ERROR, - TPL_CHANNEL_FACTORY_ERROR_CHANNEL_TYPE_NOT_HANDLED, - "%s: channel type not handled by this logger", channel_type); - return NULL; - } - - return chan_constructor (conn, object_path, tp_chan_props, tp_acc, error); -} |