* Changes in the autotools stuff affecting a lot of platform dependent
[modest] / tests / dbus_api / test_open_message.c
1 #include <libmodest-dbus-client/libmodest-dbus-client.h>
2 #include <stdio.h>
3
4 int
5 main (int argc, char *argv[])
6 {
7         osso_context_t *osso_context;
8         const char *url;
9         gboolean ret; 
10
11         osso_context = osso_initialize ("test_open_msg",
12                                         "0.0.1",
13                                         TRUE,
14                                         NULL);
15                
16         if (osso_context == NULL) {
17                 g_printerr ("osso_initialize() failed.\n");
18             return -1;
19         }
20         
21         /* For instance, 
22          * "pop://nomail%40nodomain.com@pop.gmail.com:995/;use_ssl=wrapped/inbox/GmailId112e166949157685"
23          */
24         if (argc == 2) {
25                 url = argv[1];
26         } else {
27                 /* TODO: Add some test DBus method to get a valid URL for a message, 
28                  * just so we can test this method. */
29                 g_printerr ("No email URL argument supplied on the command line.\n");
30                 return -1;
31         }
32
33         g_print ("Trying to open msg: %s\n", url);
34         ret = libmodest_dbus_client_open_message (osso_context,
35                                                   url);
36
37         if (!ret) {
38                 g_printerr ("libmodest_dbus_client_open_message() failed.\n");
39         } else {
40                 g_print ("libmodest_dbus_client_open_message() succeeded.\n");
41         }
42                 
43     return ret ? 0 : -1;
44
45 }