File: test_update_folder_counts.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 (52 lines) | stat: -rw-r--r-- 1,196 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
46
47
48
49
50
51
52
#include <libmodest-dbus-client/libmodest-dbus-client.h>
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>

static gchar *account_id = NULL;

static GOptionEntry option_entries [] =
{
	{ "account", 'a', 0, G_OPTION_ARG_STRING, &account_id, "Account to perform update folder accounts into", NULL },
	{ NULL }
};


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",
					TRUE,
					NULL);
	       
	if (osso_context == NULL) {
		g_printerr ("osso_initialize() failed.\n");
	    return -1;
	}

	if (account_id == NULL) {
		g_printerr ("Provide an account id\n");
		return -1;
	}

	result = libmodest_dbus_client_update_folder_counts (osso_context, account_id);
	g_free (account_id);

	return result;

}