summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2009-12-03 20:57:40 -0200
committerCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2009-12-03 20:57:40 -0200
commit23a56c112f55c59a7714cc63f2043b43ebbbc22f (patch)
tree527c92d81d8cc2674f32e950f55f5eb279fb6696 /src
parent8201a1c1159c83db9e50546f100942fbb229bc70 (diff)
downloadtelepathy-logger-23a56c112f55c59a7714cc63f2043b43ebbbc22f.tar.gz
imported Empathy's LogStore and creating some glue objects
* added tpl_contact.c that is similar to EmpathyContact * now received/sent signals instantiate TplContact and will creat TplLogEntryText to be sent to the LogStore
Diffstat (limited to 'src')
-rwxr-xr-xsrc/compile.sh6
-rw-r--r--src/logstore/empathy-log-manager.c455
-rw-r--r--src/logstore/empathy-log-manager.h103
-rw-r--r--src/logstore/empathy-log-manager.xsl148
-rw-r--r--src/logstore/empathy-log-store-empathy.c819
-rw-r--r--src/logstore/empathy-log-store-empathy.h66
-rw-r--r--src/logstore/empathy-log-store.c173
-rw-r--r--src/logstore/empathy-log-store.h101
-rw-r--r--src/logstore/tags329
-rw-r--r--src/test.c2
-rw-r--r--src/tpl_contact.c40
-rw-r--r--src/tpl_contact.h57
-rw-r--r--src/tpl_log_entry.c19
-rw-r--r--src/tpl_log_entry.h49
-rw-r--r--src/tpl_log_entry_text.c68
-rw-r--r--src/tpl_log_entry_text.h73
-rw-r--r--src/tpl_text_channel_data.c100
-rw-r--r--src/tpl_text_channel_data.h4
18 files changed, 2536 insertions, 76 deletions
diff --git a/src/compile.sh b/src/compile.sh
index 3aa9d75..70c770c 100755
--- a/src/compile.sh
+++ b/src/compile.sh
@@ -1,10 +1,12 @@
#!/bin/bash
+PACKAGE_NAME="TpHeadlessLogger"
CC=${CC:-gcc}
-CCOPTS="--std=c99 -g -I. -Wall -Werror" # -pedantic"
-PKGS="telepathy-glib"
+CCOPTS="-DPACKAGE_NAME=${PACKAGE_NAME} --std=c99 -g -I. -I/usr/include/libempaty -Wall -Werror" # -pedantic"
+PKGS="telepathy-glib libempathy"
MODULES="tpl_observer.c tpl_headless_logger_init.c
tpl_channel_data.c tpl_text_channel_data.c
+ tpl_contact.c
tpl_utils.c
test.c"
EXECUTABLE="test"
diff --git a/src/logstore/empathy-log-manager.c b/src/logstore/empathy-log-manager.c
new file mode 100644
index 0000000..5a57f0c
--- /dev/null
+++ b/src/logstore/empathy-log-manager.c
@@ -0,0 +1,455 @@
+/* -*- 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>
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib/gstdio.h>
+
+#include <telepathy-glib/util.h>
+#include <telepathy-glib/interfaces.h>
+
+#include "empathy-log-manager.h"
+#include "empathy-log-store-empathy.h"
+#include "empathy-log-store.h"
+#include "empathy-tp-chat.h"
+#include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyLogManager)
+typedef struct
+{
+ GList *stores;
+} EmpathyLogManagerPriv;
+
+G_DEFINE_TYPE (EmpathyLogManager, empathy_log_manager, G_TYPE_OBJECT);
+
+static EmpathyLogManager * manager_singleton = NULL;
+
+static void
+log_manager_finalize (GObject *object)
+{
+ EmpathyLogManagerPriv *priv;
+
+ priv = GET_PRIV (object);
+
+ g_list_foreach (priv->stores, (GFunc) g_object_unref, NULL);
+ g_list_free (priv->stores);
+}
+
+static GObject *
+log_manager_constructor (GType type,
+ guint n_props,
+ GObjectConstructParam *props)
+{
+ GObject *retval;
+ EmpathyLogManagerPriv *priv;
+
+ if (manager_singleton)
+ {
+ retval = g_object_ref (manager_singleton);
+ }
+ else
+ {
+ retval = G_OBJECT_CLASS (empathy_log_manager_parent_class)->constructor
+ (type, n_props, props);
+
+ manager_singleton = EMPATHY_LOG_MANAGER (retval);
+ g_object_add_weak_pointer (retval, (gpointer *) &manager_singleton);
+
+ priv = GET_PRIV (manager_singleton);
+
+ priv->stores = g_list_append (priv->stores,
+ g_object_new (EMPATHY_TYPE_LOG_STORE_EMPATHY, NULL));
+ }
+
+ return retval;
+}
+
+static void
+empathy_log_manager_class_init (EmpathyLogManagerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->constructor = log_manager_constructor;
+ object_class->finalize = log_manager_finalize;
+
+ g_type_class_add_private (object_class, sizeof (EmpathyLogManagerPriv));
+}
+
+static void
+empathy_log_manager_init (EmpathyLogManager *manager)
+{
+ EmpathyLogManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
+ EMPATHY_TYPE_LOG_MANAGER, EmpathyLogManagerPriv);
+
+ manager->priv = priv;
+}
+
+EmpathyLogManager *
+empathy_log_manager_dup_singleton (void)
+{
+ return g_object_new (EMPATHY_TYPE_LOG_MANAGER, NULL);
+}
+
+gboolean
+empathy_log_manager_add_message (EmpathyLogManager *manager,
+ const gchar *chat_id,
+ gboolean chatroom,
+ EmpathyMessage *message,
+ GError **error)
+{
+ EmpathyLogManagerPriv *priv;
+ GList *l;
+ gboolean out = FALSE;
+ gboolean found = FALSE;
+
+ /* TODO: When multiple log stores appear with add_message implementations
+ * make this customisable. */
+ const gchar *add_store = "Empathy";
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), FALSE);
+ g_return_val_if_fail (chat_id != NULL, FALSE);
+ g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
+
+ priv = GET_PRIV (manager);
+
+ for (l = priv->stores; l; l = g_list_next (l))
+ {
+ if (!tp_strdiff (empathy_log_store_get_name (
+ EMPATHY_LOG_STORE (l->data)), add_store))
+ {
+ out = empathy_log_store_add_message (EMPATHY_LOG_STORE (l->data),
+ chat_id, chatroom, message, error);
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found)
+ DEBUG ("Failed to find chosen log store to write to.");
+
+ return out;
+}
+
+gboolean
+empathy_log_manager_exists (EmpathyLogManager *manager,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ GList *l;
+ EmpathyLogManagerPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), FALSE);
+ g_return_val_if_fail (chat_id != NULL, FALSE);
+
+ priv = GET_PRIV (manager);
+
+ for (l = priv->stores; l; l = g_list_next (l))
+ {
+ if (empathy_log_store_exists (EMPATHY_LOG_STORE (l->data),
+ account, chat_id, chatroom))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+GList *
+empathy_log_manager_get_dates (EmpathyLogManager *manager,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ GList *l, *out = NULL;
+ EmpathyLogManagerPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
+ g_return_val_if_fail (chat_id != NULL, NULL);
+
+ priv = GET_PRIV (manager);
+
+ for (l = priv->stores; l; l = g_list_next (l))
+ {
+ EmpathyLogStore *store = EMPATHY_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 = empathy_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 *
+empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom,
+ const gchar *date)
+{
+ GList *l, *out = NULL;
+ EmpathyLogManagerPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
+ g_return_val_if_fail (chat_id != NULL, NULL);
+
+ priv = GET_PRIV (manager);
+
+ for (l = priv->stores; l; l = g_list_next (l))
+ {
+ EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
+
+ out = g_list_concat (out, empathy_log_store_get_messages_for_date (
+ store, account, chat_id, chatroom, date));
+ }
+
+ return out;
+}
+
+static gint
+log_manager_message_date_cmp (gconstpointer a,
+ gconstpointer b)
+{
+ EmpathyMessage *one = (EmpathyMessage *) a;
+ EmpathyMessage *two = (EmpathyMessage *) b;
+ time_t one_time, two_time;
+
+ one_time = empathy_message_get_timestamp (one);
+ two_time = empathy_message_get_timestamp (two);
+
+ /* Return -1 of message1 is older than message2 */
+ return one_time < two_time ? -1 : one_time - two_time;
+}
+
+GList *
+empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom,
+ guint num_messages,
+ EmpathyLogMessageFilter filter,
+ gpointer user_data)
+{
+ EmpathyLogManagerPriv *priv;
+ GList *out = NULL;
+ GList *l;
+ guint i = 0;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
+ g_return_val_if_fail (chat_id != NULL, NULL);
+
+ priv = GET_PRIV (manager);
+
+ /* 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))
+ {
+ EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
+ GList *new;
+
+ new = empathy_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_manager_message_date_cmp);
+ i++;
+ }
+ else if (log_manager_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_manager_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 *
+empathy_log_manager_get_chats (EmpathyLogManager *manager,
+ TpAccount *account)
+{
+ GList *l, *out = NULL;
+ EmpathyLogManagerPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
+
+ priv = GET_PRIV (manager);
+
+ for (l = priv->stores; l; l = g_list_next (l))
+ {
+ EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
+
+ out = g_list_concat (out,
+ empathy_log_store_get_chats (store, account));
+ }
+
+ return out;
+}
+
+GList *
+empathy_log_manager_search_new (EmpathyLogManager *manager,
+ const gchar *text)
+{
+ GList *l, *out = NULL;
+ EmpathyLogManagerPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_MANAGER (manager), NULL);
+ g_return_val_if_fail (!EMP_STR_EMPTY (text), NULL);
+
+ priv = GET_PRIV (manager);
+
+ for (l = priv->stores; l; l = g_list_next (l))
+ {
+ EmpathyLogStore *store = EMPATHY_LOG_STORE (l->data);
+
+ out = g_list_concat (out,
+ empathy_log_store_search_new (store, text));
+ }
+
+ return out;
+}
+
+void
+empathy_log_manager_search_hit_free (EmpathyLogSearchHit *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 (EmpathyLogSearchHit, hit);
+}
+
+void
+empathy_log_manager_search_free (GList *hits)
+{
+ GList *l;
+
+ for (l = hits; l; l = g_list_next (l))
+ {
+ empathy_log_manager_search_hit_free (l->data);
+ }
+
+ g_list_free (hits);
+}
+
+/* Format is just date, 20061201. */
+gchar *
+empathy_log_manager_get_date_readable (const gchar *date)
+{
+ time_t t;
+
+ t = empathy_time_parse (date);
+
+ return empathy_time_to_string_local (t, "%a %d %b %Y");
+}
+
+static void
+log_manager_chat_received_message_cb (EmpathyTpChat *tp_chat,
+ EmpathyMessage *message,
+ EmpathyLogManager *log_manager)
+{
+ GError *error = NULL;
+ TpHandleType handle_type;
+ TpChannel *channel;
+
+ channel = empathy_tp_chat_get_channel (tp_chat);
+ tp_channel_get_handle (channel, &handle_type);
+
+ if (!empathy_log_manager_add_message (log_manager,
+ tp_channel_get_identifier (channel),
+ handle_type == TP_HANDLE_TYPE_ROOM,
+ message, &error))
+ {
+ DEBUG ("Failed to write message: %s",
+ error ? error->message : "No error message");
+
+ if (error != NULL)
+ g_error_free (error);
+ }
+}
+
+static void
+log_manager_dispatcher_observe_cb (EmpathyDispatcher *dispatcher,
+ EmpathyDispatchOperation *operation,
+ EmpathyLogManager *log_manager)
+{
+ GQuark channel_type;
+
+ channel_type = empathy_dispatch_operation_get_channel_type_id (operation);
+
+ if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_TEXT)
+ {
+ EmpathyTpChat *tp_chat;
+
+ tp_chat = EMPATHY_TP_CHAT (
+ empathy_dispatch_operation_get_channel_wrapper (operation));
+
+ g_signal_connect (tp_chat, "message-received",
+ G_CALLBACK (log_manager_chat_received_message_cb), log_manager);
+ }
+}
+
+
+void
+empathy_log_manager_observe (EmpathyLogManager *log_manager,
+ EmpathyDispatcher *dispatcher)
+{
+ g_signal_connect (dispatcher, "observe",
+ G_CALLBACK (log_manager_dispatcher_observe_cb), log_manager);
+}
diff --git a/src/logstore/empathy-log-manager.h b/src/logstore/empathy-log-manager.h
new file mode 100644
index 0000000..25f1b5f
--- /dev/null
+++ b/src/logstore/empathy-log-manager.h
@@ -0,0 +1,103 @@
+/* -*- 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 __EMPATHY_LOG_MANAGER_H__
+#define __EMPATHY_LOG_MANAGER_H__
+
+#include <glib-object.h>
+
+#include "empathy-message.h"
+#include "empathy-dispatcher.h"
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_LOG_MANAGER (empathy_log_manager_get_type ())
+#define EMPATHY_LOG_MANAGER(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_LOG_MANAGER, \
+ EmpathyLogManager))
+#define EMPATHY_LOG_MANAGER_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_LOG_MANAGER, \
+ EmpathyLogManagerClass))
+#define EMPATHY_IS_LOG_MANAGER(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_LOG_MANAGER))
+#define EMPATHY_IS_LOG_MANAGER_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_LOG_MANAGER))
+#define EMPATHY_LOG_MANAGER_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_LOG_MANAGER, \
+ EmpathyLogManagerClass))
+
+typedef struct _EmpathyLogManager EmpathyLogManager;
+typedef struct _EmpathyLogManagerClass EmpathyLogManagerClass;
+typedef struct _EmpathyLogSearchHit EmpathyLogSearchHit;
+
+struct _EmpathyLogManager
+{
+ GObject parent;
+ gpointer priv;
+};
+
+struct _EmpathyLogManagerClass
+{
+ GObjectClass parent_class;
+};
+
+struct _EmpathyLogSearchHit
+{
+ TpAccount *account;
+ gchar *chat_id;
+ gboolean is_chatroom;
+ gchar *filename;
+ gchar *date;
+};
+
+typedef gboolean (*EmpathyLogMessageFilter) (EmpathyMessage *message,
+ gpointer user_data);
+
+GType empathy_log_manager_get_type (void) G_GNUC_CONST;
+EmpathyLogManager *empathy_log_manager_dup_singleton (void);
+gboolean empathy_log_manager_add_message (EmpathyLogManager *manager,
+ const gchar *chat_id, gboolean chatroom, EmpathyMessage *message,
+ GError **error);
+gboolean empathy_log_manager_exists (EmpathyLogManager *manager,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom);
+GList *empathy_log_manager_get_dates (EmpathyLogManager *manager,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom);
+GList *empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom,
+ const gchar *date);
+GList *empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom,
+ guint num_messages, EmpathyLogMessageFilter filter, gpointer user_data);
+GList *empathy_log_manager_get_chats (EmpathyLogManager *manager,
+ TpAccount *account);
+GList *empathy_log_manager_search_new (EmpathyLogManager *manager,
+ const gchar *text);
+void empathy_log_manager_search_free (GList *hits);
+gchar *empathy_log_manager_get_date_readable (const gchar *date);
+void empathy_log_manager_search_hit_free (EmpathyLogSearchHit *hit);
+void empathy_log_manager_observe (EmpathyLogManager *log_manager,
+ EmpathyDispatcher *dispatcher);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_LOG_MANAGER_H__ */
diff --git a/src/logstore/empathy-log-manager.xsl b/src/logstore/empathy-log-manager.xsl
new file mode 100644
index 0000000..a934f3a
--- /dev/null
+++ b/src/logstore/empathy-log-manager.xsl
@@ -0,0 +1,148 @@
+<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+
+ <xsl:output method="html" encoding="utf-8" indent="yes"/>
+
+ <xsl:template match="/">
+ <html>
+ <head>
+ <style type="text/css">
+ <xsl:text>
+ body {
+ background: #fff;
+ font-family: Verdana, "Bitstream Vera Sans", Sans-Serif;
+ font-size: 10pt;
+ }
+ .stamp {
+ color: #999;
+ }
+ .top-day-stamp {
+ color: #999;
+ text-align: center;
+ margin-bottom: 1em;
+ }
+ .new-day-stamp {
+ color: #999;
+ text-align: center;
+ margin-bottom: 1em;
+ margin-top: 1em;
+ }
+ .nick {
+ color: rgb(54,100, 139);
+ }
+ .nick-self {
+ color: rgb(46,139,87);
+ }
+ .nick-highlight {
+ color: rgb(205,92,92);
+ }
+ </xsl:text>
+ </style>
+ <title><xsl:value-of select="$title"/></title>
+ </head>
+ <body>
+ <xsl:apply-templates/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template name="get-day">
+ <xsl:param name="stamp"/>
+ <xsl:value-of select="substring ($stamp, 1, 8)"/>
+ </xsl:template>
+
+ <xsl:template name="format-stamp">
+ <xsl:param name="stamp"/>
+ <xsl:variable name="hour" select="substring ($stamp, 10, 2)"/>
+ <xsl:variable name="min" select="substring ($stamp, 13, 2)"/>
+
+ <xsl:value-of select="$hour"/>:<xsl:value-of select="$min"/>
+ </xsl:template>
+
+ <xsl:template name="format-day-stamp">
+ <xsl:param name="stamp"/>
+ <xsl:variable name="year" select="substring ($stamp, 1, 4)"/>
+ <xsl:variable name="month" select="substring ($stamp, 5, 2)"/>
+ <xsl:variable name="day" select="substring ($stamp, 7, 2)"/>
+
+ <xsl:value-of select="$year"/>-<xsl:value-of select="$month"/>-<xsl:value-of select="$day"/>
+ </xsl:template>
+
+ <xsl:template name="header">
+ <xsl:param name="stamp"/>
+ <div class="top-day-stamp">
+ <xsl:call-template name="format-day-stamp">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="a">
+ <xsl:text disable-output-escaping="yes">&lt;a href="</xsl:text>
+
+ <xsl:value-of disable-output-escaping="yes" select="@href"/>
+
+ <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>
+
+ <xsl:value-of select="@href"/>
+ <xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="log">
+
+ <div class="top-day-stamp">
+ <xsl:call-template name="format-day-stamp">
+ <xsl:with-param name="stamp" select="//message[1]/@time"/>
+ </xsl:call-template>
+ </div>
+
+ <xsl:for-each select="*">
+
+ <xsl:variable name="prev-time">
+ <xsl:call-template name="get-day">
+ <xsl:with-param name="stamp" select="preceding-sibling::*[1]/@time"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="this-time">
+ <xsl:call-template name="get-day">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="$prev-time &lt; $this-time">
+ <div class="new-day-stamp">
+ <xsl:call-template name="format-day-stamp">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </div>
+ </xsl:if>
+
+ <xsl:variable name="stamp">
+ <xsl:call-template name="format-stamp">
+ <xsl:with-param name="stamp" select="@time"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <span class="stamp">
+ <xsl:value-of select="$stamp"/>
+ </span>
+
+ <xsl:variable name="nick-class">
+ <xsl:choose>
+ <xsl:when test="not(string(@id))">nick-self</xsl:when>
+ <xsl:otherwise>nick</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <span class="{$nick-class}">
+ &lt;<xsl:value-of select="@name"/>&gt;
+ </span>
+
+ <xsl:apply-templates/>
+ <br/>
+
+ </xsl:for-each>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/src/logstore/empathy-log-store-empathy.c b/src/logstore/empathy-log-store-empathy.c
new file mode 100644
index 0000000..ebf6c91
--- /dev/null
+++ b/src/logstore/empathy-log-store-empathy.c
@@ -0,0 +1,819 @@
+/* -*- 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>
+ * Jonny Lamb <jonny.lamb@collabora.co.uk>
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib/gstdio.h>
+
+#include <telepathy-glib/account-manager.h>
+#include <telepathy-glib/util.h>
+#include <telepathy-glib/defs.h>
+
+#include "empathy-log-store.h"
+#include "empathy-log-store-empathy.h"
+#include "empathy-log-manager.h"
+#include "empathy-contact.h"
+#include "empathy-time.h"
+#include "empathy-utils.h"
+
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
+#include "empathy-debug.h"
+
+#define LOG_DIR_CREATE_MODE (S_IRUSR | S_IWUSR | S_IXUSR)
+#define LOG_FILE_CREATE_MODE (S_IRUSR | S_IWUSR)
+#define LOG_DIR_CHATROOMS "chatrooms"
+#define LOG_FILENAME_SUFFIX ".log"
+#define LOG_TIME_FORMAT_FULL "%Y%m%dT%H:%M:%S"
+#define LOG_TIME_FORMAT "%Y%m%d"
+#define LOG_HEADER \
+ "<?xml version='1.0' encoding='utf-8'?>\n" \
+ "<?xml-stylesheet type=\"text/xsl\" href=\"empathy-log.xsl\"?>\n" \
+ "<log>\n"
+
+#define LOG_FOOTER \
+ "</log>\n"
+
+
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TplLogStoreEmpathy)
+typedef struct
+{
+ gchar *basedir;
+ gchar *name;
+ TpAccountManager *account_manager;
+} TplLogStoreEmpathyPriv;
+
+static void log_store_iface_init (gpointer g_iface,gpointer iface_data);
+
+G_DEFINE_TYPE_WITH_CODE (TplLogStoreEmpathy, tpl_log_store_empathy,
+ G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_LOG_STORE,
+ log_store_iface_init));
+
+static void
+log_store_empathy_finalize (GObject *object)
+{
+ TplLogStoreEmpathy *self = TPL_LOG_STORE_EMPATHY (object);
+ TplLogStoreEmpathyPriv *priv = GET_PRIV (self);
+
+ g_object_unref (priv->account_manager);
+ g_free (priv->basedir);
+ g_free (priv->name);
+}
+
+static void
+tpl_log_store_empathy_class_init (TplLogStoreEmpathyClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = log_store_empathy_finalize;
+
+ g_type_class_add_private (object_class, sizeof (TplLogStoreEmpathyPriv));
+}
+
+static void
+tpl_log_store_empathy_init (TplLogStoreEmpathy *self)
+{
+ TplLogStoreEmpathyPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_LOG_STORE_EMPATHY, TplLogStoreEmpathyPriv);
+
+ self->priv = priv;
+
+ priv->basedir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (),
+ PACKAGE_NAME, "logs", NULL);
+
+ priv->name = g_strdup ("Empathy");
+ priv->account_manager = tp_account_manager_dup ();
+}
+
+static gchar *
+log_store_account_to_dirname (TpAccount *account)
+{
+ const gchar *name;
+
+ name = tp_proxy_get_object_path (account);
+ if (g_str_has_prefix (name, TP_ACCOUNT_OBJECT_PATH_BASE))
+ name += strlen (TP_ACCOUNT_OBJECT_PATH_BASE);
+
+ return g_strdelimit (g_strdup (name), "/", '_');
+}
+
+
+static gchar *
+log_store_empathy_get_dir (TplLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ gchar *basedir;
+ gchar *escaped;
+ TplLogStoreEmpathyPriv *priv;
+
+ priv = GET_PRIV (self);
+
+ escaped = log_store_account_to_dirname (account);
+
+ if (chatroom)
+ basedir = g_build_path (G_DIR_SEPARATOR_S, priv->basedir, escaped,
+ LOG_DIR_CHATROOMS, chat_id, NULL);
+ else
+ basedir = g_build_path (G_DIR_SEPARATOR_S, priv->basedir,
+ escaped, chat_id, NULL);
+
+ g_free (escaped);
+
+ return basedir;
+}
+
+static gchar *
+log_store_empathy_get_timestamp_filename (void)
+{
+ time_t t;
+ gchar *time_str;
+ gchar *filename;
+
+ t = empathy_time_get_current ();
+ time_str = empathy_time_to_string_local (t, LOG_TIME_FORMAT);
+ filename = g_strconcat (time_str, LOG_FILENAME_SUFFIX, NULL);
+
+ g_free (time_str);
+
+ return filename;
+}
+
+static gchar *
+log_store_empathy_get_timestamp_from_message (TplLogEntry *message)
+{
+ time_t t;
+
+ t = empathy_message_get_timestamp (message);
+
+ /* We keep the timestamps in the messages as UTC. */
+ return empathy_time_to_string_utc (t, LOG_TIME_FORMAT_FULL);
+}
+
+static gchar *
+log_store_empathy_get_filename (TplLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ gchar *basedir;
+ gchar *timestamp;
+ gchar *filename;
+
+ basedir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
+ timestamp = log_store_empathy_get_timestamp_filename ();
+ filename = g_build_filename (basedir, timestamp, NULL);
+
+ g_free (basedir);
+ g_free (timestamp);
+
+ return filename;
+}
+
+static gboolean
+log_store_empathy_add_message (TplLogStore *self,
+ const gchar *chat_id,
+ gboolean chatroom,
+ TplLogEntry *message,
+ GError **error)
+{
+ FILE *file;
+ TpAccount *account;
+ TpContact *sender;
+ const gchar *body_str;
+ const gchar *str;
+ //EmpathyAvatar *avatar;
+ //gchar *avatar_token = NULL;
+ gchar *filename;
+ gchar *basedir;
+ gchar *body;
+ gchar *timestamp;
+ gchar *contact_name;
+ gchar *contact_id;
+ TpChannelTextMessageType msg_type;
+
+ g_return_val_if_fail (TPL_IS_LOG_STORE (self), FALSE);
+ g_return_val_if_fail (chat_id != NULL, FALSE);
+ g_return_val_if_fail (TPL_IS_LOG_ENTRY (message), FALSE);
+
+ sender = tpl_log_entry_text_get_sender (message);
+ account = tpl_channel_get_account (
+ tpl_log_entry_text_get_channel (message) );
+ body_str = tpl_log_entry_text_get_message (message);
+ msg_type = tpl_log_entry_text_get_message_type (message);
+
+
+ if (EMP_STR_EMPTY (body_str))
+ return FALSE;
+
+ filename = log_store_empathy_get_filename (self, account, chat_id, chatroom);
+ basedir = g_path_get_dirname (filename);
+ if (!g_file_test (basedir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
+ {
+ DEBUG ("Creating directory:'%s'", basedir);
+ g_mkdir_with_parents (basedir, LOG_DIR_CREATE_MODE);
+ }
+ g_free (basedir);
+
+ DEBUG ("Adding message: '%s' to file: '%s'", body_str, filename);
+
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+ {
+ file = g_fopen (filename, "w+");
+ if (file != NULL)
+ g_fprintf (file, LOG_HEADER);
+
+ g_chmod (filename, LOG_FILE_CREATE_MODE);
+ }
+ else
+ {
+ file = g_fopen (filename, "r+");
+ if (file != NULL)
+ fseek (file, - strlen (LOG_FOOTER), SEEK_END);
+ }
+
+ body = g_markup_escape_text (body_str, -1);
+ timestamp = log_store_empathy_get_timestamp_from_message (message);
+
+ str = tp_contact_get_alias (sender);
+ contact_name = g_markup_escape_text (str, -1);
+
+ str = tp_contact_get_id (sender);
+ contact_id = g_markup_escape_text (str, -1);
+/*
+ avatar = empathy_contact_get_avatar (sender);
+ if (avatar != NULL)
+ avatar_token = g_markup_escape_text (avatar->token, -1);
+*/
+ g_fprintf (file,
+ "<message time='%s' cm_id='%d' id='%s' name='%s' token='%s' isuser='%s' type='%s'>"
+ "%s</message>\n" LOG_FOOTER, timestamp,
+ empathy_message_get_id (message),
+ contact_id, contact_name,
+ avatar_token ? avatar_token : "",
+ empathy_contact_is_user (sender) ? "true" : "false",
+ empathy_message_type_to_str (msg_type), body);
+
+ fclose (file);
+ g_free (filename);
+ g_free (contact_id);
+ g_free (contact_name);
+ g_free (timestamp);
+ g_free (body);
+ g_free (avatar_token);
+
+ return TRUE;
+}
+
+static gboolean
+log_store_empathy_exists (TplLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ gchar *dir;
+ gboolean exists;
+
+ dir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
+ exists = g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR);
+ g_free (dir);
+
+ return exists;
+}
+
+static GList *
+log_store_empathy_get_dates (TplLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ GList *dates = NULL;
+ gchar *date;
+ gchar *directory;
+ GDir *dir;
+ const gchar *filename;
+ const gchar *p;
+
+ g_return_val_if_fail (TPL_IS_LOG_STORE (self), NULL);
+ g_return_val_if_fail (chat_id != NULL, NULL);
+
+ directory = log_store_empathy_get_dir (self, account, chat_id, chatroom);
+ dir = g_dir_open (directory, 0, NULL);
+ if (!dir)
+ {
+ DEBUG ("Could not open directory:'%s'", directory);
+ g_free (directory);
+ return NULL;
+ }
+
+ DEBUG ("Collating a list of dates in:'%s'", directory);
+
+ while ((filename = g_dir_read_name (dir)) != NULL)
+ {
+ if (!g_str_has_suffix (filename, LOG_FILENAME_SUFFIX))
+ continue;
+
+ p = strstr (filename, LOG_FILENAME_SUFFIX);
+ date = g_strndup (filename, p - filename);
+
+ if (!date)
+ continue;
+
+ if (!g_regex_match_simple ("\\d{8}", date, 0, 0))
+ continue;
+
+ dates = g_list_insert_sorted (dates, date, (GCompareFunc) strcmp);
+ }
+
+ g_free (directory);
+ g_dir_close (dir);
+
+ DEBUG ("Parsed %d dates", g_list_length (dates));
+
+ return dates;
+}
+
+static gchar *
+log_store_empathy_get_filename_for_date (TplLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom,
+ const gchar *date)
+{
+ gchar *basedir;
+ gchar *timestamp;
+ gchar *filename;
+
+ basedir = log_store_empathy_get_dir (self, account, chat_id, chatroom);
+ timestamp = g_strconcat (date, LOG_FILENAME_SUFFIX, NULL);
+ filename = g_build_filename (basedir, timestamp, NULL);
+
+ g_free (basedir);
+ g_free (timestamp);
+
+ return filename;
+}
+
+static EmpathyLogSearchHit *
+log_store_empathy_search_hit_new (TplLogStore *self,
+ const gchar *filename)
+{
+ TplLogStoreEmpathyPriv *priv = GET_PRIV (self);
+ EmpathyLogSearchHit *hit;
+ gchar *account_name;
+ const gchar *end;
+ gchar **strv;
+ guint len;
+ GList *accounts, *l;
+
+ if (!g_str_has_suffix (filename, LOG_FILENAME_SUFFIX))
+ return NULL;
+
+ strv = g_strsplit (filename, G_DIR_SEPARATOR_S, -1);
+ len = g_strv_length (strv);
+
+ hit = g_slice_new0 (EmpathyLogSearchHit);
+
+ end = strstr (strv[len-1], LOG_FILENAME_SUFFIX);
+ hit->date = g_strndup (strv[len-1], end - strv[len-1]);
+ hit->chat_id = g_strdup (strv[len-2]);
+ hit->is_chatroom = (strcmp (strv[len-3], LOG_DIR_CHATROOMS) == 0);
+
+ if (hit->is_chatroom)
+ account_name = strv[len-4];
+ else
+ account_name = strv[len-3];
+
+ /* FIXME: This assumes the account manager is prepared, but the
+ * synchronous API forces this. See bug #599189. */
+ accounts = tp_account_manager_get_valid_accounts (priv->account_manager);
+
+ for (l = accounts; l != NULL; l = g_list_next (l))
+ {
+ TpAccount *account = TP_ACCOUNT (l->data);
+ gchar *name;
+
+ name = log_store_account_to_dirname (account);
+ if (!tp_strdiff (name, account_name))
+ {
+ g_assert (hit->account == NULL);
+ hit->account = account;
+ g_object_ref (account);
+ }
+ g_free (name);
+ }
+ g_list_free (accounts);
+
+ hit->filename = g_strdup (filename);
+
+ g_strfreev (strv);
+
+ return hit;
+}
+
+static GList *
+log_store_empathy_get_messages_for_file (TplLogStore *self,
+ TpAccount *account,
+ const gchar *filename)
+{
+ GList *messages = NULL;
+ xmlParserCtxtPtr ctxt;
+ xmlDocPtr doc;
+ xmlNodePtr log_node;
+ xmlNodePtr node;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ DEBUG ("Attempting to parse filename:'%s'...", filename);
+
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+ {
+ DEBUG ("Filename:'%s' does not exist", filename);
+ return NULL;
+ }
+
+ /* Create parser. */
+ ctxt = xmlNewParserCtxt ();
+
+ /* Parse and validate the file. */
+ doc = xmlCtxtReadFile (ctxt, filename, NULL, 0);
+ if (!doc)
+ {
+ g_warning ("Failed to parse file:'%s'", filename);
+ xmlFreeParserCtxt (ctxt);
+ return NULL;
+ }
+
+ /* The root node, presets. */
+ log_node = xmlDocGetRootElement (doc);
+ if (!log_node)
+ {
+ xmlFreeDoc (doc);
+ xmlFreeParserCtxt (ctxt);
+ return NULL;
+ }
+
+ /* Now get the messages. */
+ for (node = log_node->children; node; node = node->next)
+ {
+ TplLogEntry *message;
+ EmpathyContact *sender;
+ gchar *time_;
+ time_t t;
+ gchar *sender_id;
+ gchar *sender_name;
+ gchar *sender_avatar_token;
+ gchar *body;
+ gchar *is_user_str;
+ gboolean is_user = FALSE;
+ gchar *msg_type_str;
+ gchar *cm_id_str;
+ guint cm_id;
+ TpChannelTextMessageType msg_type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
+
+ if (strcmp ((const gchar *) node->name, "message") != 0)
+ continue;
+
+ body = (gchar *) xmlNodeGetContent (node);
+ time_ = (gchar *) xmlGetProp (node, (const xmlChar *) "time");
+ sender_id = (gchar *) xmlGetProp (node, (const xmlChar *) "id");
+ sender_name = (gchar *) xmlGetProp (node, (const xmlChar *) "name");
+ sender_avatar_token = (gchar *) xmlGetProp (node,
+ (const xmlChar *) "token");
+ is_user_str = (gchar *) xmlGetProp (node, (const xmlChar *) "isuser");
+ msg_type_str = (gchar *) xmlGetProp (node, (const xmlChar *) "type");
+ cm_id_str = (gchar *) xmlGetProp (node, (const xmlChar *) "cm_id");
+
+ if (is_user_str)
+ is_user = strcmp (is_user_str, "true") == 0;
+
+ if (msg_type_str)
+ msg_type = empathy_message_type_from_str (msg_type_str);
+
+ if (cm_id_str)
+ cm_id = atoi (cm_id_str);
+
+ t = empathy_time_parse (time_);
+
+ sender = empathy_contact_new_for_log (account, sender_id, sender_name,
+ is_user);
+
+ if (!EMP_STR_EMPTY (sender_avatar_token))
+ empathy_contact_load_avatar_cache (sender,
+ sender_avatar_token);
+
+ message = empathy_message_new (body);
+ empathy_message_set_sender (message, sender);
+ empathy_message_set_timestamp (message, t);
+ empathy_message_set_tptype (message, msg_type);
+ empathy_message_set_is_backlog (message, TRUE);
+
+ if (cm_id_str)
+ empathy_message_set_id (message, cm_id);
+
+ messages = g_list_append (messages, message);
+
+ g_object_unref (sender);
+ xmlFree (time_);
+ xmlFree (sender_id);
+ xmlFree (sender_name);
+ xmlFree (body);
+ xmlFree (is_user_str);
+ xmlFree (msg_type_str);
+ xmlFree (cm_id_str);
+ xmlFree (sender_avatar_token);
+ }
+
+ DEBUG ("Parsed %d messages", g_list_length (messages));
+
+ xmlFreeDoc (doc);
+ xmlFreeParserCtxt (ctxt);
+
+ return messages;
+}
+
+static GList *
+log_store_empathy_get_all_files (TplLogStore *self,
+ const gchar *dir)
+{
+ GDir *gdir;
+ GList *files = NULL;
+ const gchar *name;
+ const gchar *basedir;
+ TplLogStoreEmpathyPriv *priv;
+
+ priv = GET_PRIV (self);
+
+ basedir = dir ? dir : priv->basedir;
+
+ gdir = g_dir_open (basedir, 0, NULL);
+ if (!gdir)
+ return NULL;
+
+ while ((name = g_dir_read_name (gdir)) != NULL)
+ {
+ gchar *filename;
+
+ filename = g_build_filename (basedir, name, NULL);
+ if (g_str_has_suffix (filename, LOG_FILENAME_SUFFIX))
+ {
+ files = g_list_prepend (files, filename);
+ continue;
+ }
+
+ if (g_file_test (filename, G_FILE_TEST_IS_DIR))
+ {
+ /* Recursively get all log files */
+ files = g_list_concat (files,
+ log_store_empathy_get_all_files (self, filename));
+ }
+
+ g_free (filename);
+ }
+
+ g_dir_close (gdir);
+
+ return files;
+}
+
+static GList *
+log_store_empathy_search_new (TplLogStore *self,
+ const gchar *text)
+{
+ GList *files, *l;
+ GList *hits = NULL;
+ gchar *text_casefold;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
+ g_return_val_if_fail (!EMP_STR_EMPTY (text), NULL);
+
+ text_casefold = g_utf8_casefold (text, -1);
+
+ files = log_store_empathy_get_all_files (self, NULL);
+ DEBUG ("Found %d log files in total", g_list_length (files));
+
+ for (l = files; l; l = g_list_next (l))
+ {
+ gchar *filename;
+ GMappedFile *file;
+ gsize length;
+ gchar *contents;
+ gchar *contents_casefold;
+
+ filename = l->data;
+
+ file = g_mapped_file_new (filename, FALSE, NULL);
+ if (!file)
+ continue;
+
+ length = g_mapped_file_get_length (file);
+ contents = g_mapped_file_get_contents (file);
+ contents_casefold = g_utf8_casefold (contents, length);
+
+ g_mapped_file_unref (file);
+
+ if (strstr (contents_casefold, text_casefold))
+ {
+ EmpathyLogSearchHit *hit;
+
+ hit = log_store_empathy_search_hit_new (self, filename);
+
+ if (hit)
+ {
+ hits = g_list_prepend (hits, hit);
+ DEBUG ("Found text:'%s' in file:'%s' on date:'%s'",
+ text, hit->filename, hit->date);
+ }
+ }
+
+ g_free (contents_casefold);
+ g_free (filename);
+ }
+
+ g_list_free (files);
+ g_free (text_casefold);
+
+ return hits;
+}
+
+static GList *
+log_store_empathy_get_chats_for_dir (TplLogStore *self,
+ const gchar *dir,
+ gboolean is_chatroom)
+{
+ GDir *gdir;
+ GList *hits = NULL;
+ const gchar *name;
+ GError *error = NULL;
+
+ gdir = g_dir_open (dir, 0, &error);
+ if (!gdir)
+ {
+ DEBUG ("Failed to open directory: %s, error: %s", dir, error->message);
+ g_error_free (error);
+ return NULL;
+ }
+
+ while ((name = g_dir_read_name (gdir)) != NULL)
+ {
+ EmpathyLogSearchHit *hit;
+
+ if (!is_chatroom && strcmp (name, LOG_DIR_CHATROOMS) == 0)
+ {
+ gchar *filename = g_build_filename (dir, name, NULL);
+ hits = g_list_concat (hits, log_store_empathy_get_chats_for_dir (
+ self, filename, TRUE));
+ g_free (filename);
+ continue;
+ }
+ hit = g_slice_new0 (EmpathyLogSearchHit);
+ hit->chat_id = g_strdup (name);
+ hit->is_chatroom = is_chatroom;
+
+ hits = g_list_prepend (hits, hit);
+ }
+
+ g_dir_close (gdir);
+
+ return hits;
+}
+
+
+static GList *
+log_store_empathy_get_messages_for_date (TplLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom,
+ const gchar *date)
+{
+ gchar *filename;
+ GList *messages;
+
+ g_return_val_if_fail (EMPATHY_IS_LOG_STORE (self), NULL);
+ g_return_val_if_fail (chat_id != NULL, NULL);
+ g_return_val_if_fail (account != NULL, NULL);
+
+ filename = log_store_empathy_get_filename_for_date (self, account,
+ chat_id, chatroom, date);
+ messages = log_store_empathy_get_messages_for_file (self, account,
+ filename);
+ g_free (filename);
+
+ return messages;
+}
+
+static GList *
+log_store_empathy_get_chats (TplLogStore *self,
+ TpAccount *account)
+{
+ gchar *dir;
+ GList *hits;
+ TplLogStoreEmpathyPriv *priv;
+
+ priv = GET_PRIV (self);
+
+ dir = log_store_empathy_get_dir (self, account, NULL, FALSE);
+
+ hits = log_store_empathy_get_chats_for_dir (self, dir, FALSE);
+
+ g_free (dir);
+
+ return hits;
+}
+
+static const gchar *
+log_store_empathy_get_name (TplLogStore *self)
+{
+ TplLogStoreEmpathyPriv *priv = GET_PRIV (self);
+
+ return priv->name;
+}
+
+static GList *
+log_store_empathy_get_filtered_messages (TplLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom,
+ guint num_messages,
+ EmpathyLogMessageFilter filter,
+ gpointer user_data)
+{
+ GList *dates, *l, *messages = NULL;
+ guint i = 0;
+
+ dates = log_store_empathy_get_dates (self, account, chat_id, chatroom);
+
+ for (l = g_list_last (dates); l && i < num_messages; l = g_list_previous (l))
+ {
+ GList *new_messages, *n, *next;
+
+ /* FIXME: We should really restrict the message parsing to get only
+ * the newest num_messages. */
+ new_messages = log_store_empathy_get_messages_for_date (self, account,
+ chat_id, chatroom, l->data);
+
+ n = new_messages;
+ while (n != NULL)
+ {
+ next = g_list_next (n);
+ if (!filter (n->data, user_data))
+ {
+ g_object_unref (n->data);
+ new_messages = g_list_delete_link (new_messages, n);
+ }
+ else
+ {
+ i++;
+ }
+ n = next;
+ }
+ messages = g_list_concat (messages, new_messages);
+ }
+
+ g_list_foreach (dates, (GFunc) g_free, NULL);
+ g_list_free (dates);
+
+ return messages;
+}
+
+static void
+log_store_iface_init (gpointer g_iface,
+ gpointer iface_data)
+{
+ TplLogStoreInterface *iface = (TplLogStoreInterface *) g_iface;
+
+ iface->get_name = log_store_empathy_get_name;
+ iface->exists = log_store_empathy_exists;
+ iface->add_message = log_store_empathy_add_message;
+ iface->get_dates = log_store_empathy_get_dates;
+ iface->get_messages_for_date = log_store_empathy_get_messages_for_date;
+ iface->get_chats = log_store_empathy_get_chats;
+ iface->search_new = log_store_empathy_search_new;
+ iface->ack_message = NULL;
+ iface->get_filtered_messages = log_store_empathy_get_filtered_messages;
+}
diff --git a/src/logstore/empathy-log-store-empathy.h b/src/logstore/empathy-log-store-empathy.h
new file mode 100644
index 0000000..e77076a
--- /dev/null
+++ b/src/logstore/empathy-log-store-empathy.h
@@ -0,0 +1,66 @@
+/* -*- 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>
+ * Jonny Lamb <jonny.lamb@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_LOG_STORE_EMPATHY_H__
+#define __EMPATHY_LOG_STORE_EMPATHY_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_LOG_STORE_EMPATHY \
+ (empathy_log_store_empathy_get_type ())
+#define EMPATHY_LOG_STORE_EMPATHY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
+ EmpathyLogStoreEmpathy))
+#define EMPATHY_LOG_STORE_EMPATHY_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_CAST ((vtable), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
+ EmpathyLogStoreEmpathyClass))
+#define EMPATHY_IS_LOG_STORE_EMPATHY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_LOG_STORE_EMPATHY))
+#define EMPATHY_IS_LOG_STORE_EMPATHY_CLASS(vtable) \
+ (G_TYPE_CHECK_CLASS_TYPE ((vtable), EMPATHY_TYPE_LOG_STORE_EMPATHY))
+#define EMPATHY_LOG_STORE_EMPATHY_GET_CLASS(inst) \
+ (G_TYPE_INSTANCE_GET_CLASS ((inst), EMPATHY_TYPE_LOG_STORE_EMPATHY, \
+ EmpathyLogStoreEmpathyClass))
+
+typedef struct _EmpathyLogStoreEmpathy EmpathyLogStoreEmpathy;
+typedef struct _EmpathyLogStoreEmpathyClass EmpathyLogStoreEmpathyClass;
+
+struct _EmpathyLogStoreEmpathy
+{
+ GObject parent;
+ gpointer priv;
+};
+
+struct _EmpathyLogStoreEmpathyClass
+{
+ GObjectClass parent;
+};
+
+GType empathy_log_store_empathy_get_type (void);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_LOG_STORE_EMPATHY_H__ */
diff --git a/src/logstore/empathy-log-store.c b/src/logstore/empathy-log-store.c
new file mode 100644
index 0000000..512c4c0
--- /dev/null
+++ b/src/logstore/empathy-log-store.c
@@ -0,0 +1,173 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 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: Jonny Lamb <jonny.lamb@collabora.co.uk>
+ */
+
+#include "empathy-log-store.h"
+
+GType
+empathy_log_store_get_type (void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ static const GTypeInfo info = {
+ sizeof (EmpathyLogStoreInterface),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ NULL, /* class_init */
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ 0,
+ 0, /* n_preallocs */
+ NULL /* instance_init */
+ };
+ type = g_type_register_static (G_TYPE_INTERFACE, "EmpathyLogStore",
+ &info, 0);
+ }
+ return type;
+}
+
+const gchar *
+empathy_log_store_get_name (EmpathyLogStore *self)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name)
+ return NULL;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_name (self);
+}
+
+gboolean
+empathy_log_store_exists (EmpathyLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists)
+ return FALSE;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->exists (
+ self, account, chat_id, chatroom);
+}
+
+
+
+gboolean
+empathy_log_store_add_message (EmpathyLogStore *self,
+ const gchar *chat_id,
+ gboolean chatroom,
+ EmpathyMessage *message,
+ GError **error)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message)
+ return FALSE;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->add_message (
+ self, chat_id, chatroom, message, error);
+}
+
+GList *
+empathy_log_store_get_dates (EmpathyLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates)
+ return NULL;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_dates (
+ self, account, chat_id, chatroom);
+}
+
+GList *
+empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom,
+ const gchar *date)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date)
+ return NULL;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_messages_for_date (
+ self, account, chat_id, chatroom, date);
+}
+
+GList *
+empathy_log_store_get_last_messages (EmpathyLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages)
+ return NULL;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_last_messages (
+ self, account, chat_id, chatroom);
+}
+
+GList *
+empathy_log_store_get_chats (EmpathyLogStore *self,
+ TpAccount *account)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats)
+ return NULL;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_chats (self, account);
+}
+
+GList *
+empathy_log_store_search_new (EmpathyLogStore *self,
+ const gchar *text)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new)
+ return NULL;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->search_new (self, text);
+}
+
+void
+empathy_log_store_ack_message (EmpathyLogStore *self,
+ const gchar *chat_id,
+ gboolean chatroom,
+ EmpathyMessage *message)
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message)
+ return;
+
+ EMPATHY_LOG_STORE_GET_INTERFACE (self)->ack_message (
+ self, chat_id, chatroom, message);
+}
+
+GList *
+empathy_log_store_get_filtered_messages (EmpathyLogStore *self,
+ TpAccount *account,
+ const gchar *chat_id,
+ gboolean chatroom,
+ guint num_messages,
+ EmpathyLogMessageFilter filter,
+ gpointer user_data)
+
+{
+ if (!EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_filtered_messages)
+ return NULL;
+
+ return EMPATHY_LOG_STORE_GET_INTERFACE (self)->get_filtered_messages (
+ self, account, chat_id, chatroom, num_messages, filter, user_data);
+}
diff --git a/src/logstore/empathy-log-store.h b/src/logstore/empathy-log-store.h
new file mode 100644
index 0000000..94bc873
--- /dev/null
+++ b/src/logstore/empathy-log-store.h
@@ -0,0 +1,101 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 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: Jonny Lamb <jonny.lamb@collabora.co.uk>
+ */
+
+#ifndef __EMPATHY_LOG_STORE_H__
+#define __EMPATHY_LOG_STORE_H__
+
+#include <glib-object.h>
+
+#include <telepathy-glib/account.h>
+
+#include "empathy-message.h"
+#include "empathy-log-manager.h"
+
+G_BEGIN_DECLS
+
+#define EMPATHY_TYPE_LOG_STORE (empathy_log_store_get_type ())
+#define EMPATHY_LOG_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMPATHY_TYPE_LOG_STORE, \
+ EmpathyLogStore))
+#define EMPATHY_IS_LOG_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMPATHY_TYPE_LOG_STORE))
+#define EMPATHY_LOG_STORE_GET_INTERFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EMPATHY_TYPE_LOG_STORE, \
+ EmpathyLogStoreInterface))
+
+typedef struct _EmpathyLogStore EmpathyLogStore; /* dummy object */
+typedef struct _EmpathyLogStoreInterface EmpathyLogStoreInterface;
+
+struct _EmpathyLogStoreInterface
+{
+ GTypeInterface parent;
+
+ const gchar * (*get_name) (EmpathyLogStore *self);
+ gboolean (*exists) (EmpathyLogStore *self, TpAccount *account,
+ const gchar *chat_id, gboolean chatroom);
+ gboolean (*add_message) (EmpathyLogStore *self, const gchar *chat_id,
+ gboolean chatroom, EmpathyMessage *message, GError **error);
+ GList * (*get_dates) (EmpathyLogStore *self, TpAccount *account,
+ const gchar *chat_id, gboolean chatroom);
+ GList * (*get_messages_for_date) (EmpathyLogStore *self,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom,
+ const gchar *date);
+ GList * (*get_last_messages) (EmpathyLogStore *self, TpAccount *account,
+ const gchar *chat_id, gboolean chatroom);
+ GList * (*get_chats) (EmpathyLogStore *self,
+ TpAccount *account);
+ GList * (*search_new) (EmpathyLogStore *self, const gchar *text);
+ void (*ack_message) (EmpathyLogStore *self, const gchar *chat_id,
+ gboolean chatroom, EmpathyMessage *message);
+ GList * (*get_filtered_messages) (EmpathyLogStore *self, TpAccount *account,
+ const gchar *chat_id, gboolean chatroom, guint num_messages,
+ EmpathyLogMessageFilter filter, gpointer user_data);
+};
+
+GType empathy_log_store_get_type (void) G_GNUC_CONST;
+
+const gchar *empathy_log_store_get_name (EmpathyLogStore *self);
+gboolean empathy_log_store_exists (EmpathyLogStore *self,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom);
+gboolean empathy_log_store_add_message (EmpathyLogStore *self,
+ const gchar *chat_id, gboolean chatroom, EmpathyMessage *message,
+ GError **error);
+GList *empathy_log_store_get_dates (EmpathyLogStore *self,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom);
+GList *empathy_log_store_get_messages_for_date (EmpathyLogStore *self,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom,
+ const gchar *date);
+GList *empathy_log_store_get_last_messages (EmpathyLogStore *self,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom);
+GList *empathy_log_store_get_chats (EmpathyLogStore *self,
+ TpAccount *account);
+GList *empathy_log_store_search_new (EmpathyLogStore *self,
+ const gchar *text);
+void empathy_log_store_ack_message (EmpathyLogStore *self,
+ const gchar *chat_id, gboolean chatroom, EmpathyMessage *message);
+GList *empathy_log_store_get_filtered_messages (EmpathyLogStore *self,
+ TpAccount *account, const gchar *chat_id, gboolean chatroom,
+ guint num_messages, EmpathyLogMessageFilter filter, gpointer user_data);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_LOG_STORE_H__ */
diff --git a/src/logstore/tags b/src/logstore/tags
new file mode 100644
index 0000000..8a7d349
--- /dev/null
+++ b/src/logstore/tags
@@ -0,0 +1,329 @@
+!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
+!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
+!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
+!_TAG_PROGRAM_NAME Exuberant Ctags //
+!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
+!_TAG_PROGRAM_VERSION 5.8 //
+CCOPTS ../Makefile /^CCOPTS="--std=c99 -g -I. -Wall -Werror `pkg-config --libs`" # -pedantic"$/;" m
+CHANNEL_INTERFACE ../observer.py /^ CONNECTION_INTERFACE_ALIASING$/;" i
+CHANNEL_INTERFACE_CHANNEL_TYPE ../observer.py /^CHANNEL_INTERFACE_CHANNEL_TYPE = CHANNEL_INTERFACE + '.ChannelType'$/;" v
+CHANNEL_INTERFACE_MESSAGES ../observer.py /^ CONNECTION_INTERFACE_ALIASING$/;" i
+CHANNEL_INTERFACE_TARGET_HANDLE ../observer.py /^CHANNEL_INTERFACE_TARGET_HANDLE = CHANNEL_INTERFACE + '.TargetHandle'$/;" v
+CHANNEL_TYPE_TEXT ../observer.py /^from telepathy.server.channel import CHANNEL_TYPE_TEXT$/;" i
+CLIENT ../observer.py /^ CONNECTION_INTERFACE_ALIASING$/;" i
+CLIENT_OBSERVER ../observer.py /^ CONNECTION_INTERFACE_ALIASING$/;" i
+CONNECTION ../observer.py /^ CONNECTION_INTERFACE_ALIASING$/;" i
+CONNECTION_INTERFACE_ALIASING ../observer.py /^ CONNECTION_INTERFACE_ALIASING$/;" i
+CONNECTION_INTERFACE_CONTACTS ../observer.py /^ CONNECTION_INTERFACE_ALIASING$/;" i
+ClientObserver ../observer.py /^from telepathy._generated.Client_Observer import ClientObserver$/;" i
+CouchDatabase ../observer.py /^from desktopcouch.records.server import CouchDatabase$/;" i
+CouchdbLogger ../observer.py /^class CouchdbLogger(ClientObserver, DBusProperties):$/;" c
+DBusGMainLoop ../observer.py /^from dbus.mainloop.glib import DBusGMainLoop$/;" i
+DBusProperties ../observer.py /^from telepathy.server import DBusProperties$/;" i
+DEBUG_FLAG empathy-log-manager.c 40;" d file:
+DEBUG_FLAG empathy-log-store-empathy.c 43;" d file:
+EMPATHY_IS_LOG_MANAGER empathy-log-manager.h 41;" d
+EMPATHY_IS_LOG_MANAGER_CLASS empathy-log-manager.h 43;" d
+EMPATHY_IS_LOG_STORE empathy-log-store.h 39;" d
+EMPATHY_IS_LOG_STORE_EMPATHY empathy-log-store-empathy.h 40;" d
+EMPATHY_IS_LOG_STORE_EMPATHY_CLASS empathy-log-store-empathy.h 42;" d
+EMPATHY_LOG_MANAGER empathy-log-manager.h 35;" d
+EMPATHY_LOG_MANAGER_CLASS empathy-log-manager.h 38;" d
+EMPATHY_LOG_MANAGER_GET_CLASS empathy-log-manager.h 45;" d
+EMPATHY_LOG_STORE empathy-log-store.h 36;" d
+EMPATHY_LOG_STORE_EMPATHY empathy-log-store-empathy.h 34;" d
+EMPATHY_LOG_STORE_EMPATHY_CLASS empathy-log-store-empathy.h 37;" d
+EMPATHY_LOG_STORE_EMPATHY_GET_CLASS empathy-log-store-empathy.h 44;" d
+EMPATHY_LOG_STORE_GET_INTERFACE empathy-log-store.h 41;" d
+EMPATHY_TYPE_LOG_MANAGER empathy-log-manager.h 34;" d
+EMPATHY_TYPE_LOG_STORE empathy-log-store.h 35;" d
+EMPATHY_TYPE_LOG_STORE_EMPATHY empathy-log-store-empathy.h 32;" d
+EmpathyLogManager empathy-log-manager.h /^typedef struct _EmpathyLogManager EmpathyLogManager;$/;" t typeref:struct:_EmpathyLogManager
+EmpathyLogManagerClass empathy-log-manager.h /^typedef struct _EmpathyLogManagerClass EmpathyLogManagerClass;$/;" t typeref:struct:_EmpathyLogManagerClass
+EmpathyLogManagerPriv empathy-log-manager.c /^} EmpathyLogManagerPriv;$/;" t typeref:struct:__anon1 file:
+EmpathyLogMessageFilter empathy-log-manager.h /^typedef gboolean (*EmpathyLogMessageFilter) (EmpathyMessage *message,$/;" t
+EmpathyLogSearchHit empathy-log-manager.h /^typedef struct _EmpathyLogSearchHit EmpathyLogSearchHit;$/;" t typeref:struct:_EmpathyLogSearchHit
+EmpathyLogStore empathy-log-store.h /^typedef struct _EmpathyLogStore EmpathyLogStore; \/* dummy object *\/$/;" t typeref:struct:_EmpathyLogStore
+EmpathyLogStoreEmpathy empathy-log-store-empathy.h /^typedef struct _EmpathyLogStoreEmpathy EmpathyLogStoreEmpathy;$/;" t typeref:struct:_EmpathyLogStoreEmpathy
+EmpathyLogStoreEmpathyClass empathy-log-store-empathy.h /^typedef struct _EmpathyLogStoreEmpathyClass EmpathyLogStoreEmpathyClass;$/;" t typeref:struct:_EmpathyLogStoreEmpathyClass
+EmpathyLogStoreInterface empathy-log-store.h /^typedef struct _EmpathyLogStoreInterface EmpathyLogStoreInterface;$/;" t typeref:struct:_EmpathyLogStoreInterface
+GET_PRIV empathy-log-manager.c 43;" d file:
+GET_PRIV empathy-log-store-empathy.c 61;" d file:
+IMPLEMENT ../tpl_observer.c 253;" d file:
+IMPLEMENT ../tpl_observer.c 256;" d file:
+IS_TPL_OBSERVER ../tpl_observer.h 14;" d
+IS_TPL_OBSERVER_CLASS ../tpl_observer.h 15;" d
+InstantMessage ../observer.py /^class InstantMessage():$/;" c
+InstantMessageStorage ../observer.py /^class InstantMessageStorage():$/;" c
+LOG_DIR_CHATROOMS empathy-log-store-empathy.c 48;" d file:
+LOG_DIR_CREATE_MODE empathy-log-store-empathy.c 46;" d file:
+LOG_FILENAME_SUFFIX empathy-log-store-empathy.c 49;" d file:
+LOG_FILE_CREATE_MODE empathy-log-store-empathy.c 47;" d file:
+LOG_FOOTER empathy-log-store-empathy.c 57;" d file:
+LOG_HEADER empathy-log-store-empathy.c 52;" d file:
+LOG_TIME_FORMAT empathy-log-store-empathy.c 51;" d file:
+LOG_TIME_FORMAT_FULL empathy-log-store-empathy.c 50;" d file:
+MODULES ../Makefile /^MODULES="tpl_observer.c tpl_headless_logger_init.c tpl_text_channel.c test.c"$/;" m
+ObserveChannels ../observer.py /^ observer_info):$/;" m class:CouchdbLogger
+PKGS ../Makefile /^PKGS="telepathy-glib"$/;" m
+PROP_0 ../tpl_observer.c /^ PROP_0,$/;" e enum:__anon9 file:
+PROP_CHANNEL_FILTER ../tpl_observer.c /^ PROP_CHANNEL_FILTER$/;" e enum:__anon9 file:
+PROP_INTERFACES ../tpl_observer.c /^ PROP_INTERFACES,$/;" e enum:__anon9 file:
+RECORD_TYPE ../observer.py /^RECORD_TYPE = 'http:\/\/www.rtg.in.ua\/empathy-im-couchdb'$/;" v
+Record ../observer.py /^from desktopcouch.records.record import Record $/;" i
+TPL_CHANNEL ../tpl_channel_data.h 16;" d
+TPL_CHANNEL_CLASS ../tpl_channel_data.h 17;" d
+TPL_CHANNEL_GET_CLASS ../tpl_channel_data.h 20;" d
+TPL_IS_CHANNEL ../tpl_channel_data.h 18;" d
+TPL_IS_CHANNEL_CLASS ../tpl_channel_data.h 19;" d
+TPL_IS_LOG_ENTRY ../tpl_log_entry_text.h 11;" d
+TPL_IS_LOG_ENTRY_CLASS ../tpl_log_entry_text.h 12;" d
+TPL_IS_TEXT_CHANNEL ../tpl_text_channel_data.h 19;" d
+TPL_IS_TEXT_CHANNEL_CLASS ../tpl_text_channel_data.h 20;" d
+TPL_LOG_ENTRY ../tpl_log_entry_text.h 9;" d
+TPL_LOG_ENTRY_CLASS ../tpl_log_entry_text.h 10;" d
+TPL_LOG_ENTRY_GET_CLASS ../tpl_log_entry_text.h 13;" d
+TPL_LOG_ENTRY_TEXT_CHANNEL_ERROR ../tpl_log_entry_text.h /^ TPL_LOG_ENTRY_TEXT_CHANNEL_ERROR,$/;" e enum:__anon5
+TPL_LOG_ENTRY_TEXT_CHANNEL_IN ../tpl_log_entry_text.h /^ TPL_LOG_ENTRY_TEXT_CHANNEL_IN,$/;" e enum:__anon6
+TPL_LOG_ENTRY_TEXT_CHANNEL_LOSTMESSAGE ../tpl_log_entry_text.h /^ TPL_LOG_ENTRY_TEXT_CHANNEL_LOSTMESSAGE$/;" e enum:__anon5
+TPL_LOG_ENTRY_TEXT_CHANNEL_MESSAGE ../tpl_log_entry_text.h /^ TPL_LOG_ENTRY_TEXT_CHANNEL_MESSAGE, \/\/ IN or OUT$/;" e enum:__anon5
+TPL_LOG_ENTRY_TEXT_CHANNEL_OUT ../tpl_log_entry_text.h /^ TPL_LOG_ENTRY_TEXT_CHANNEL_OUT$/;" e enum:__anon6
+TPL_OBSERVER ../tpl_observer.h 12;" d
+TPL_OBSERVER_CLASS ../tpl_observer.h 13;" d
+TPL_OBSERVER_GET_CLASS ../tpl_observer.h 16;" d
+TPL_OBSERVER_OBJECT_PATH ../tpl_observer.h 21;" d
+TPL_OBSERVER_WELL_KNOWN_BUS_NAME ../tpl_observer.h 19;" d
+TPL_SET_NULL ../tpl_channel_data.c 14;" d file:
+TPL_SET_NULL ../tpl_channel_data.c 24;" d file:
+TPL_SET_NULL ../tpl_log_entry_text.c 12;" d file:
+TPL_SET_NULL ../tpl_log_entry_text.c 13;" d file:
+TPL_SET_NULL ../tpl_text_channel_data.c 154;" d file:
+TPL_SET_NULL ../tpl_text_channel_data.c 158;" d file:
+TPL_TEXT_CHANNEL ../tpl_text_channel_data.h 17;" d
+TPL_TEXT_CHANNEL_CLASS ../tpl_text_channel_data.h 18;" d
+TPL_TEXT_CHANNEL_GET_CLASS ../tpl_text_channel_data.h 21;" d
+TPL_TYPE_CHANNEL ../tpl_channel_data.h 15;" d
+TPL_TYPE_LOG_ENTRY ../tpl_log_entry_text.h 8;" d
+TPL_TYPE_TEXT_CHANNEL ../tpl_text_channel_data.h 16;" d
+TP_CONTACT_CONTACTS_LEN ../tpl_text_channel_data.c 9;" d file:
+TP_CONTACT_FEATURES_LEN ../tpl_text_channel_data.c 8;" d file:
+TP_CONTACT_MYSELF ../tpl_text_channel_data.c 10;" d file:
+TP_CONTACT_REMOTE ../tpl_text_channel_data.c 11;" d file:
+TP_IFACE_CHAN_TEXT ../tpl_observer.h 7;" d
+TYPE_TPL_OBSERVER ../tpl_observer.h 11;" d
+TplChannel ../tpl_channel_data.h /^} TplChannel;$/;" t typeref:struct:__anon3
+TplChannelClass ../tpl_channel_data.h /^} TplChannelClass;$/;" t typeref:struct:__anon4
+TplLogEntryClass ../tpl_log_entry_text.h /^} TplLogEntryClass;$/;" t typeref:struct:__anon8
+TplLogEntryText ../tpl_log_entry_text.h /^} TplLogEntryText;$/;" t typeref:struct:__anon7
+TplLogEntryTextDirection ../tpl_log_entry_text.h /^} TplLogEntryTextDirection;$/;" t typeref:enum:__anon6
+TplLogEntryTextType ../tpl_log_entry_text.h /^} TplLogEntryTextType;$/;" t typeref:enum:__anon5
+TplLogStoreEmpathyPriv empathy-log-store-empathy.c /^} TplLogStoreEmpathyPriv;$/;" t typeref:struct:__anon2 file:
+TplObserver ../tpl_observer.h /^typedef struct _TplObserver TplObserver;$/;" t typeref:struct:_TplObserver
+TplObserverClass ../tpl_observer.h /^typedef struct _TplObserverClass TplObserverClass;$/;" t typeref:struct:_TplObserverClass
+TplTextChannel ../tpl_text_channel_data.h /^} TplTextChannel;$/;" t typeref:struct:__anon10
+TplTextChannelClass ../tpl_text_channel_data.h /^} TplTextChannelClass;$/;" t typeref:struct:__anon11
+_EmpathyLogManager empathy-log-manager.h /^struct _EmpathyLogManager$/;" s
+_EmpathyLogManagerClass empathy-log-manager.h /^struct _EmpathyLogManagerClass$/;" s
+_EmpathyLogSearchHit empathy-log-manager.h /^struct _EmpathyLogSearchHit$/;" s
+_EmpathyLogStoreEmpathy empathy-log-store-empathy.h /^struct _EmpathyLogStoreEmpathy$/;" s
+_EmpathyLogStoreEmpathyClass empathy-log-store-empathy.h /^struct _EmpathyLogStoreEmpathyClass$/;" s
+_EmpathyLogStoreInterface empathy-log-store.h /^struct _EmpathyLogStoreInterface$/;" s
+_TplObserver ../tpl_observer.h /^struct _TplObserver$/;" s
+_TplObserverClass ../tpl_observer.h /^struct _TplObserverClass$/;" s
+__EMPATHY_LOG_MANAGER_H__ empathy-log-manager.h 25;" d
+__EMPATHY_LOG_STORE_EMPATHY_H__ empathy-log-store-empathy.h 26;" d
+__EMPATHY_LOG_STORE_H__ empathy-log-store.h 24;" d
+__TPL_DATA_H__ ../tpl_channel_data.h 2;" d
+__TPL_LOG_ENTRY_H__ ../tpl_log_entry_text.h 2;" d
+__TPL_OBSERVER_H__ ../tpl_observer.h 2;" d
+__TPL_TEXT_CHANNEL_H__ ../tpl_text_channel_data.h 2;" d
+__TPL_UTILS_H__ ../tpl_utils.h 2;" d
+__init__ ../observer.py /^ def __init__(self):$/;" m class:InstantMessage
+__init__ ../observer.py /^ def __init__(self):$/;" m class:InstantMessageStorage
+__init__ ../observer.py /^ def __init__(self, *args):$/;" m class:CouchdbLogger
+_channel_on_received_signal_cb ../tpl_text_channel_data.c /^void _channel_on_received_signal_cb (TpChannel *proxy,$/;" f
+_channel_on_sent_signal_cb ../tpl_text_channel_data.c /^void _channel_on_sent_signal_cb (TpChannel *proxy,$/;" f
+_observe_channel_when_ready_cb ../tpl_observer.c /^void _observe_channel_when_ready_cb(TpChannel *channel,$/;" f
+_ref_object_if_not_null ../tpl_utils.c /^void _ref_object_if_not_null(void* data) {$/;" f
+_tp_connection_called_when_ready_cb ../tpl_observer.c /^void _tp_connection_called_when_ready_cb(TpConnection *connection,$/;" f
+_tpl_text_channel_connect_signals ../tpl_text_channel_data.c /^void _tpl_text_channel_connect_signals(TplTextChannel* self) {$/;" f
+_tpl_text_channel_set_ready_cb ../tpl_text_channel_data.c /^void _tpl_text_channel_set_ready_cb(TpConnection *connection,$/;" f
+_unref_object_if_not_null ../tpl_utils.c /^void _unref_object_if_not_null(void* data) {$/;" f
+account ../tpl_channel_data.h /^ TpAccount *account;$/;" m struct:__anon3
+account empathy-log-manager.h /^ TpAccount *account;$/;" m struct:_EmpathyLogSearchHit
+account_manager empathy-log-store-empathy.c /^ TpAccountManager *account_manager;$/;" m struct:__anon2 file:
+account_path ../tpl_channel_data.h /^ const gchar *account_path;$/;" m struct:__anon3
+ack_message empathy-log-store.h /^ void (*ack_message) (EmpathyLogStore *self, const gchar *chat_id,$/;" m struct:_EmpathyLogStoreInterface
+add_message empathy-log-store.h /^ gboolean (*add_message) (EmpathyLogStore *self, const gchar *chat_id,$/;" m struct:_EmpathyLogStoreInterface
+basedir empathy-log-store-empathy.c /^ gchar *basedir;$/;" m struct:__anon2 file:
+channel ../tpl_channel_data.h /^ TpChannel *channel;$/;" m struct:__anon3
+channel_path ../tpl_channel_data.h /^ const gchar *channel_path;$/;" m struct:__anon3
+channel_properties ../tpl_channel_data.h /^ GHashTable *channel_properties;$/;" m struct:__anon3
+channel_type ../tpl_channel_data.h /^ const gchar *channel_type;$/;" m struct:__anon3
+chat_id empathy-log-manager.h /^ gchar *chat_id;$/;" m struct:_EmpathyLogSearchHit
+client_interfaces ../tpl_observer.c /^static const char *client_interfaces[] = {$/;" v file:
+connection ../tpl_channel_data.h /^ TpConnection *connection;$/;" m struct:__anon3
+connection_path ../tpl_channel_data.h /^ const gchar *connection_path;$/;" m struct:__anon3
+date empathy-log-manager.h /^ gchar *date;$/;" m struct:_EmpathyLogSearchHit
+datetime ../observer.py /^from datetime import datetime$/;" i
+dbus ../observer.py /^import dbus$/;" i
+dbus_props_class ../tpl_observer.h /^ TpDBusPropertiesMixinClass dbus_props_class;$/;" m struct:_TplObserverClass
+direction ../tpl_log_entry_text.h /^ TplLogEntryTextDirection direction;$/;" m struct:__anon7
+empathy_log_manager_add_message empathy-log-manager.c /^empathy_log_manager_add_message (EmpathyLogManager *manager,$/;" f
+empathy_log_manager_class_init empathy-log-manager.c /^empathy_log_manager_class_init (EmpathyLogManagerClass *klass)$/;" f file:
+empathy_log_manager_dup_singleton empathy-log-manager.c /^empathy_log_manager_dup_singleton (void)$/;" f
+empathy_log_manager_exists empathy-log-manager.c /^empathy_log_manager_exists (EmpathyLogManager *manager,$/;" f
+empathy_log_manager_get_chats empathy-log-manager.c /^empathy_log_manager_get_chats (EmpathyLogManager *manager,$/;" f
+empathy_log_manager_get_date_readable empathy-log-manager.c /^empathy_log_manager_get_date_readable (const gchar *date)$/;" f
+empathy_log_manager_get_dates empathy-log-manager.c /^empathy_log_manager_get_dates (EmpathyLogManager *manager,$/;" f
+empathy_log_manager_get_filtered_messages empathy-log-manager.c /^empathy_log_manager_get_filtered_messages (EmpathyLogManager *manager,$/;" f
+empathy_log_manager_get_messages_for_date empathy-log-manager.c /^empathy_log_manager_get_messages_for_date (EmpathyLogManager *manager,$/;" f
+empathy_log_manager_init empathy-log-manager.c /^empathy_log_manager_init (EmpathyLogManager *manager)$/;" f file:
+empathy_log_manager_observe empathy-log-manager.c /^empathy_log_manager_observe (EmpathyLogManager *log_manager,$/;" f
+empathy_log_manager_search_free empathy-log-manager.c /^empathy_log_manager_search_free (GList *hits)$/;" f
+empathy_log_manager_search_hit_free empathy-log-manager.c /^empathy_log_manager_search_hit_free (EmpathyLogSearchHit *hit)$/;" f
+empathy_log_manager_search_new empathy-log-manager.c /^empathy_log_manager_search_new (EmpathyLogManager *manager,$/;" f
+empathy_log_store_ack_message empathy-log-store.c /^empathy_log_store_ack_message (EmpathyLogStore *self,$/;" f
+empathy_log_store_add_message empathy-log-store.c /^empathy_log_store_add_message (EmpathyLogStore *self,$/;" f
+empathy_log_store_exists empathy-log-store.c /^empathy_log_store_exists (EmpathyLogStore *self,$/;" f
+empathy_log_store_get_chats empathy-log-store.c /^empathy_log_store_get_chats (EmpathyLogStore *self,$/;" f
+empathy_log_store_get_dates empathy-log-store.c /^empathy_log_store_get_dates (EmpathyLogStore *self,$/;" f
+empathy_log_store_get_filtered_messages empathy-log-store.c /^empathy_log_store_get_filtered_messages (EmpathyLogStore *self,$/;" f
+empathy_log_store_get_last_messages empathy-log-store.c /^empathy_log_store_get_last_messages (EmpathyLogStore *self,$/;" f
+empathy_log_store_get_messages_for_date empathy-log-store.c /^empathy_log_store_get_messages_for_date (EmpathyLogStore *self,$/;" f
+empathy_log_store_get_name empathy-log-store.c /^empathy_log_store_get_name (EmpathyLogStore *self)$/;" f
+empathy_log_store_get_type empathy-log-store.c /^empathy_log_store_get_type (void)$/;" f
+empathy_log_store_search_new empathy-log-store.c /^empathy_log_store_search_new (EmpathyLogStore *self,$/;" f
+exists empathy-log-store.h /^ gboolean (*exists) (EmpathyLogStore *self, TpAccount *account,$/;" m struct:_EmpathyLogStoreInterface
+features ../tpl_text_channel_data.c /^static TpContactFeature features[TP_CONTACT_FEATURES_LEN] = {$/;" v file:
+filename empathy-log-manager.h /^ gchar *filename;$/;" m struct:_EmpathyLogSearchHit
+from_id ../tpl_log_entry_text.h /^ const gchar *from_id, *receiver_id;$/;" m struct:__anon7
+get_chats empathy-log-store.h /^ GList * (*get_chats) (EmpathyLogStore *self,$/;" m struct:_EmpathyLogStoreInterface
+get_dates empathy-log-store.h /^ GList * (*get_dates) (EmpathyLogStore *self, TpAccount *account,$/;" m struct:_EmpathyLogStoreInterface
+get_filtered_messages empathy-log-store.h /^ GList * (*get_filtered_messages) (EmpathyLogStore *self, TpAccount *account,$/;" m struct:_EmpathyLogStoreInterface
+get_last_messages empathy-log-store.h /^ GList * (*get_last_messages) (EmpathyLogStore *self, TpAccount *account,$/;" m struct:_EmpathyLogStoreInterface
+get_messages_for_date empathy-log-store.h /^ GList * (*get_messages_for_date) (EmpathyLogStore *self,$/;" m struct:_EmpathyLogStoreInterface
+get_name empathy-log-store.h /^ const gchar * (*get_name) (EmpathyLogStore *self);$/;" m struct:_EmpathyLogStoreInterface
+gobject ../observer.py /^import gobject$/;" i
+is_chatroom empathy-log-manager.h /^ gboolean is_chatroom;$/;" m struct:_EmpathyLogSearchHit
+log_manager_chat_received_message_cb empathy-log-manager.c /^log_manager_chat_received_message_cb (EmpathyTpChat *tp_chat,$/;" f file:
+log_manager_constructor empathy-log-manager.c /^log_manager_constructor (GType type,$/;" f file:
+log_manager_dispatcher_observe_cb empathy-log-manager.c /^log_manager_dispatcher_observe_cb (EmpathyDispatcher *dispatcher,$/;" f file:
+log_manager_finalize empathy-log-manager.c /^log_manager_finalize (GObject *object)$/;" f file:
+log_manager_message_date_cmp empathy-log-manager.c /^log_manager_message_date_cmp (gconstpointer a,$/;" f file:
+log_store_account_to_dirname empathy-log-store-empathy.c /^log_store_account_to_dirname (TpAccount *account)$/;" f file:
+log_store_empathy_add_message empathy-log-store-empathy.c /^log_store_empathy_add_message (TplLogStore *self,$/;" f file:
+log_store_empathy_exists empathy-log-store-empathy.c /^log_store_empathy_exists (TplLogStore *self,$/;" f file:
+log_store_empathy_finalize empathy-log-store-empathy.c /^log_store_empathy_finalize (GObject *object)$/;" f file:
+log_store_empathy_get_all_files empathy-log-store-empathy.c /^log_store_empathy_get_all_files (TplLogStore *self,$/;" f file:
+log_store_empathy_get_chats empathy-log-store-empathy.c /^log_store_empathy_get_chats (TplLogStore *self,$/;" f file:
+log_store_empathy_get_chats_for_dir empathy-log-store-empathy.c /^log_store_empathy_get_chats_for_dir (TplLogStore *self,$/;" f file:
+log_store_empathy_get_dates empathy-log-store-empathy.c /^log_store_empathy_get_dates (TplLogStore *self,$/;" f file:
+log_store_empathy_get_dir empathy-log-store-empathy.c /^log_store_empathy_get_dir (TplLogStore *self,$/;" f file:
+log_store_empathy_get_filename empathy-log-store-empathy.c /^log_store_empathy_get_filename (TplLogStore *self,$/;" f file:
+log_store_empathy_get_filename_for_date empathy-log-store-empathy.c /^log_store_empathy_get_filename_for_date (TplLogStore *self,$/;" f file:
+log_store_empathy_get_filtered_messages empathy-log-store-empathy.c /^log_store_empathy_get_filtered_messages (TplLogStore *self,$/;" f file:
+log_store_empathy_get_messages_for_date empathy-log-store-empathy.c /^log_store_empathy_get_messages_for_date (TplLogStore *self,$/;" f file:
+log_store_empathy_get_messages_for_file empathy-log-store-empathy.c /^log_store_empathy_get_messages_for_file (TplLogStore *self,$/;" f file:
+log_store_empathy_get_name empathy-log-store-empathy.c /^log_store_empathy_get_name (TplLogStore *self)$/;" f file:
+log_store_empathy_get_timestamp_filename empathy-log-store-empathy.c /^log_store_empathy_get_timestamp_filename (void)$/;" f file:
+log_store_empathy_get_timestamp_from_message empathy-log-store-empathy.c /^log_store_empathy_get_timestamp_from_message (TplLogEntry *message)$/;" f file:
+log_store_empathy_search_hit_new empathy-log-store-empathy.c /^log_store_empathy_search_hit_new (TplLogStore *self,$/;" f file:
+log_store_empathy_search_new empathy-log-store-empathy.c /^log_store_empathy_search_new (TplLogStore *self,$/;" f file:
+log_store_iface_init empathy-log-store-empathy.c /^log_store_iface_init (gpointer g_iface,$/;" f file:
+loop ../test.c /^static GMainLoop *loop = NULL;$/;" v file:
+main ../observer.py /^def main():$/;" f
+main ../test.c /^int main(int argc, char *argv[])$/;" f
+manager_singleton empathy-log-manager.c /^static EmpathyLogManager * manager_singleton = NULL;$/;" v file:
+message ../tpl_log_entry_text.h /^ const gchar *message;$/;" m struct:__anon7
+message_received_handler ../observer.py /^ def message_received_handler(self, message=None, path=None):$/;" m class:CouchdbLogger
+message_sent_handler ../observer.py /^ message_token='', path=None):$/;" m class:CouchdbLogger
+my_contact ../tpl_text_channel_data.h /^ TpContact *remote_contact, *my_contact;$/;" m struct:__anon10
+name empathy-log-store-empathy.c /^ gchar *name;$/;" m struct:__anon2 file:
+observer ../tpl_channel_data.h /^ TpSvcClientObserver *observer;$/;" m struct:__anon3
+observer_iface_init ../tpl_observer.c /^observer_iface_init (gpointer g_iface, gpointer iface_data)$/;" f file:
+parent ../tpl_channel_data.h /^ GObject parent;$/;" m struct:__anon3
+parent ../tpl_log_entry_text.h /^ GObject parent;$/;" m struct:__anon7
+parent ../tpl_observer.h /^ GObject parent;$/;" m struct:_TplObserver
+parent ../tpl_text_channel_data.h /^ GObject parent;$/;" m struct:__anon10
+parent empathy-log-manager.h /^ GObject parent;$/;" m struct:_EmpathyLogManager
+parent empathy-log-store-empathy.h /^ GObject parent;$/;" m struct:_EmpathyLogStoreEmpathy
+parent empathy-log-store-empathy.h /^ GObjectClass parent;$/;" m struct:_EmpathyLogStoreEmpathyClass
+parent empathy-log-store.h /^ GTypeInterface parent;$/;" m struct:_EmpathyLogStoreInterface
+parent_class ../tpl_channel_data.h /^ GObjectClass parent_class;$/;" m struct:__anon4
+parent_class ../tpl_log_entry_text.h /^ GObjectClass parent_class;$/;" m struct:__anon8
+parent_class ../tpl_observer.h /^ GObjectClass parent_class;$/;" m struct:_TplObserverClass
+parent_class ../tpl_text_channel_data.h /^ GObjectClass parent_class;$/;" m struct:__anon11
+parent_class empathy-log-manager.h /^ GObjectClass parent_class;$/;" m struct:_EmpathyLogManagerClass
+priv empathy-log-manager.h /^ gpointer priv;$/;" m struct:_EmpathyLogManager
+priv empathy-log-store-empathy.h /^ gpointer priv;$/;" m struct:_EmpathyLogStoreEmpathy
+publish ../observer.py /^def publish():$/;" f
+put ../observer.py /^ def put(self, message):$/;" m class:InstantMessageStorage
+receiver_alias ../tpl_log_entry_text.h /^ const gchar *sender_alias, *receiver_alias;$/;" m struct:__anon7
+receiver_id ../tpl_log_entry_text.h /^ const gchar *from_id, *receiver_id;$/;" m struct:__anon7
+register_channel ../observer.py /^ def register_channel(self, account, connection, channel, props):$/;" m class:CouchdbLogger
+remote_contact ../tpl_text_channel_data.h /^ TpContact *remote_contact, *my_contact;$/;" m struct:__anon10
+search_new empathy-log-store.h /^ GList * (*search_new) (EmpathyLogStore *self, const gchar *text);$/;" m struct:_EmpathyLogStoreInterface
+sender_alias ../tpl_log_entry_text.h /^ const gchar *sender_alias, *receiver_alias;$/;" m struct:__anon7
+server ../observer.py /^import telepathy.server$/;" i
+stores empathy-log-manager.c /^ GList *stores;$/;" m struct:__anon1 file:
+telepathy ../observer.py /^import telepathy$/;" i
+telepathy ../observer.py /^import telepathy.server$/;" i
+tpl_channel ../tpl_log_entry_text.h /^ TplChannel *tpl_channel;$/;" m struct:__anon7
+tpl_channel ../tpl_text_channel_data.h /^ TplChannel *tpl_channel;$/;" m struct:__anon10
+tpl_channel_class_init ../tpl_channel_data.c /^static void tpl_channel_class_init(TplChannelClass* klass) {$/;" f file:
+tpl_channel_free ../tpl_channel_data.c /^void tpl_channel_free(TplChannel* tpl_text) {$/;" f
+tpl_channel_get_account ../tpl_channel_data.c /^TpAccount *tpl_channel_get_account(TplChannel *self) {$/;" f
+tpl_channel_get_account_path ../tpl_channel_data.c /^const gchar *tpl_channel_get_account_path(TplChannel *self) {$/;" f
+tpl_channel_get_channel ../tpl_channel_data.c /^TpChannel *tpl_channel_get_channel(TplChannel *self) {$/;" f
+tpl_channel_get_channel_path ../tpl_channel_data.c /^const gchar *tpl_channel_get_channel_path(TplChannel *self) {$/;" f
+tpl_channel_get_channel_properties ../tpl_channel_data.c /^GHashTable *tpl_channel_get_channel_properties(TplChannel *self) {$/;" f
+tpl_channel_get_channel_type ../tpl_channel_data.c /^const gchar *tpl_channel_get_channel_type(TplChannel *self) {$/;" f
+tpl_channel_get_connection ../tpl_channel_data.c /^TpConnection *tpl_channel_get_connection(TplChannel *self) {$/;" f
+tpl_channel_get_connection_path ../tpl_channel_data.c /^const gchar *tpl_channel_get_connection_path(TplChannel *self) {$/;" f
+tpl_channel_get_observer ../tpl_channel_data.c /^TpSvcClientObserver* tpl_channel_get_observer(TplChannel *self) {$/;" f
+tpl_channel_init ../tpl_channel_data.c /^static void tpl_channel_init(TplChannel* self) {$/;" f file:
+tpl_channel_new ../tpl_channel_data.c /^TplChannel* tpl_channel_new(TpSvcClientObserver* observer) {$/;" f
+tpl_channel_set_account ../tpl_channel_data.c /^void tpl_channel_set_account(TplChannel *self, TpAccount *data) {$/;" f
+tpl_channel_set_account_path ../tpl_channel_data.c /^void tpl_channel_set_account_path(TplChannel *self, const gchar *data) {$/;" f
+tpl_channel_set_channel ../tpl_channel_data.c /^void tpl_channel_set_channel(TplChannel *self, TpChannel *data) {$/;" f
+tpl_channel_set_channel_path ../tpl_channel_data.c /^void tpl_channel_set_channel_path(TplChannel *self, const gchar *data) {$/;" f
+tpl_channel_set_channel_properties ../tpl_channel_data.c /^void tpl_channel_set_channel_properties(TplChannel *self, GHashTable *data) {$/;" f
+tpl_channel_set_channel_type ../tpl_channel_data.c /^void tpl_channel_set_channel_type(TplChannel *self, const gchar *data) {$/;" f
+tpl_channel_set_connection ../tpl_channel_data.c /^void tpl_channel_set_connection(TplChannel *self, TpConnection *data) {$/;" f
+tpl_channel_set_connection_path ../tpl_channel_data.c /^void tpl_channel_set_connection_path(TplChannel *self, const gchar *data) {$/;" f
+tpl_channel_set_observer ../tpl_channel_data.c /^void tpl_channel_set_observer(TplChannel *self,$/;" f
+tpl_headless_logger_init ../tpl_headless_logger_init.c /^void tpl_headless_logger_init(void)$/;" f
+tpl_log_entry_class_init ../tpl_log_entry_text.c /^static void tpl_log_entry_class_init(TplLogEntryClass* klass) {$/;" f file:
+tpl_log_entry_init ../tpl_log_entry_text.c /^static void tpl_log_entry_init(TplLogEntry* self) {$/;" f file:
+tpl_log_entry_new ../tpl_log_entry_text.c /^TplLogEntry *tpl_log_entry_new(void) {$/;" f
+tpl_log_entry_text_get_direction ../tpl_log_entry_text.c /^TplLogEntryTextDirection tpl_log_entry_text_get_direction (TplLogEntry *self) {$/;" f
+tpl_log_entry_text_get_message ../tpl_log_entry_text.c /^const gchar *tpl_log_entry_text_get_message (TplLogEntry *self) {$/;" f
+tpl_log_entry_text_get_receiver ../tpl_log_entry_text.c /^TpContact *tpl_log_entry_text_get_receiver (TplLogEntry *self) {$/;" f
+tpl_log_entry_text_get_sender ../tpl_log_entry_text.c /^TpContact *tpl_log_entry_text_get_sender (TplLogEntry *self) {$/;" f
+tpl_log_entry_text_get_tpl_channel ../tpl_log_entry_text.c /^TplTextChannel *tpl_log_entry_text_get_tpl_channel(TplLogEntryText *self) {$/;" f
+tpl_log_entry_text_get_type ../tpl_log_entry_text.c /^TplLogEntryTextType tpl_log_entry_text_get_type (TplLogEntry *self) {$/;" f
+tpl_log_entry_text_set_direction ../tpl_log_entry_text.c /^void tpl_log_entry_text_set_direction (TplLogEntry *self, TplLogEntryTextDirection data) {$/;" f
+tpl_log_entry_text_set_message ../tpl_log_entry_text.c /^void tpl_log_entry_text_set_message (TplLogEntry *self, const gchar *data) {$/;" f
+tpl_log_entry_text_set_receiver ../tpl_log_entry_text.c /^void tpl_log_entry_text_set_receiver (TplLogEntry *self, TpContact *data) {$/;" f
+tpl_log_entry_text_set_sender ../tpl_log_entry_text.c /^void tpl_log_entry_text_set_sender (TplLogEntry *self, TpContact *data) {$/;" f
+tpl_log_entry_text_set_tpl_channel ../tpl_log_entry_text.c /^void tpl_log_entry_text_set_tpl_channel(TplLogEntryText *self, TplChannel *data) {$/;" f
+tpl_log_entry_text_set_type ../tpl_log_entry_text.c /^void tpl_log_entry_text_set_type (TplLogEntry *self, TplLogEntryTextType data) {$/;" f
+tpl_log_store_empathy_class_init empathy-log-store-empathy.c /^tpl_log_store_empathy_class_init (TplLogStoreEmpathyClass *klass)$/;" f file:
+tpl_log_store_empathy_init empathy-log-store-empathy.c /^tpl_log_store_empathy_init (TplLogStoreEmpathy *self)$/;" f file:
+tpl_observer_class_init ../tpl_observer.c /^tpl_observer_class_init (TplObserverClass *klass)$/;" f file:
+tpl_observer_get_property ../tpl_observer.c /^tpl_observer_get_property (GObject *self,$/;" f file:
+tpl_observer_init ../tpl_observer.c /^tpl_observer_init (TplObserver *self)$/;" f file:
+tpl_observer_new ../tpl_observer.c /^TplObserver *tpl_observer_new (void)$/;" f
+tpl_observer_observe_channels ../tpl_observer.c /^tpl_observer_observe_channels (TpSvcClientObserver *self,$/;" f file:
+tpl_text_channel_class_init ../tpl_text_channel_data.c /^static void tpl_text_channel_class_init(TplTextChannelClass* klass) {$/;" f file:
+tpl_text_channel_free ../tpl_text_channel_data.c /^void tpl_text_channel_free(TplTextChannel* tpl_text) {$/;" f
+tpl_text_channel_get_my_contact ../tpl_text_channel_data.c /^TpContact *tpl_text_channel_get_my_contact(TplTextChannel *self)$/;" f
+tpl_text_channel_get_remote_contact ../tpl_text_channel_data.c /^TpContact *tpl_text_channel_get_remote_contact(TplTextChannel *self)$/;" f
+tpl_text_channel_get_tpl_channel ../tpl_text_channel_data.c /^TplChannel *tpl_text_channel_get_tpl_channel(TplTextChannel *self) {$/;" f
+tpl_text_channel_init ../tpl_text_channel_data.c /^static void tpl_text_channel_init(TplTextChannel* self) {$/;" f file:
+tpl_text_channel_new ../tpl_text_channel_data.c /^TplTextChannel* tpl_text_channel_new(TplChannel* tpl_channel)$/;" f
+tpl_text_channel_set_my_contact ../tpl_text_channel_data.c /^void tpl_text_channel_set_my_contact(TplTextChannel *self, TpContact *data)$/;" f
+tpl_text_channel_set_remote_contact ../tpl_text_channel_data.c /^void tpl_text_channel_set_remote_contact(TplTextChannel *self, TpContact *data)$/;" f
+tpl_text_channel_set_tpl_channel ../tpl_text_channel_data.c /^void tpl_text_channel_set_tpl_channel(TplTextChannel *self, TplChannel *data) {$/;" f
+type ../tpl_log_entry_text.h /^ TplLogEntryTextType type; $/;" m struct:__anon7
diff --git a/src/test.c b/src/test.c
index e82b179..df8c167 100644
--- a/src/test.c
+++ b/src/test.c
@@ -8,7 +8,7 @@ int main(int argc, char *argv[])
{
g_type_init ();
- tpl_headless_logger_init();
+ tpl_headless_logger_init ();
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
diff --git a/src/tpl_contact.c b/src/tpl_contact.c
new file mode 100644
index 0000000..00477a3
--- /dev/null
+++ b/src/tpl_contact.c
@@ -0,0 +1,40 @@
+#include <tpl_contact.h>
+#include <tpl_utils.h>
+
+G_DEFINE_TYPE (TplContact, tpl_contact, G_TYPE_OBJECT)
+
+static void tpl_contact_class_init(TplContactClass* klass) {
+ //GObjectClass* gobject_class = G_OBJECT_CLASS (klass);
+}
+
+static void tpl_contact_init(TplContact* self) {
+}
+
+/* retrieved contat and set TplContact ready */
+
+TplContact *tpl_contact_new() {
+ return g_object_new(TPL_TYPE_CONTACT,NULL);
+}
+
+#define ADD_GET(x,y) y tpl_contact_get_##x(TplContact *self) { \
+ return self->x; }
+ ADD_GET(contact, TpContact *);
+ ADD_GET(alias, const gchar *);
+ ADD_GET(identifier, const gchar *);
+ ADD_GET(presence_status, const gchar *);
+ ADD_GET(presence_message, const gchar *);
+#undef ADD_GET
+
+#define ADD_SET(member,y) void tpl_contact_set_##member(TplContact *self, y data) { \
+ _unref_object_if_not_null(&(self->member)) ; \
+ self->member = data; \
+ _ref_object_if_not_null(data); }
+ ADD_SET(contact, TpContact *);
+#undef ADD_SET
+#define ADD_SET_SIMPLE(member,y) void tpl_contact_set_##member(TplContact *self, y data) { \
+ self->member = data;}
+ ADD_SET_SIMPLE(alias, const gchar *);
+ ADD_SET_SIMPLE(identifier, const gchar *);
+ ADD_SET_SIMPLE(presence_status, const gchar *);
+ ADD_SET_SIMPLE(presence_message, const gchar *);
+#undef ADD_SET_SIMPLE
diff --git a/src/tpl_contact.h b/src/tpl_contact.h
new file mode 100644
index 0000000..b291961
--- /dev/null
+++ b/src/tpl_contact.h
@@ -0,0 +1,57 @@
+#ifndef __TPL_CONTACT_H__
+#define __TPL_CONTACT_H__
+
+#include <glib-object.h>
+#include <telepathy-glib/contact.h>
+
+#include <tpl_channel_data.h>
+
+G_BEGIN_DECLS
+
+#define TPL_TYPE_CONTACT (tpl_contact_get_type ())
+#define TPL_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_CONTACT, TplContact))
+#define TPL_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_CONTACT, TplContactClass))
+#define TPL_IS_CONTACT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_CONTACT))
+#define TPL_IS_CONTACT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_CONTACT))
+#define TPL_CONTACT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_CONTACT, TplContactClass))
+
+typedef struct {
+ GObject parent;
+
+ /* Private */
+ TpContact *contact; // maybe NULL
+ const gchar *alias;
+ const gchar *identifier;
+ const gchar *presence_status;
+ const gchar *presence_message;
+} TplContact;
+
+
+typedef struct {
+ GObjectClass parent_class;
+} TplContactClass;
+
+
+GType tpl_contact_get_type (void);
+
+TplContact *tpl_contact_new();
+
+#define ADD_GET(x,y) y tpl_contact_get_##x(TplContact *self)
+ ADD_GET(contact, TpContact *);
+ ADD_GET(alias, const gchar *);
+ ADD_GET(identifier, const gchar *);
+ ADD_GET(presence_status, const gchar *);
+ ADD_GET(presence_message, const gchar *);
+#undef ADD_GET
+
+#define ADD_SET(x,y) void tpl_contact_set_##x(TplContact *self, y data)
+ ADD_SET(contact, TpContact *);
+ ADD_SET(alias, const gchar *);
+ ADD_SET(identifier, const gchar *);
+ ADD_SET(presence_status, const gchar *);
+ ADD_SET(presence_message, const gchar *);
+#undef ADD_SET
+
+G_END_DECLS
+
+#endif // __TPL_CONTACT_H__
diff --git a/src/tpl_log_entry.c b/src/tpl_log_entry.c
deleted file mode 100644
index ef366ad..0000000
--- a/src/tpl_log_entry.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <tpl_log_entry.h>
-#include <tpl_utils.h>
-
-G_DEFINE_TYPE (TplLogEntry, tpl_log_entry, G_TYPE_OBJECT)
-
-static void tpl_log_entry_class_init(TplLogEntryClass* klass) {
- //GObjectClass* gobject_class = G_OBJECT_CLASS (klass);
-}
-
-static void tpl_log_entry_init(TplLogEntry* self) {
- /* Init TplTextChannel's members to zero/NULL */
-#define TPL_SET_NULL(x) tpl_log_entry_set_##x(self, NULL)
-#undef TPL_SET_NULL
-}
-
-TplLogEntry *tpl_log_entry_new(void) {
- TplLogEntry *ret = g_object_new(TPL_TYPE_LOG_ENTRY, NULL);
- return ret;
-}
diff --git a/src/tpl_log_entry.h b/src/tpl_log_entry.h
deleted file mode 100644
index 8d2b760..0000000
--- a/src/tpl_log_entry.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef __TPL_LOG_ENTRY_H__
-#define __TPL_LOG_ENTRY_H__
-
-#include <glib-object.h>
-#include <telepathy-glib/log_entry.h>
-
-#include <tpl_channel_data.h>
-
-G_BEGIN_DECLS
-
-#define TPL_TYPE_LOG_ENTRY (tpl_log_entry_get_type ())
-#define TPL_LOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_LOG_ENTRY, TplLogEntry))
-#define TPL_LOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_LOG_ENTRY, TplLogEntryClass))
-#define TPL_IS_LOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_LOG_ENTRY))
-#define TPL_IS_LOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_LOG_ENTRY))
-#define TPL_LOG_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_LOG_ENTRY, TplLogEntryClass))
-
-typedef enum {
- TPL_LOG_ENTRY_TEXT_CHANNEL_MESSAGE,
- TPL_LOG_ENTRY_TEXT_CHANNEL_ERROR,
- TPL_LOG_ENTRY_LAST
-} TplLogEntryType;
-
-typedef struct {
- GObject parent;
-
- /* Private */
- TplLogEntryType entry_type;
- const gchar *from, *to;
- const gchar *message;
-} TplLogEntry;
-
-const gchar *tpl_log_entry_get_from(TplLogEntry *self);
-const gchar *tpl_log_entry_get_to(TplLogEntry *self);
-const gchar *tpl_log_entry_get_message(TplLogEntry *self);
-
-
-typedef struct {
- GObjectClass parent_class;
-} TplLogEntryClass;
-
-
-GType tpl_log_entry_get_type (void);
-
-TplLogEntry *tpl_log_entry_new(void);
-
-G_END_DECLS
-
-#endif // __TPL_LOG_ENTRY_H__
diff --git a/src/tpl_log_entry_text.c b/src/tpl_log_entry_text.c
new file mode 100644
index 0000000..ce885f6
--- /dev/null
+++ b/src/tpl_log_entry_text.c
@@ -0,0 +1,68 @@
+#include <tpl_log_entry.h>
+#include <tpl_utils.h>
+
+G_DEFINE_TYPE (TplLogEntry, tpl_log_entry, G_TYPE_OBJECT)
+
+static void tpl_log_entry_class_init(TplLogEntryClass* klass) {
+ //GObjectClass* gobject_class = G_OBJECT_CLASS (klass);
+}
+
+static void tpl_log_entry_init(TplLogEntry* self) {
+ /* Init TplTextChannel's members to zero/NULL */
+#define TPL_SET_NULL(x) tpl_log_entry_set_##x(self, NULL)
+#undef TPL_SET_NULL
+}
+
+TplLogEntry *tpl_log_entry_new(void) {
+ TplLogEntry *ret = g_object_new(TPL_TYPE_LOG_ENTRY, NULL);
+ return ret;
+}
+
+
+TplTextChannel *tpl_log_entry_text_get_tpl_channel(TplLogEntryText *self) {
+ return self->tpl_channel;
+}
+TpContact *tpl_log_entry_text_get_sender (TplLogEntry *self) {
+ return self->sender;
+}
+TpContact *tpl_log_entry_text_get_receiver (TplLogEntry *self) {
+ return self->receiver;
+}
+const gchar *tpl_log_entry_text_get_message (TplLogEntry *self) {
+ return self->message;
+}
+TpChannelTextMessageType tpl_log_entry_text_get_message_type (TplLogEntry *self) {
+ return self->message_type;;
+}
+TplLogEntryTextSignalType tpl_log_entry_text_get_signal_type (TplLogEntry *self) {
+ return self->signal_type;;
+}
+TplLogEntryTextDirection tpl_log_entry_text_get_direction (TplLogEntry *self) {
+ return self->direction;
+}
+
+
+void tpl_log_entry_text_set_tpl_channel(TplLogEntryText *self, TplChannel *data) {
+ _unref_object_if_not_null(self->tpl_channel);
+ self->tpl_channel = data;
+ _ref_object_if_not_null(data);
+}
+
+void tpl_log_entry_text_set_sender (TplLogEntry *self, TpContact *data) {
+ self->sender = data;
+}
+void tpl_log_entry_text_set_receiver (TplLogEntry *self, TpContact *data) {
+ self->receiver = data;
+}
+void tpl_log_entry_text_set_message (TplLogEntry *self, const gchar *data) {
+ self->message = data;
+}
+void tpl_log_entry_text_set_message_type (TplLogEntry *self, TpChannelTextMessageType data) {
+ self->message_type; = data;
+}
+void tpl_log_entry_text_set_signal_type (TplLogEntry *self, TplLogEntryTextSignalType data) {
+ self->signal_type; = data;
+}
+void tpl_log_entry_text_set_direction (TplLogEntry *self, TplLogEntryTextDirection data) {
+ self->direction = data;
+}
diff --git a/src/tpl_log_entry_text.h b/src/tpl_log_entry_text.h
new file mode 100644
index 0000000..de9e17f
--- /dev/null
+++ b/src/tpl_log_entry_text.h
@@ -0,0 +1,73 @@
+#ifndef __TPL_LOG_ENTRY_H__
+#define __TPL_LOG_ENTRY_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define TPL_TYPE_LOG_ENTRY (tpl_log_entry_text_get_signal_type ())
+#define TPL_LOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_LOG_ENTRY, TplLogEntry))
+#define TPL_LOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TPL_TYPE_LOG_ENTRY, TplLogEntryClass))
+#define TPL_IS_LOG_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TPL_TYPE_LOG_ENTRY))
+#define TPL_IS_LOG_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TPL_TYPE_LOG_ENTRY))
+#define TPL_LOG_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TPL_TYPE_LOG_ENTRY, TplLogEntryClass))
+
+
+/* Valid for org.freedesktop.Telepathy.Channel.Type.Text */
+
+typedef enum {
+ TPL_LOG_ENTRY_TEXT_CHANNEL_MESSAGE,
+ TPL_LOG_ENTRY_TEXT_CHANNEL_ERROR,
+ TPL_LOG_ENTRY_TEXT_CHANNEL_LOSTMESSAGE
+} TplLogEntryTextSignalType;
+
+/* wether the log entry is referring to something outgoing on incoming */
+typedef enum {
+ TPL_LOG_ENTRY_TEXT_CHANNEL_IN,
+ TPL_LOG_ENTRY_TEXT_CHANNEL_OUT
+} TplLogEntryTextDirection;
+
+typedef struct {
+ GObject parent;
+
+ /* Private */
+ // tpl_channel has informations about channel/account/connection
+ TplChannel *tpl_channel;
+ // what kind of signal caused this log entry
+ TplLogEntryTextSignalType signal_type;
+ TpChannelTextMessageType message_type;
+ // is the this entry cause by something incoming or outgoing
+ TplLogEntryTextDirection direction;
+
+ TplContact *sender;
+ TplContact *receiver;
+ const gchar *message;
+} TplLogEntryText;
+
+typedef struct {
+ GObjectClass parent_class;
+} TplLogEntryClass;
+
+GType tpl_log_entry_text_get_signal_type (void);
+
+TplLogEntryText *tpl_log_entry_text_new ();
+
+TplTextChannel *tpl_log_entry_text_get_tpl_channel(TplLogEntryText *self);
+TplContact *tpl_log_entry_text_get_sender (TplLogEntryText *self);
+TplContact *tpl_log_entry_text_get_receiver (TplLogEntryText *self);
+const gchar *tpl_log_entry_text_get_message (TplLogEntryText *self);
+TpChannelTextMessageType tpl_log_entry_text_get_message_type (TplLogEntry *self);
+TplLogEntryTextSignalType tpl_log_entry_text_get_signal_type (TplLogEntryTextSignalType *self);
+TplLogEntryTextDirection tpl_log_entry_text_get_direction (TplLogEntryTextDirection *self);
+
+void tpl_log_entry_text_set_tpl_channel(TplLogEntryText *self, TplChannel *data);
+void tpl_log_entry_text_set_sender (TplLogEntryText *self, TplContact *data);
+void tpl_log_entry_text_set_receiver (TplLogEntryText *self, TplContact *data);
+void tpl_log_entry_text_set_message (TplLogEntryText *self, const gchar *data);
+void tpl_log_entry_text_set_message_type (TplLogEntry *self, TpChannelTextMessageType data);
+void tpl_log_entry_text_set_signal_type (TplLogEntryText *self, TplLogEntryTextSignalType data);
+void tpl_log_entry_text_set_direction (TplLogEntryText *self, TplLogEntryTextDirection data);
+
+G_END_DECLS
+
+#endif // __TPL_LOG_ENTRY_H__
diff --git a/src/tpl_text_channel_data.c b/src/tpl_text_channel_data.c
index 4cd611f..e4f4cc6 100644
--- a/src/tpl_text_channel_data.c
+++ b/src/tpl_text_channel_data.c
@@ -3,6 +3,8 @@
#include <tpl_observer.h>
#include <tpl_channel_data.h>
#include <tpl_text_channel_data.h>
+//#include <tpl_log_entry_text.h>
+#include <tpl_contact.h>
#define TP_CONTACT_FEATURES_LEN 2
#define TP_CONTACT_CONTACTS_LEN 2
@@ -15,18 +17,42 @@ static TpContactFeature features[TP_CONTACT_FEATURES_LEN] = {
};
-/* Callbacks */
+/* definitions */
void _channel_on_sent_signal_cb (TpChannel *proxy,
guint arg_Timestamp,
guint arg_Type,
const gchar *arg_Text,
gpointer user_data,
- GObject *weak_object) {
+ GObject *weak_object);
+void _channel_on_sent_signal_cb (TpChannel *proxy,
+ guint arg_Timestamp,
+ guint arg_Type,
+ const gchar *arg_Text,
+ gpointer user_data,
+ GObject *weak_object);
+/* end of definitions */
+
+
+
+/* Callbacks */
+
+void _channel_on_sent_signal_cb (TpChannel *proxy,
+ guint arg_Timestamp,
+ guint arg_Type,
+ const gchar *arg_Text,
+ gpointer user_data,
+ GObject *weak_object)
+{
TplTextChannel *tpl_text = TPL_TEXT_CHANNEL(user_data);
TpContact *remote,*me;
const gchar *my_id, *my_alias, *remote_id, *remote_alias;
+ const gchar *my_pres_msg, *my_pres_status;
+ const gchar *remote_pres_msg, *remote_pres_status;
+ TplContact *tpl_contact_sender;
+ TplContact *tpl_contact_receiver;
+
me = tpl_text_channel_get_my_contact(tpl_text);
remote = tpl_text_channel_get_remote_contact(tpl_text);
@@ -36,8 +62,38 @@ void _channel_on_sent_signal_cb (TpChannel *proxy,
my_alias = tp_contact_get_alias(me);
remote_alias = tp_contact_get_alias(remote);
+
+ my_pres_status = tp_contact_get_presence_status(me);
+ remote_pres_status = tp_contact_get_presence_status(remote);
+
+ my_pres_msg = tp_contact_get_presence_message (me);
+ remote_pres_msg = tp_contact_get_presence_message (remote);
g_message("%s (%s): %s\n", my_id, my_alias, arg_Text);
+
+ tpl_contact_sender = tpl_contact_new();
+ tpl_contact_receiver = tpl_contact_new();
+#define CONTACT_ENTRY_SET(x,y) tpl_contact_set_##x(tpl_contact_sender,y)
+ CONTACT_ENTRY_SET(contact, me);
+ CONTACT_ENTRY_SET(alias, my_alias);
+ CONTACT_ENTRY_SET(identifier, my_id);
+ CONTACT_ENTRY_SET(presence_status, my_pres_status);
+ CONTACT_ENTRY_SET(presence_message, my_pres_msg );
+#undef CONTACT_ENTRY_SET
+#define CONTACT_ENTRY_SET(x,y) tpl_contact_set_##x(tpl_contact_receiver,y)
+ CONTACT_ENTRY_SET(contact, remote);
+ CONTACT_ENTRY_SET(alias, remote_alias);
+ CONTACT_ENTRY_SET(identifier, remote_id);
+ CONTACT_ENTRY_SET(presence_status, remote_pres_status );
+ CONTACT_ENTRY_SET(presence_message, remote_pres_msg);
+#undef CONTACT_ENTRY_SET
+
+ g_message("BIS: %s (%s): %s\n",
+ tpl_contact_get_identifier(tpl_contact_sender),
+ tpl_contact_get_alias(tpl_contact_sender),
+ arg_Text);
+
+
}
void _channel_on_received_signal_cb (TpChannel *proxy,
@@ -53,6 +109,10 @@ void _channel_on_received_signal_cb (TpChannel *proxy,
TplTextChannel *tpl_text = TPL_TEXT_CHANNEL(user_data);
TpContact *remote,*me;
const gchar *my_id, *my_alias, *remote_id, *remote_alias;
+ const gchar *my_pres_msg, *my_pres_status;
+ const gchar *remote_pres_msg, *remote_pres_status;
+ TplContact *tpl_contact_sender;
+ TplContact *tpl_contact_receiver;
me = tpl_text_channel_get_my_contact(tpl_text);
remote = tpl_text_channel_get_remote_contact(tpl_text);
@@ -63,7 +123,36 @@ void _channel_on_received_signal_cb (TpChannel *proxy,
my_alias = tp_contact_get_alias(me);
remote_alias = tp_contact_get_alias(remote);
- g_message("%s (%s): %s\n", remote_id, remote_alias, arg_Text);
+ my_pres_status = tp_contact_get_presence_status(me);
+ remote_pres_status = tp_contact_get_presence_status(remote);
+
+ my_pres_msg = tp_contact_get_presence_message (me);
+ remote_pres_msg = tp_contact_get_presence_message (remote);
+
+ g_message("FOO%s (%s): %s\n", remote_id, remote_alias, arg_Text);
+
+ tpl_contact_sender = tpl_contact_new();
+ tpl_contact_receiver = tpl_contact_new();
+#define CONTACT_ENTRY_SET(x,y) tpl_contact_set_##x(tpl_contact_sender,y)
+ CONTACT_ENTRY_SET(contact, remote);
+ CONTACT_ENTRY_SET(alias, remote_alias);
+ CONTACT_ENTRY_SET(identifier, remote_id);
+ CONTACT_ENTRY_SET(presence_status, remote_pres_status);
+ CONTACT_ENTRY_SET(presence_message, remote_pres_msg );
+#undef CONTACT_ENTRY_SET
+#define CONTACT_ENTRY_SET(x,y) tpl_contact_set_##x(tpl_contact_receiver,y)
+ CONTACT_ENTRY_SET(contact, me);
+ CONTACT_ENTRY_SET(alias, my_alias);
+ CONTACT_ENTRY_SET(identifier, my_id);
+ CONTACT_ENTRY_SET(presence_status, my_pres_status );
+ CONTACT_ENTRY_SET(presence_message, my_pres_msg);
+#undef CONTACT_ENTRY_SET
+
+ g_message("BIS: %s (%s): %s\n",
+ tpl_contact_get_identifier(tpl_contact_sender),
+ tpl_contact_get_alias(tpl_contact_sender),
+ arg_Text);
+
}
/* connect signals to TplTextChannel instance */
@@ -112,7 +201,7 @@ void _tpl_text_channel_set_ready_cb(TpConnection *connection,
TplTextChannel *tpl_text = (TplTextChannel*) user_data;
tpl_text_channel_set_my_contact(tpl_text, contacts[TP_CONTACT_MYSELF]);
- tpl_text_channel_set_remote_contact(tpl_text, contacts[TP_CONTACT_MYSELF]);
+ tpl_text_channel_set_remote_contact(tpl_text, contacts[TP_CONTACT_REMOTE]);
//g_debug("MY ALIAS: %s\n", tp_contact_get_alias(
// tpl_text_channel_get_my_contact(tpl_text)));
@@ -179,7 +268,8 @@ void tpl_text_channel_free(TplTextChannel* tpl_text) {
}
-TplChannel *tpl_text_channel_get_tpl_channel(TplTextChannel *self) {
+TplChannel *tpl_text_channel_get_tpl_channel(TplTextChannel *self)
+{
return self->tpl_channel;
}
diff --git a/src/tpl_text_channel_data.h b/src/tpl_text_channel_data.h
index 3716ea4..b41200d 100644
--- a/src/tpl_text_channel_data.h
+++ b/src/tpl_text_channel_data.h
@@ -1,6 +1,10 @@
#ifndef __TPL_TEXT_CHANNEL_H__
#define __TPL_TEXT_CHANNEL_H__
+/*
+ * http://telepathy.freedesktop.org/doc/telepathy-glib/telepathy-glib-channel-text.html#tp-cli-channel-type-text-connect-to-received
+ */
+
#include <glib-object.h>
#include <telepathy-glib/channel.h>
#include <telepathy-glib/account.h>