1 #include <libmodest-dbus-client/libmodest-dbus-client.h>
6 int main (int argc, char *argv[])
8 osso_context_t *osso_context;
13 osso_context = osso_initialize ("test_search",
19 /* Check that initialization was ok */
20 if (osso_context == NULL) {
21 g_printerr ("osso_initialize() failed.\n");
28 number = strtol (argv[1], NULL, 10);
33 g_print ("Starting get_unread_messages)...\n");
35 res = libmodest_dbus_client_get_unread_messages (osso_context,
39 g_print ("Search done. (success: %s)\n", res ? "yes" : "no");
41 for (iter = hits; iter; iter = iter->next) {
42 ModestAccountHits *hits = (ModestAccountHits *) iter->data;
45 g_print ("Account: id: %s name: %s protocol: %s\n", hits->account_id, hits->account_name, hits->store_protocol);
46 for (header_node = hits->hits; header_node != NULL; header_node = g_list_next (header_node)) {
47 ModestGetUnreadMessagesHit *hit = (ModestGetUnreadMessagesHit *) header_node->data;
49 g_print (" %s\n %s\n", hit->subject, ctime (&(hit->timestamp)));
52 modest_account_hits_list_free (hits);