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