[next] telepathy-glib: add XML legacy log store

Simon McVittie smcv at kemper.freedesktop.org
Thu Mar 20 10:25:43 PDT 2014


Module: telepathy-glib
Branch: next
Commit: 71eb66b32cabf75f1d831d2e720b0e11dfe40d7e
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=71eb66b32cabf75f1d831d2e720b0e11dfe40d7e

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Mon Jan 13 14:43:47 2014 +0100

add XML legacy log store

Keeps reading from the old log location.

---

 telepathy-logger/log-manager.c                                |    3 +++
 telepathy-logger/log-store-xml-internal.h                     |    1 +
 telepathy-logger/log-store-xml.c                              |    9 +++++++++
 tests/logger/dbus/test-log-manager.c                          |    8 ++++----
 .../user2 at collabora.co.uk/20100112.log                        |    5 +++++
 5 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c
index 41cea08..dfc761d 100644
--- a/telepathy-logger/log-manager.c
+++ b/telepathy-logger/log-manager.c
@@ -274,6 +274,9 @@ tpl_log_manager_init (TplLogManager *self)
   /* The TPL's default read-write logstore */
   add_log_store (self, _tpl_log_store_xml_new ());
 
+  /* Old (pre 1.0) TPL logs, read only */
+  add_log_store (self, _tpl_log_store_xml_legacy_new ());
+
   /* Load by default the Empathy's legacy 'past coversations' LogStore */
   add_log_store (self, _tpl_log_store_empathy_new ());
 
diff --git a/telepathy-logger/log-store-xml-internal.h b/telepathy-logger/log-store-xml-internal.h
index 8bddd3b..04eb47d 100644
--- a/telepathy-logger/log-store-xml-internal.h
+++ b/telepathy-logger/log-store-xml-internal.h
@@ -62,6 +62,7 @@ GType _tpl_log_store_xml_get_type (void);
 
 TplLogStore * _tpl_log_store_xml_new (void);
 TplLogStore * _tpl_log_store_empathy_new (void);
+TplLogStore * _tpl_log_store_xml_legacy_new (void);
 
 G_END_DECLS
 #endif /* __TPL_LOG_STORE_XML_H__ */
diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c
index 53a1dcf..33c3956 100644
--- a/telepathy-logger/log-store-xml.c
+++ b/telepathy-logger/log-store-xml.c
@@ -1922,3 +1922,12 @@ _tpl_log_store_empathy_new (void)
       "writable", FALSE,
       NULL);
 }
+
+TplLogStore *
+_tpl_log_store_xml_legacy_new (void)
+{
+  return g_object_new (TPL_TYPE_LOG_STORE_XML,
+      "name", "TpLogger",
+      "writable", FALSE,
+      NULL);
+}
diff --git a/tests/logger/dbus/test-log-manager.c b/tests/logger/dbus/test-log-manager.c
index 45342a8..9f290c2 100644
--- a/tests/logger/dbus/test-log-manager.c
+++ b/tests/logger/dbus/test-log-manager.c
@@ -322,10 +322,10 @@ test_get_dates (TestCaseFixture *fixture,
 
   g_object_unref (entity);
 
-  /* it includes 1 date from libpurple logs, 5 from TpLogger. Empathy
-   * log-store date are the same of the TpLogger store, and wont' be present,
-   * being duplicates */
-  g_assert_cmpint (g_list_length (fixture->ret), ==, 6);
+  /* it includes 1 date from libpurple logs, 5 from telepathy-1 and
+   * 1 from TpLogger. Empathy log-store date are the same of the TpLogger store,
+   * and wont' be present, being duplicates */
+  g_assert_cmpint (g_list_length (fixture->ret), ==, 7);
 
   /* we do not want duplicates, dates are suppose to be ordered */
   fixture->ret = g_list_sort (fixture->ret, (GCompareFunc) g_date_compare);
diff --git a/tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2 at collabora.co.uk/20100112.log b/tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2 at collabora.co.uk/20100112.log
new file mode 100644
index 0000000..112391d
--- /dev/null
+++ b/tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2 at collabora.co.uk/20100112.log
@@ -0,0 +1,5 @@
+<?xml version='1.0' encoding='utf-8'?>
+<?xml-stylesheet type="text/xsl" href="empathy-log.xsl"?>
+<log>
+<message time='20100112T17:47:57' cm_id='123' id='user at collabora.co.uk' name='User1' token='' isuser='true' type='normal'>I ♥ badgers</message>
+</log>



More information about the telepathy-commits mailing list