X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=tests%2Fdbus_api%2Ftest_open_message.c;h=195b8abb8d127fee896bdbbec1ede292b104514e;hb=12fe7988e34a4ba22a68f687db4993e12578a9b2;hp=5f1afe9e448994aadf640b10fea2ba67d49a4753;hpb=140b3a1e00f1d04e8fd2683e9b77aba8bf79c2d5;p=modest diff --git a/tests/dbus_api/test_open_message.c b/tests/dbus_api/test_open_message.c index 5f1afe9..195b8ab 100644 --- a/tests/dbus_api/test_open_message.c +++ b/tests/dbus_api/test_open_message.c @@ -1,30 +1,45 @@ #include #include -int main(int argc, char *argv[]) +int +main (int argc, char *argv[]) { - /* Initialize maemo application */ - osso_context_t * osso_context = osso_initialize( - "test_hello", "0.0.1", TRUE, NULL); + osso_context_t *osso_context; + const char *url; + gboolean ret; + + osso_context = osso_initialize ("test_open_msg", + "0.0.1", + TRUE, + NULL); - /* Check that initialization was ok */ - if (osso_context == NULL) - { - printf("osso_initialize() failed.\n"); - return OSSO_ERROR; + if (osso_context == NULL) { + g_printerr ("osso_initialize() failed.\n"); + return -1; } - /* Call the function in libmodest-dbus-client: */ - /* TODO: The Message URI system is not yet implemented. */ - const gboolean ret = libmodest_dbus_client_open_message (osso_context, - "http://todo_some_message_uri"); + /* For instance, + * "pop://murray.cumming%40gmail.com@pop.gmail.com:995/;use_ssl=wrapped/inbox/GmailId112e166949157685" + */ + if (argc == 2) { + url = argv[1]; + } else { + /* TODO: Add some test DBus method to get a valid URL for a message, + * just so we can test this method. */ + g_printerr ("No email URL argument supplied on the command line.\n"); + return -1; + } + + g_print ("Trying to open msg: %s\n", url); + ret = libmodest_dbus_client_open_message (osso_context, + url); + if (!ret) { - printf("libmodest_dbus_client_open_message() failed.\n"); - return OSSO_ERROR; + g_printerr ("libmodest_dbus_client_open_message() failed.\n"); } else { - printf("libmodest_dbus_client_open_message() succeeded.\n"); + g_print ("libmodest_dbus_client_open_message() succeeded.\n"); } - /* Exit */ - return 0; + return ret ? 0 : -1; + }