aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-provider.c36
-rw-r--r--camel/camel-provider.h16
3 files changed, 54 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f454cad21b..d5d40d96fb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2002-04-26 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-provider.c (camel_provider_auto_detect): New function to
+ auto-detect configuration settings.
+
2002-04-26 Not Zed <NotZed@Ximian.com>
* camel-block-file.c (block_file_validate_root): Remove the
diff --git a/camel/camel-provider.c b/camel/camel-provider.c
index a9afc0fa22..30d5f729f9 100644
--- a/camel/camel-provider.c
+++ b/camel/camel-provider.c
@@ -153,3 +153,39 @@ camel_provider_load (CamelSession *session, const char *path, CamelException *ex
camel_provider_module_init (session);
}
+
+
+/**
+ * camel_provider_auto_detect:
+ * @provider: camel provider
+ * @settings: currently set settings
+ * @auto_detected: output hash table of auto-detected values
+ * @ex: exception
+ *
+ * After filling in the standard Username/Hostname/Port/Path settings
+ * (which must be set in @settings), if the provider supports it, you
+ * may wish to have the provider auto-detect further settings based on
+ * the aformentioned settings.
+ *
+ * If the provider does not support auto-detection, @auto_detected
+ * will be set to %NULL. Otherwise the provider will attempt to
+ * auto-detect whatever it can and file them into @auto_detected. If
+ * for some reason it cannot auto-detect anything (not enough
+ * information provided in @settings?) then @auto_deetected will be
+ * set to %NULL and an exception may be set to explain why it failed.
+ *
+ * Returns 0 on success or -1 on fail.
+ **/
+int
+camel_provider_auto_detect (CamelProvider *provider, GHashTable *settings,
+ GHashTable **auto_detected, CamelException *ex)
+{
+ g_return_val_if_fail (provider != NULL, -1);
+
+ if (provider->auto_detect) {
+ return provider->auto_detect (settings, auto_detected, ex);
+ } else {
+ *auto_detected = NULL;
+ return 0;
+ }
+}
diff --git a/camel/camel-provider.h b/camel/camel-provider.h
index dd2bd98329..606271050d 100644
--- a/camel/camel-provider.h
+++ b/camel/camel-provider.h
@@ -36,6 +36,7 @@ extern "C" {
#include <camel/camel-types.h>
#include <camel/camel-object.h>
+#include <camel/camel-exception.h>
#define CAMEL_PROVIDER(obj) ((CamelProvider *)(obj))
@@ -128,6 +129,8 @@ typedef struct {
#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 int (*CamelProviderAutoDetectFunc) (GHashTable *settings, GHashTable **auto_detected, CamelException *ex);
+
typedef struct {
/* Provider name used in CamelURLs. */
char *protocol;
@@ -155,18 +158,21 @@ typedef struct {
/* Extra configuration information */
CamelProviderConfEntry *extra_conf;
+ /* auto-detection function */
+ CamelProviderAutoDetectFunc auto_detect;
+
/* CamelType(s) of its store and/or transport. If both are
* set, then they are assumed to be linked together and the
* transport type can only be used in an account that also
* uses the store type (eg, Exchange or NNTP).
*/
CamelType object_types[CAMEL_NUM_PROVIDER_TYPES];
-
+
/* GList of CamelServiceAuthTypes the provider supports */
GList *authtypes;
-
+
GHashTable *service_cache[CAMEL_NUM_PROVIDER_TYPES];
-
+
GHashFunc url_hash;
GCompareFunc url_equal;
} CamelProvider;
@@ -177,6 +183,10 @@ void camel_provider_load (CamelSession *session, const char *path, CamelExceptio
/* This is defined by each module, not by camel-provider.c. */
void camel_provider_module_init (CamelSession *session);
+
+int camel_provider_auto_detect (CamelProvider *provider, GHashTable *settings,
+ GHashTable **auto_detected, CamelException *ex);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */