Fixes NB#143352, add a DBus API to request inmmediate Send&Receive (like manual send...
[modest] / tests / dbus_api / test_update_account.c
index 29c62fe..96f57a8 100644 (file)
@@ -1,11 +1,36 @@
 #include <libmodest-dbus-client/libmodest-dbus-api.h>
 #include <libmodest-dbus-client/libmodest-dbus-client.h>
 #include <stdio.h>
 #include <libmodest-dbus-client/libmodest-dbus-api.h>
 #include <libmodest-dbus-client/libmodest-dbus-client.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+
+static gboolean manual = FALSE;
+static gchar *account_id = NULL;
+
+static GOptionEntry option_entries [] =
+{
+       { "manual", 'm', 0, G_OPTION_ARG_NONE, &manual, "Manual send receive, so behave as interactive.", NULL },
+       { "account", 'a', 0, G_OPTION_ARG_STRING, &account_id, "Account to perform send receive into", NULL },
+       { NULL }
+};
+
 
 int
 main (int argc, char *argv[])
 {
        osso_context_t *osso_context;
 
 int
 main (int argc, char *argv[])
 {
        osso_context_t *osso_context;
+       GOptionContext *context;
+       gboolean result;
+       GError *error = NULL;
+
+       context = g_option_context_new ("- Modest email client");
+       g_option_context_add_main_entries (context, option_entries, NULL);
+       if (!g_option_context_parse (context, &argc, &argv, &error)) {
+               g_print ("option parsing failed: %s\n", error->message);
+               g_option_context_free (context);
+               exit (1);
+       }
+       g_option_context_free (context);
 
        osso_context = osso_initialize ("test_update_account",
                                        "0.0.1",
 
        osso_context = osso_initialize ("test_update_account",
                                        "0.0.1",
@@ -17,5 +42,9 @@ main (int argc, char *argv[])
            return -1;
        }
 
            return -1;
        }
 
-       return libmodest_dbus_client_send_and_receive (osso_context);
+       result = libmodest_dbus_client_send_and_receive_full (osso_context, account_id, manual);
+       g_free (account_id);
+
+       return result;
+
 }
 }