aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-04-25 08:25:04 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-04-25 08:25:04 +0800
commit890fd0d44e54aed5ae0412d39a2bca964f4f20e7 (patch)
treef760f9ae72615dd4c7dfc1c6a8ee62822013d0d3 /camel
parent289d2c34a07365b18a44dc986beb37744f84e997 (diff)
downloadgsoc2013-evolution-890fd0d44e54aed5ae0412d39a2bca964f4f20e7.tar
gsoc2013-evolution-890fd0d44e54aed5ae0412d39a2bca964f4f20e7.tar.gz
gsoc2013-evolution-890fd0d44e54aed5ae0412d39a2bca964f4f20e7.tar.bz2
gsoc2013-evolution-890fd0d44e54aed5ae0412d39a2bca964f4f20e7.tar.lz
gsoc2013-evolution-890fd0d44e54aed5ae0412d39a2bca964f4f20e7.tar.xz
gsoc2013-evolution-890fd0d44e54aed5ae0412d39a2bca964f4f20e7.tar.zst
gsoc2013-evolution-890fd0d44e54aed5ae0412d39a2bca964f4f20e7.zip
Configure the default paths for mh, mbox, maildir, spools, etc.
2002-04-24 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-local-provider.c (camel_provider_module_init): Configure the default paths for mh, mbox, maildir, spools, etc. * camel-provider.h: Add a CAMEL_PROVIDER_CONF_LABEL enum and define some default CamelProviderConfEntry macros. svn path=/trunk/; revision=16580
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/camel-provider.h4
-rw-r--r--camel/providers/local/camel-local-provider.c67
3 files changed, 62 insertions, 16 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 82c65ff49e..207b49cfe0 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,6 +1,11 @@
2002-04-24 Jeffrey Stedfast <fejj@ximian.com>
- * camel-provider.h: Add a CAMEL_PROVIDER_CONF_LABEL enum.
+ * providers/local/camel-local-provider.c
+ (camel_provider_module_init): Configure the default paths for mh,
+ mbox, maildir, spools, etc.
+
+ * camel-provider.h: Add a CAMEL_PROVIDER_CONF_LABEL enum and
+ define some default CamelProviderConfEntry macros.
2002-04-19 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/camel/camel-provider.h b/camel/camel-provider.h
index bd1b2dedfd..dd2bd98329 100644
--- a/camel/camel-provider.h
+++ b/camel/camel-provider.h
@@ -123,6 +123,10 @@ typedef struct {
} CamelProviderConfEntry;
+/* Some defaults */
+#define CAMEL_PROVIDER_CONF_DEFAULT_USERNAME { CAMEL_PROVIDER_CONF_LABEL, "username", NULL, N_("User_name:"), NULL }
+#define CAMEL_PROVIDER_CONF_DEFAULT_HOSTNAME { CAMEL_PROVIDER_CONF_LABEL, "hostname", NULL, N_("_Host:"), NULL }
+#define CAMEL_PROVIDER_CONF_DEFAULT_PATH { CAMEL_PROVIDER_CONF_ENTRY, "path", NULL, N_("_Path:"), "" }
typedef struct {
/* Provider name used in CamelURLs. */
diff --git a/camel/providers/local/camel-local-provider.c b/camel/providers/local/camel-local-provider.c
index ba765ff20c..bae68e6aa7 100644
--- a/camel/providers/local/camel-local-provider.c
+++ b/camel/providers/local/camel-local-provider.c
@@ -38,6 +38,11 @@
#define d(x)
+static CamelProviderConfEntry mh_conf_entries[] = {
+ CAMEL_PROVIDER_CONF_DEFAULT_PATH,
+ { CAMEL_PROVIDER_CONF_END }
+};
+
static CamelProvider mh_provider = {
"mh",
N_("MH-format mail directories"),
@@ -45,9 +50,15 @@ static CamelProvider mh_provider = {
"mail",
CAMEL_PROVIDER_IS_LOCAL,
CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
+ mh_conf_entries,
/* ... */
};
+static CamelProviderConfEntry mbox_conf_entries[] = {
+ CAMEL_PROVIDER_CONF_DEFAULT_PATH,
+ { CAMEL_PROVIDER_CONF_END }
+};
+
static CamelProvider mbox_provider = {
"mbox",
N_("Local delivery"),
@@ -55,10 +66,12 @@ static CamelProvider mbox_provider = {
"mail",
CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_LOCAL,
CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
+ mbox_conf_entries,
/* ... */
};
-static CamelProviderConfEntry local_conf_entries[] = {
+static CamelProviderConfEntry maildir_conf_entries[] = {
+ CAMEL_PROVIDER_CONF_DEFAULT_PATH,
{ CAMEL_PROVIDER_CONF_CHECKBOX, "filter", NULL,
N_("Apply filters to new messages in INBOX"), "0" },
{ CAMEL_PROVIDER_CONF_END }
@@ -71,10 +84,17 @@ static CamelProvider maildir_provider = {
"mail",
CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_IS_LOCAL,
CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
- local_conf_entries,
+ maildir_conf_entries,
/* ... */
};
+static CamelProviderConfEntry spool_conf_entries[] = {
+ CAMEL_PROVIDER_CONF_DEFAULT_PATH,
+ { CAMEL_PROVIDER_CONF_CHECKBOX, "filter", NULL,
+ N_("Apply filters to new messages in INBOX"), "0" },
+ { CAMEL_PROVIDER_CONF_END }
+};
+
static CamelProvider spool_provider = {
"spool",
N_("Standard Unix mbox spools"),
@@ -82,10 +102,15 @@ static CamelProvider spool_provider = {
"mail",
CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE,
CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
- local_conf_entries,
+ spool_conf_entries,
/* ... */
};
+static CamelProviderConfEntry spoold_conf_entries[] = {
+ CAMEL_PROVIDER_CONF_DEFAULT_PATH,
+ { CAMEL_PROVIDER_CONF_END }
+};
+
static CamelProvider spoold_provider = {
"spoold",
N_("Directory tree of mbox files"),
@@ -93,6 +118,7 @@ static CamelProvider spoold_provider = {
"mail",
CAMEL_PROVIDER_IS_SOURCE | CAMEL_PROVIDER_IS_STORAGE | CAMEL_PROVIDER_IS_LOCAL,
CAMEL_URL_NEED_PATH | CAMEL_URL_PATH_IS_ABSOLUTE,
+ spoold_conf_entries,
/* ... */
};
@@ -180,27 +206,38 @@ local_url_equal(const void *v, const void *v2)
void camel_provider_module_init(CamelSession * session)
{
- mh_provider.object_types[CAMEL_PROVIDER_STORE] = camel_mh_store_get_type();
+ char *path;
+
+ mh_conf_entries[0].value = ""; /* default path */
+ mh_provider.object_types[CAMEL_PROVIDER_STORE] = camel_mh_store_get_type ();
mh_provider.url_hash = local_url_hash;
mh_provider.url_equal = local_url_equal;
camel_session_register_provider(session, &mh_provider);
-
- mbox_provider.object_types[CAMEL_PROVIDER_STORE] = camel_mbox_store_get_type();
+
+ if (!(path = getenv ("MAIL")))
+ path = g_strdup_printf (SYSTEM_MAIL_DIR "/%s", g_get_user_name ());
+ mbox_conf_entries[0].value = path; /* default path */
+ mbox_provider.object_types[CAMEL_PROVIDER_STORE] = camel_mbox_store_get_type ();
mbox_provider.url_hash = local_url_hash;
mbox_provider.url_equal = local_url_equal;
camel_session_register_provider(session, &mbox_provider);
-
- maildir_provider.object_types[CAMEL_PROVIDER_STORE] = camel_maildir_store_get_type();
- maildir_provider.url_hash = local_url_hash;
- maildir_provider.url_equal = local_url_equal;
- camel_session_register_provider(session, &maildir_provider);
-
- spool_provider.object_types[CAMEL_PROVIDER_STORE] = camel_spool_store_get_type();
+
+ spool_conf_entries[0].value = path; /* default path - same as mbox */
+ spool_provider.object_types[CAMEL_PROVIDER_STORE] = camel_spool_store_get_type ();
spool_provider.url_hash = local_url_hash;
spool_provider.url_equal = local_url_equal;
camel_session_register_provider(session, &spool_provider);
-
- spoold_provider.object_types[CAMEL_PROVIDER_STORE] = camel_spoold_store_get_type();
+
+ path = getenv ("MAILDIR");
+ maildir_conf_entries[0].value = path ? path : ""; /* default path */
+ maildir_provider.object_types[CAMEL_PROVIDER_STORE] = camel_maildir_store_get_type ();
+ maildir_provider.url_hash = local_url_hash;
+ maildir_provider.url_equal = local_url_equal;
+ camel_session_register_provider(session, &maildir_provider);
+
+ path = g_strdup_printf ("%s/mail", g_get_home_dir ());
+ spoold_conf_entries[0].value = path; /* default path */
+ spoold_provider.object_types[CAMEL_PROVIDER_STORE] = camel_spoold_store_get_type ();
spoold_provider.url_hash = local_url_hash;
spoold_provider.url_equal = local_url_equal;
camel_session_register_provider(session, &spoold_provider);