File: test_open_message.c

package info (click to toggle)
modest 3.90.4-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 7,400 kB
  • ctags: 8,562
  • sloc: ansic: 88,775; makefile: 959; xml: 122; sh: 57
file content (45 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <libmodest-dbus-client/libmodest-dbus-client.h>
#include <stdio.h>

int
main (int argc, char *argv[])
{
	osso_context_t *osso_context;
	const char *url;
      	gboolean ret; 

	osso_context = osso_initialize ("test_open_msg",
					"0.0.1",
					TRUE,
					NULL);
	       
	if (osso_context == NULL) {
		g_printerr ("osso_initialize() failed.\n");
	    return -1;
	}
	
	/* For instance, 
	 * "pop://nomail%40nodomain.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) {
		g_printerr ("libmodest_dbus_client_open_message() failed.\n");
	} else {
		g_print ("libmodest_dbus_client_open_message() succeeded.\n");
	}
		
    return ret ? 0 : -1;

}