summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-01-13 14:43:47 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-01-14 14:13:13 +0100
commit71eb66b32cabf75f1d831d2e720b0e11dfe40d7e (patch)
tree30b10ec26072d9c547cda6beffa00a11845bb5a2
parent9a2d7baab13d8239f3dd7d0584ac8bb85b04f782 (diff)
downloadtelepathy-glib-71eb66b32cabf75f1d831d2e720b0e11dfe40d7e.tar.gz
add XML legacy log store
Keeps reading from the old log location.
-rw-r--r--telepathy-logger/log-manager.c3
-rw-r--r--telepathy-logger/log-store-xml-internal.h1
-rw-r--r--telepathy-logger/log-store-xml.c9
-rw-r--r--tests/logger/dbus/test-log-manager.c8
-rw-r--r--tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2@collabora.co.uk/20100112.log5
5 files changed, 22 insertions, 4 deletions
diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c
index 41cea0804..dfc761d37 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 8bddd3b1a..04eb47d14 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 53a1dcfba..33c395674 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 45342a829..9f290c2f6 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@collabora.co.uk/20100112.log b/tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2@collabora.co.uk/20100112.log
new file mode 100644
index 000000000..112391d4e
--- /dev/null
+++ b/tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2@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@collabora.co.uk' name='User1' token='' isuser='true' type='normal'>I ♥ badgers</message>
+</log>