diff options
author | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-01-14 17:23:58 +0000 |
---|---|---|
committer | Cosimo Alfarano <cosimo.alfarano@collabora.co.uk> | 2010-01-14 17:23:58 +0000 |
commit | 29c7fb4da417adebc65b7a0a44ee49a0bfdd2797 (patch) | |
tree | 5ea4482ad66b2cf3d8ca70ed3db485f52df5f403 /src | |
parent | c5a57433eb4c2ade0fc110d98093eea2bb42de3e (diff) | |
download | telepathy-logger-29c7fb4da417adebc65b7a0a44ee49a0bfdd2797.tar.gz |
GConf enabled
* gconf enabled using TplConf. Schema defined in telepathy-logger.schemas file
* fixes for the Async API
* add_message and add_message_async modified: chat_id, is_chatroom not needed anymore, while using TplLogEntry
Diffstat (limited to 'src')
-rw-r--r-- | src/test_api.c | 94 |
1 files changed, 37 insertions, 57 deletions
diff --git a/src/test_api.c b/src/test_api.c index 755b966..5ca6a4a 100644 --- a/src/test_api.c +++ b/src/test_api.c @@ -20,84 +20,64 @@ */ #include <glib.h> -#include <telepathy-logger/log-manager.h> -#include <telepathy-logger/datetime.h> +#include <telepathy-logger/conf.h> #define ACCOUNT_PATH "/org/freedesktop/Telepathy/Account/gabble/jabber/cosimo_2ealfarano_40collabora_2eco_2euk0" #define ID "echo@test.collabora.co.uk" static GMainLoop *loop = NULL; -static void -get_messages_cb (TplLogManager * manager, gpointer result, GError * error, - gpointer user_data) +int +main (int argc, char *argv[]) { - guint len; - if (result) - len = g_list_length ((GList *) result); - else - len = 0; - g_message ("GOTCHA: %d\n", len); - - if(error) { - g_error("get messages: %s", error->message); - return; - } - for (guint i = g_list_length (result); i > 0; --i) - { - TplLogEntry *entry = (TplLogEntry *) g_list_nth_data (result, i - 1); - time_t t = tpl_log_entry_get_timestamp (entry); - g_print ("LIST msgs(%d): %s\n", i, - tpl_time_to_string_utc (t, "%Y%m%d %H%M-%S")); - } -} + TplConf *conf; + GSList *list; + GSList *newlist = NULL; -static void -get_dates_cb (TplLogManager * manager, gpointer result, GError * error, - gpointer user_data) -{ - guint len; + g_type_init (); - if(error) { - g_error("get dates: %s", error->message); - g_clear_error(&error); - g_error_free(error); - return; - } + conf = tpl_conf_dup(); - if (result) - len = g_list_length ((GList *) result); - else - len = 0; - g_message ("GOTCHAi: %d\n", len); + g_message ("enabled: %d\n", + tpl_conf_is_globally_enabled(conf, NULL)); - for (guint i = g_list_length (result); i > 0; --i) - g_print ("LIST dates(%d): %s\n", i, (gchar *) g_list_nth_data (result, i - 1)); -} -int -main (int argc, char *argv[]) -{ - g_type_init (); - TpDBusDaemon *tpbus; - TpAccount *acc; + list = tpl_conf_get_accounts_ignorelist(conf, NULL); + while (list) + { + g_message("list elemnet: %s\n",(gchar*)list->data); + list = g_slist_next(list); + } + g_message("FINISH\n"); - TplLogManager *manager = tpl_log_manager_dup_singleton (); + /* set */ + tpl_conf_togle_globally_enable(conf, FALSE, NULL); + newlist = g_slist_append(newlist, "foo"); + newlist = g_slist_append(newlist, "bar"); + tpl_conf_set_accounts_ignorelist(conf, newlist, NULL); - tpbus = tp_dbus_daemon_dup (NULL); - acc = tp_account_new (tpbus, ACCOUNT_PATH, NULL); + /* re-read */ + g_message ("enabled: %d\n", + tpl_conf_is_globally_enabled(conf, NULL)); - tpl_log_manager_get_dates_async (manager, acc, ID, FALSE, - get_dates_cb, NULL, NULL); - tpl_log_manager_get_messages_for_date_async (manager, acc, ID, - FALSE, "20091230", - get_messages_cb, NULL, NULL); + list = tpl_conf_get_accounts_ignorelist(conf, NULL); + while (list) + { + g_message("list elemnet: %s\n",(gchar*)list->data); + list = g_slist_next(list); + } + g_message("FINISH\n"); + + g_message("FOUND: %d\n", + tpl_conf_is_account_ignored(conf, "fooa", NULL)); + loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); + return 0; } |