Modified webpage: now tinymail repository is in gitorious.
[modest] / tests / dbus_api / test_update_folder_counts.c
1 #include <libmodest-dbus-client/libmodest-dbus-client.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <glib.h>
5
6 static gchar *account_id = NULL;
7
8 static GOptionEntry option_entries [] =
9 {
10         { "account", 'a', 0, G_OPTION_ARG_STRING, &account_id, "Account to perform update folder accounts into", NULL },
11         { NULL }
12 };
13
14
15 int
16 main (int argc, char *argv[])
17 {
18         osso_context_t *osso_context;
19         GOptionContext *context;
20         gboolean result;
21         GError *error = NULL;
22
23         context = g_option_context_new ("- Modest email client");
24         g_option_context_add_main_entries (context, option_entries, NULL);
25         if (!g_option_context_parse (context, &argc, &argv, &error)) {
26                 g_print ("option parsing failed: %s\n", error->message);
27                 g_option_context_free (context);
28                 exit (1);
29         }
30         g_option_context_free (context);
31
32         osso_context = osso_initialize ("test_update_account",
33                                         "0.0.1",
34                                         TRUE,
35                                         NULL);
36                
37         if (osso_context == NULL) {
38                 g_printerr ("osso_initialize() failed.\n");
39             return -1;
40         }
41
42         if (account_id == NULL) {
43                 g_printerr ("Provide an account id\n");
44                 return -1;
45         }
46
47         result = libmodest_dbus_client_update_folder_counts (osso_context, account_id);
48         g_free (account_id);
49
50         return result;
51
52 }