diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2009-12-29 17:19:10 +0000 |
---|---|---|
committer | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2009-12-29 17:19:10 +0000 |
commit | 2062463f1d28d873e856744c2328e5a6668e30b4 (patch) | |
tree | 9f6f905f9a613ace7a49399fc47b942a1034e218 /src | |
parent | 3fa20ae0b0d2465f3a78076461f19c59f4cfca41 (diff) | |
download | telepathy-logger-2062463f1d28d873e856744c2328e5a6668e30b4.tar.gz |
Dynlib produced and client API split
* libtool dynamic library produces (libtelepathy-logger) using automake
* tpl-log-reader removed (tpl-log-manager used isntead, see below)
* TplLogManager methods split into tpl-log-manager.h for the read-only
API and tpl-log-manager-priv.h for the internal write access ones
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 37 | ||||
-rw-r--r-- | src/telepathy-logger.c (renamed from src/test.c) | 0 | ||||
-rw-r--r-- | src/test_api.c | 88 | ||||
-rw-r--r-- | src/tpl-log-manager-priv.h | 33 | ||||
-rw-r--r-- | src/tpl-log-manager.c | 55 | ||||
-rw-r--r-- | src/tpl-log-manager.h | 10 | ||||
-rw-r--r-- | src/tpl-log-reader.c | 368 | ||||
-rw-r--r-- | src/tpl-log-reader.h | 91 | ||||
-rw-r--r-- | src/tpl-text-channel-context.c | 2 |
9 files changed, 183 insertions, 501 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 160bf97..b6fb21d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,12 +14,9 @@ AM_CPPFLAGS = \ LDADD = $(TPL_LIBS) \ $(LIBTPL_LIBS) -bin_PROGRAMS = telepathy-logger +lib_LTLIBRARIES = libtelepathy-logger.la -#BUILT_SOURCES= - -telepathy_logger_handwritten_source = \ - test.c \ +libtelepathy_logger_la_SOURCES = \ tpl-observer.c \ tpl-headless-logger-init.c \ tpl-channel.c \ @@ -28,15 +25,39 @@ telepathy_logger_handwritten_source = \ tpl-log-entry-text.c \ tpl-contact.c \ tpl-log-manager.c \ - tpl-log-reader.c \ tpl-log-store.c \ tpl-log-store-empathy.c \ tpl-utils.c \ tpl-time.c +include_HEADERS = \ + tpl-channel.h \ + tpl-contact.h \ + tpl-log-entry.h \ + tpl-log-entry-text.h \ + tpl-log-manager.h \ + tpl-log-manager-priv.h \ + tpl-log-store-empathy.h \ + tpl-log-store.h \ + tpl-observer.h \ + tpl-text-channel-context.h \ + tpl-time.h \ + tpl-utils.h + + +bin_PROGRAMS = \ + telepathy-logger \ + test-api + +#BUILT_SOURCES= + + +test_api_SOURCES = test_api.c +test_api_LDADD = libtelepathy-logger.la $(LIBTPL_LIBS) + -telepathy_logger_SOURCES = \ - $(telepathy_logger_handwritten_source) +telepathy_logger_SOURCES = telepathy-logger.c +telepathy_logger_LDADD = libtelepathy-logger.la $(TPL_LIBS) nodist_telepathy_logger_SOURCES = $(BUILT_SOURCES) diff --git a/src/test.c b/src/telepathy-logger.c index 0042001..0042001 100644 --- a/src/test.c +++ b/src/telepathy-logger.c diff --git a/src/test_api.c b/src/test_api.c new file mode 100644 index 0000000..5e77712 --- /dev/null +++ b/src/test_api.c @@ -0,0 +1,88 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * 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 <glib.h> +#include <stdio.h> + +#include <tpl-log-manager.h> +#include <telepathy-glib/account.h> +#include <telepathy-glib/dbus.h> + +//static GMainLoop *loop = NULL; + +int main(int argc, char *argv[]) +{ + TplLogManager *manager; + GList *l; + TpAccount *acc; + //DBusGConnection *bus; + TpDBusDaemon *tp_bus; + GError *err=NULL; + g_type_init (); + + //tpl_headless_logger_init (); + + //bus = tp_get_bus(); + tp_bus = tp_dbus_daemon_dup(&err); + acc = tp_account_new(tp_bus, + "/org/freedesktop/Telepathy/Account/gabble/jabber/cosimo_2ealfarano_40collabora_2eco_2euk0", + &err); + + if(err) { + g_debug(err->message); + return 0; + } + + manager = tpl_log_manager_dup_singleton (); + + tpl_log_manager_search_new(manager, "foo"); + + + l = tpl_log_manager_get_chats(manager, acc); + int lenght = g_list_length(l); + for(int i=0;i<lenght;++i) { + TplLogSearchHit *hit = g_list_nth_data(l,i); + g_debug("%d: %s\n", i, hit->filename); + GList *gl; + + gl = tpl_log_manager_get_dates (manager, acc, hit->chat_id, hit->is_chatroom); + + for(guint ii=0;ii<g_list_length(gl);++ii) { + GList *msgs; + gchar *date = g_list_nth_data(gl, i); + g_message(date); + msgs = tpl_log_manager_get_messages_for_date(manager, acc, hit->chat_id, + hit->is_chatroom, date); + for(guint m=0;m<g_list_length(msgs);++m) { + TplLogEntry *log = g_list_nth_data(msgs, m); + TplLogEntryText *tlog = TPL_LOG_ENTRY_TEXT(tpl_log_entry_get_entry(log)); + + g_message("BODY: %s\n", tpl_log_entry_text_get_message(tlog)); + } + } + + } + + //loop = g_main_loop_new (NULL, FALSE); + //g_main_loop_run (loop); + + return 0; +} diff --git a/src/tpl-log-manager-priv.h b/src/tpl-log-manager-priv.h new file mode 100644 index 0000000..9c0d78a --- /dev/null +++ b/src/tpl-log-manager-priv.h @@ -0,0 +1,33 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2003-2007 Imendio AB + * Copyright (C) 2007-2008 Collabora Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * Authors: Xavier Claessens <xclaesse@gmail.com> + */ + +#ifndef __TPL_LOG_MANAGER_PRIV_H__ +#define __TPL_LOG_MANAGER_PRIV_H__ + +#include <tpl-log-manager.h> + +gboolean tpl_log_manager_add_message (TplLogManager *manager, + const gchar *chat_id, gboolean chatroom, + TplLogEntry *message, GError **error); + +#endif /* __TPL_LOG_MANAGER_PRIV_H__ */ diff --git a/src/tpl-log-manager.c b/src/tpl-log-manager.c index 7ac169b..bf34031 100644 --- a/src/tpl-log-manager.c +++ b/src/tpl-log-manager.c @@ -31,7 +31,8 @@ #include <telepathy-glib/interfaces.h> #include <tpl-log-entry.h> -#include <tpl-log-manager.h> +#include <tpl-log-manager.h> // RO +#include <tpl-log-manager-priv.h> // W #include <tpl-log-store-empathy.h> #include <tpl-log-store.h> #include <tpl-utils.h> @@ -45,7 +46,7 @@ #define GET_PRIV(obj) TPL_GET_PRIV (obj, TplLogManager) typedef struct { - GList *stores; + GList *stores; } TplLogManagerPriv; G_DEFINE_TYPE (TplLogManager, tpl_log_manager, G_TYPE_OBJECT); @@ -55,12 +56,12 @@ static TplLogManager * manager_singleton = NULL; static void log_manager_finalize (GObject *object) { - TplLogManagerPriv *priv; + TplLogManagerPriv *priv; - priv = GET_PRIV (object); + priv = GET_PRIV (object); - g_list_foreach (priv->stores, (GFunc) g_object_unref, NULL); - g_list_free (priv->stores); + g_list_foreach (priv->stores, (GFunc) g_object_unref, NULL); + g_list_free (priv->stores); } /* @@ -72,28 +73,28 @@ log_manager_constructor (GType type, guint n_props, GObjectConstructParam *props) { - GObject *retval; - TplLogManagerPriv *priv; + GObject *retval; + TplLogManagerPriv *priv; - if (manager_singleton) - { - retval = g_object_ref (manager_singleton); - } - else - { - retval = G_OBJECT_CLASS (tpl_log_manager_parent_class)->constructor - (type, n_props, props); + if (manager_singleton) + { + retval = g_object_ref (manager_singleton); + } + else + { + retval = G_OBJECT_CLASS (tpl_log_manager_parent_class)->constructor + (type, n_props, props); - manager_singleton = TPL_LOG_MANAGER (retval); - g_object_add_weak_pointer (retval, (gpointer *) &manager_singleton); + manager_singleton = TPL_LOG_MANAGER (retval); + g_object_add_weak_pointer (retval, (gpointer *) &manager_singleton); - priv = GET_PRIV (manager_singleton); + priv = GET_PRIV (manager_singleton); - priv->stores = g_list_append (priv->stores, - g_object_new (TPL_TYPE_LOG_STORE_EMPATHY, NULL)); - } + priv->stores = g_list_append (priv->stores, + g_object_new (TPL_TYPE_LOG_STORE_EMPATHY, NULL)); + } - return retval; + return retval; } static void @@ -122,6 +123,7 @@ tpl_log_manager_dup_singleton (void) return g_object_new (TPL_TYPE_LOG_MANAGER, NULL); } + gboolean tpl_log_manager_add_message (TplLogManager *manager, const gchar *chat_id, @@ -139,7 +141,7 @@ tpl_log_manager_add_message (TplLogManager *manager, const gchar *add_store = "TpLogger"; g_return_val_if_fail (TPL_IS_LOG_MANAGER (manager), FALSE); - g_return_val_if_fail (chat_id != NULL, FALSE); + g_return_val_if_fail (!TPL_STR_EMPTY (chat_id) , FALSE); g_return_val_if_fail (TPL_IS_LOG_ENTRY (message), FALSE); priv = GET_PRIV (manager); @@ -162,6 +164,8 @@ tpl_log_manager_add_message (TplLogManager *manager, return out; } + + gboolean tpl_log_manager_exists (TplLogManager *manager, TpAccount *account, @@ -186,6 +190,7 @@ tpl_log_manager_exists (TplLogManager *manager, return FALSE; } +// returns a list of gchar dates GList * tpl_log_manager_get_dates (TplLogManager *manager, TpAccount *account, @@ -323,8 +328,6 @@ tpl_log_manager_get_filtered_messages (TplLogManager *manager, return out; } - - GList * tpl_log_manager_get_chats (TplLogManager *manager, TpAccount *account) diff --git a/src/tpl-log-manager.h b/src/tpl-log-manager.h index a27ab23..f56cf69 100644 --- a/src/tpl-log-manager.h +++ b/src/tpl-log-manager.h @@ -24,8 +24,11 @@ #ifndef __TPL_LOG_MANAGER_H__ #define __TPL_LOG_MANAGER_H__ + #include <glib-object.h> +#include <telepathy-glib/account.h> + #include <tpl-log-entry.h> G_BEGIN_DECLS @@ -65,10 +68,6 @@ GType tpl_log_manager_get_type (void); TplLogManager *tpl_log_manager_dup_singleton (void); -gboolean tpl_log_manager_add_message (TplLogManager *manager, - const gchar *chat_id, gboolean chatroom, - TplLogEntry *message, GError **error); - gboolean tpl_log_manager_exists (TplLogManager *manager, TpAccount *account, const gchar *chat_id, gboolean chatroom); @@ -98,9 +97,6 @@ gchar *tpl_log_manager_get_date_readable (const gchar *date); void tpl_log_manager_search_hit_free (TplLogSearchHit *hit); -//void tpl_log_manager_observe (TplLogManager *log_manager, -// EmpathyDispatcher *dispatcher); - G_END_DECLS #endif /* __TPL_LOG_MANAGER_H__ */ diff --git a/src/tpl-log-reader.c b/src/tpl-log-reader.c deleted file mode 100644 index 2bf13bf..0000000 --- a/src/tpl-log-reader.c +++ /dev/null @@ -1,368 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2003-2007 Imendio AB - * Copyright (C) 2007-2008 Collabora Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * Authors: Xavier Claessens <xclaesse@gmail.com> - * Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> - */ - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <glib/gstdio.h> - -#include <telepathy-glib/util.h> -#include <telepathy-glib/interfaces.h> - -#include <tpl-log-entry.h> -#include <tpl-log-reader.h> -#include <tpl-log-store-empathy.h> -#include <tpl-log-store.h> -#include <tpl-utils.h> -#include <tpl-time.h> - -//#define DEBUG_FLAG EMPATHY_DEBUG_OTHER -//#include <empathy-debug.h> - -#define DEBUG g_debug - -#define GET_PRIV(obj) TPL_GET_PRIV (obj, TplLogReader) -typedef struct -{ - GList *stores; -} TplLogReaderPriv; - -G_DEFINE_TYPE (TplLogReader, tpl_log_reader, G_TYPE_OBJECT); - -static TplLogReader * reader_singleton = NULL; - -static void -log_reader_finalize (GObject *object) -{ - TplLogReaderPriv *priv; - - priv = GET_PRIV (object); - - g_list_foreach (priv->stores, (GFunc) g_object_unref, NULL); - g_list_free (priv->stores); -} - -/* - * - Singleton LogReader constructor - - * Initialises LogStores with LogStoreEmpathy instance - */ -static GObject * -log_reader_constructor (GType type, - guint n_props, - GObjectConstructParam *props) -{ - GObject *retval; - TplLogReaderPriv *priv; - - if (reader_singleton) - { - retval = g_object_ref (reader_singleton); - } - else - { - retval = G_OBJECT_CLASS (tpl_log_reader_parent_class)->constructor - (type, n_props, props); - - reader_singleton = TPL_LOG_READER (retval); - g_object_add_weak_pointer (retval, (gpointer *) &reader_singleton); - - priv = GET_PRIV (reader_singleton); - - priv->stores = g_list_append (priv->stores, - g_object_new (TPL_TYPE_LOG_STORE_EMPATHY, NULL)); - } - - return retval; -} - -static void -tpl_log_reader_class_init (TplLogReaderClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->constructor = log_reader_constructor; - object_class->finalize = log_reader_finalize; - - g_type_class_add_private (object_class, sizeof (TplLogReaderPriv)); -} - -static void -tpl_log_reader_init (TplLogReader *reader) -{ - TplLogReaderPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (reader, - TPL_TYPE_LOG_READER, TplLogReaderPriv); - - reader->priv = priv; -} - -TplLogReader * -tpl_log_reader_dup_singleton (void) -{ - return g_object_new (TPL_TYPE_LOG_READER, NULL); -} - -gboolean -tpl_log_reader_exists (TplLogReader *reader, - TpAccount *account, - const gchar *chat_id, - gboolean chatroom) -{ - GList *l; - TplLogReaderPriv *priv; - - g_return_val_if_fail (TPL_IS_LOG_READER (reader), FALSE); - g_return_val_if_fail (chat_id != NULL, FALSE); - - priv = GET_PRIV (reader); - - for (l = priv->stores; l; l = g_list_next (l)) - { - if (tpl_log_store_exists (TPL_LOG_STORE (l->data), - account, chat_id, chatroom)) - return TRUE; - } - - return FALSE; -} - -// returns a list of gchar dates -GList * -tpl_log_reader_get_dates (TplLogReader *reader, - TpAccount *account, - const gchar *chat_id, - gboolean chatroom) -{ - GList *l, *out = NULL; - TplLogReaderPriv *priv; - - g_return_val_if_fail (TPL_IS_LOG_READER (reader), NULL); - g_return_val_if_fail (chat_id != NULL, NULL); - - priv = GET_PRIV (reader); - - for (l = priv->stores; l; l = g_list_next (l)) - { - TplLogStore *store = TPL_LOG_STORE (l->data); - GList *new; - - /* Insert dates of each store in the out list. Keep the out list sorted - * and avoid to insert dups. */ - new = tpl_log_store_get_dates (store, account, chat_id, chatroom); - while (new) - { - if (g_list_find_custom (out, new->data, (GCompareFunc) strcmp)) - g_free (new->data); - else - out = g_list_insert_sorted (out, new->data, (GCompareFunc) strcmp); - - new = g_list_delete_link (new, new); - } - } - - return out; -} - -GList * -tpl_log_reader_get_messages_for_date (TplLogReader *reader, - TpAccount *account, - const gchar *chat_id, - gboolean chatroom, - const gchar *date) -{ - GList *l, *out = NULL; - TplLogReaderPriv *priv; - - g_return_val_if_fail (TPL_IS_LOG_READER (reader), NULL); - g_return_val_if_fail (chat_id != NULL, NULL); - - priv = GET_PRIV (reader); - - for (l = priv->stores; l; l = g_list_next (l)) - { - TplLogStore *store = TPL_LOG_STORE (l->data); - - out = g_list_concat (out, tpl_log_store_get_messages_for_date ( - store, account, chat_id, chatroom, date)); - } - - return out; -} - -static gint -log_reader_message_date_cmp (gconstpointer a, - gconstpointer b) -{ - TplLogEntry *one = (TplLogEntry *) a; - TplLogEntry *two = (TplLogEntry *) b; - time_t one_time, two_time; - - one_time = tpl_log_entry_get_timestamp (one); - two_time = tpl_log_entry_get_timestamp (two); - - /* Return -1 of message1 is older than message2 */ - return one_time < two_time ? -1 : one_time - two_time; -} - -GList * -tpl_log_reader_get_filtered_messages (TplLogReader *reader, - TpAccount *account, - const gchar *chat_id, - gboolean chatroom, - guint num_messages, - TplLogMessageFilter filter, - gpointer user_data) -{ - TplLogReaderPriv *priv; - GList *out = NULL; - GList *l; - guint i = 0; - - g_return_val_if_fail (TPL_IS_LOG_READER (reader), NULL); - g_return_val_if_fail (chat_id != NULL, NULL); - - priv = GET_PRIV (reader); - - /* Get num_messages from each log store and keep only the - * newest ones in the out list. Keep that list sorted: Older first. */ - for (l = priv->stores; l; l = g_list_next (l)) - { - TplLogStore *store = TPL_LOG_STORE (l->data); - GList *new; - - new = tpl_log_store_get_filtered_messages (store, account, chat_id, - chatroom, num_messages, filter, user_data); - while (new) - { - if (i < num_messages) - { - /* We have less message than needed so far. Keep this message */ - out = g_list_insert_sorted (out, new->data, - (GCompareFunc) log_reader_message_date_cmp); - i++; - } - else if (log_reader_message_date_cmp (new->data, out->data) > 0) - { - /* This message is newer than the oldest message we have in out - * list. Remove the head of out list and insert this message */ - g_object_unref (out->data); - out = g_list_delete_link (out, out); - out = g_list_insert_sorted (out, new->data, - (GCompareFunc) log_reader_message_date_cmp); - } - else - { - /* This message is older than the oldest message we have in out - * list. Drop it. */ - g_object_unref (new->data); - } - - new = g_list_delete_link (new, new); - } - } - - return out; -} - -GList * -tpl_log_reader_get_chats (TplLogReader *reader, - TpAccount *account) -{ - GList *l, *out = NULL; - TplLogReaderPriv *priv; - - g_return_val_if_fail (TPL_IS_LOG_READER (reader), NULL); - g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL); - - priv = GET_PRIV (reader); - - for (l = priv->stores; l; l = g_list_next (l)) - { - TplLogStore *store = TPL_LOG_STORE (l->data); - - out = g_list_concat (out, - tpl_log_store_get_chats (store, account)); - } - - return out; -} - -GList * -tpl_log_reader_search_new (TplLogReader *reader, - const gchar *text) -{ - GList *l, *out = NULL; - TplLogReaderPriv *priv; - - g_return_val_if_fail (TPL_IS_LOG_READER (reader), NULL); - g_return_val_if_fail (!TPL_STR_EMPTY (text), NULL); - - priv = GET_PRIV (reader); - - for (l = priv->stores; l; l = g_list_next (l)) - { - TplLogStore *store = TPL_LOG_STORE (l->data); - - out = g_list_concat (out, - tpl_log_store_search_new (store, text)); - } - - return out; -} - -void -tpl_log_reader_search_hit_free (TplLogSearchHit *hit) -{ - if (hit->account != NULL) - g_object_unref (hit->account); - - g_free (hit->date); - g_free (hit->filename); - g_free (hit->chat_id); - - g_slice_free (TplLogSearchHit, hit); -} - -void -tpl_log_reader_search_free (GList *hits) -{ - GList *l; - - for (l = hits; l; l = g_list_next (l)) - { - tpl_log_reader_search_hit_free (l->data); - } - - g_list_free (hits); -} - -/* Format is just date, 20061201. */ -gchar * -tpl_log_reader_get_date_readable (const gchar *date) -{ - time_t t; - - t = tpl_time_parse (date); - - return tpl_time_to_string_local (t, "%a %d %b %Y"); -} diff --git a/src/tpl-log-reader.h b/src/tpl-log-reader.h deleted file mode 100644 index 5179b37..0000000 --- a/src/tpl-log-reader.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2003-2007 Imendio AB - * Copyright (C) 2007-2008 Collabora Ltd. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - * - * Authors: Xavier Claessens <xclaesse@gmail.com> - */ - -#ifndef __TPL_LOG_READER_H__ -#define __TPL_LOG_READER_H__ - - -#include <glib-object.h> -//TODO remove it -#include <tpl-log-manager.h> - -G_BEGIN_DECLS - -#define TPL_TYPE_LOG_READER (tpl_log_reader_get_type ()) -#define TPL_LOG_READER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TPL_TYPE_LOG_READER, TplLogReader)) -#define TPL_LOG_READER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TPL_TYPE_LOG_READER, TplLogReaderClass)) -#define TPL_IS_LOG_READER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TPL_TYPE_LOG_READER)) -#define TPL_IS_LOG_READER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TPL_TYPE_LOG_READER)) -#define TPL_LOG_READER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TPL_TYPE_LOG_READER, TplLogReaderClass)) - -typedef struct -{ - GObject parent; - - gpointer priv; -} TplLogReader; - -typedef struct -{ - GObjectClass parent_class; -} TplLogReaderClass; - -GType tpl_log_reader_get_type (void); - -TplLogReader *tpl_log_reader_dup_singleton (void); - -gboolean tpl_log_reader_exists (TplLogReader *manager, - TpAccount *account, const gchar *chat_id, - gboolean chatroom); - -GList *tpl_log_reader_get_dates (TplLogReader *manager, - TpAccount *account, const gchar *chat_id, - gboolean chatroom); - -GList *tpl_log_reader_get_messages_for_date (TplLogReader *manager, - TpAccount *account, const gchar *chat_id, - gboolean chatroom, const gchar *date); - -GList *tpl_log_reader_get_filtered_messages (TplLogReader *manager, - TpAccount *account, const gchar *chat_id, gboolean chatroom, - guint num_messages, TplLogMessageFilter filter, - gpointer user_data); - -GList *tpl_log_reader_get_chats (TplLogReader *manager, - TpAccount *account); - -GList *tpl_log_reader_search_new (TplLogReader *manager, - const gchar *text); - -void tpl_log_reader_search_free (GList *hits); - -gchar *tpl_log_reader_get_date_readable (const gchar *date); - -void tpl_log_reader_search_hit_free (TplLogSearchHit *hit); - -//void tpl_log_reader_observe (TplLogReader *log_reader, -// EmpathyDispatcher *dispatcher); - -G_END_DECLS - -#endif /* __TPL_LOG_READER_H__ */ diff --git a/src/tpl-text-channel-context.c b/src/tpl-text-channel-context.c index bd43586..5e60054 100644 --- a/src/tpl-text-channel-context.c +++ b/src/tpl-text-channel-context.c @@ -33,7 +33,7 @@ #include <tpl-channel.h> #include <tpl-log-entry.h> #include <tpl-log-entry-text.h> -#include <tpl-log-manager.h> +#include <tpl-log-manager-priv.h> #include <tpl-contact.h> #define TP_CONTACT_FEATURES_LEN 2 |