aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs/cal-backend-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/pcs/cal-backend-util.c')
-rw-r--r--calendar/pcs/cal-backend-util.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/calendar/pcs/cal-backend-util.c b/calendar/pcs/cal-backend-util.c
index e2d138e372..7b3b119319 100644
--- a/calendar/pcs/cal-backend-util.c
+++ b/calendar/pcs/cal-backend-util.c
@@ -52,3 +52,66 @@ cal_backend_util_fill_alarm_instances_seq (GNOME_Evolution_Calendar_CalAlarmInst
corba_instance->occur_end = (long) instance->occur_end;
}
}
+
+void
+cal_backend_mail_account_get (Bonobo_ConfigDatabase db,
+ gint def,
+ char **address,
+ char **name)
+{
+ gchar *path;
+
+ *address = NULL;
+ *name = NULL;
+
+ /* get the identity info */
+ path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", def);
+ *name = bonobo_config_get_string (db, path, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", def);
+ *address = bonobo_config_get_string (db, path, NULL);
+ g_free (path);
+}
+
+gboolean
+cal_backend_mail_account_get_default (Bonobo_ConfigDatabase db,
+ char **address,
+ char **name)
+{
+ glong def, len;
+
+ *address = NULL;
+ *name = NULL;
+
+ len = bonobo_config_get_long_with_default (db, "/Mail/Accounts/num", 0, NULL);
+ def = bonobo_config_get_long_with_default (db, "/Mail/Accounts/default_account", 0, NULL);
+
+ if (def < len)
+ cal_backend_mail_account_get (db, def, address, name);
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
+gboolean
+cal_backend_mail_account_is_valid (Bonobo_ConfigDatabase db, char *user, char **name)
+{
+ gchar *address;
+ glong len, i;
+
+ len = bonobo_config_get_long_with_default (db, "/Mail/Accounts/num", 0, NULL);
+
+ for (i = 0; i < len; i++) {
+ cal_backend_mail_account_get (db, i, &address, name);
+ if (address != NULL && !strcmp (address, user)) {
+ g_free (address);
+ return TRUE;
+ }
+ g_free (address);
+ g_free (*name);
+ }
+
+ return FALSE;
+}