From 5fef7e3cb87f3b478ccfc9ee6fa151ca75f588ac Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 13 Jan 2014 14:43:47 +0100 Subject: [PATCH 12/12] 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 | 2 +- .../user2@collabora.co.uk/20100112.log | 5 +++++ 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2@collabora.co.uk/20100112.log 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 98012ab..6bb6373 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 a018221..9b9924f 100644 --- a/tests/logger/dbus/test-log-manager.c +++ b/tests/logger/dbus/test-log-manager.c @@ -325,7 +325,7 @@ test_get_dates (TestCaseFixture *fixture, /* 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); + 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 0000000..112391d --- /dev/null +++ b/tests/logger/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user2@collabora.co.uk/20100112.log @@ -0,0 +1,5 @@ + + + +I ♥ badgers + -- 1.8.4.2