summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2009-12-29 12:09:12 +0000
committerCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2009-12-29 12:09:12 +0000
commit3fa20ae0b0d2465f3a78076461f19c59f4cfca41 (patch)
tree5c3439fa7ae8ffb7f218c79c3c3d6d1b1cf713d9 /src
parent2617a96e629c78e9c3b7a983ce47d96174136b2c (diff)
downloadtelepathy-logger-3fa20ae0b0d2465f3a78076461f19c59f4cfca41.tar.gz
reverting the test file
Diffstat (limited to 'src')
-rw-r--r--src/test.c60
1 files changed, 5 insertions, 55 deletions
diff --git a/src/test.c b/src/test.c
index ac75b43..0042001 100644
--- a/src/test.c
+++ b/src/test.c
@@ -20,69 +20,19 @@
*/
#include <glib.h>
-#include <stdio.h>
-#include <tpl-log-reader.h>
-#include <telepathy-glib/account.h>
-#include <telepathy-glib/dbus.h>
+#include <tpl-observer.h>
-//static GMainLoop *loop = NULL;
+static GMainLoop *loop = NULL;
int main(int argc, char *argv[])
{
- TplLogReader *reader;
- GList *l;
- TpAccount *acc;
- //DBusGConnection *bus;
- TpDBusDaemon *tp_bus;
- GError *err=NULL;
g_type_init ();
- //tpl_headless_logger_init ();
-
- //bus = tp_get_bus();
- tp_bus = tp_dbus_daemon_dup(&err);
- acc = tp_account_new(tp_bus,
- "/org/freedesktop/Telepathy/Account/gabble/jabber/cosimo_2ealfarano_40collabora_2eco_2euk0",
- &err);
+ tpl_headless_logger_init ();
- if(err) {
- g_debug(err->message);
- return 0;
- }
-
- reader = tpl_log_reader_dup_singleton ();
-
- tpl_log_reader_search_new(reader, "foo");
-
-
- l = tpl_log_reader_get_chats(reader, acc);
- int lenght = g_list_length(l);
- for(int i=0;i<lenght;++i) {
- TplLogSearchHit *hit = g_list_nth_data(l,i);
- g_debug("%d: %s\n", i, hit->filename);
- GList *gl;
-
- gl = tpl_log_reader_get_dates (reader, acc, hit->chat_id, hit->is_chatroom);
- g_list_foreach (gl, (GFunc) puts, NULL);
-
- for(guint ii=0;ii<g_list_length(gl);++ii) {
- GList *msgs;
- gchar *date = g_list_nth_data(gl, i);
- msgs = tpl_log_reader_get_messages_for_date(reader, acc, hit->chat_id,
- hit->is_chatroom, date);
- for(guint m=0;m<g_list_length(msgs);++m) {
- TplLogEntry *log = g_list_nth_data(msgs, m);
- TplLogEntryText *tlog = TPL_LOG_ENTRY_TEXT(tpl_log_entry_get_entry(log));
-
- g_message("BODY: %s\n", tpl_log_entry_text_get_message(tlog));
- }
- }
-
- }
-
- //loop = g_main_loop_new (NULL, FALSE);
- //g_main_loop_run (loop);
+ loop = g_main_loop_new (NULL, FALSE);
+ g_main_loop_run (loop);
return 0;
}