diff options
author | Dan Winship <danw@src.gnome.org> | 2000-03-23 05:47:21 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-03-23 05:47:21 +0800 |
commit | 425b07fa747e1bd02a5bb86e207de172e65d580c (patch) | |
tree | 0eb7a3f97d59982a30e92adbcd14c4be3c1e8b2c /camel | |
parent | 175fcc0ed5505da062bae09d6f3ce77f5b179536 (diff) | |
download | gsoc2013-evolution-425b07fa747e1bd02a5bb86e207de172e65d580c.tar gsoc2013-evolution-425b07fa747e1bd02a5bb86e207de172e65d580c.tar.gz gsoc2013-evolution-425b07fa747e1bd02a5bb86e207de172e65d580c.tar.bz2 gsoc2013-evolution-425b07fa747e1bd02a5bb86e207de172e65d580c.tar.lz gsoc2013-evolution-425b07fa747e1bd02a5bb86e207de172e65d580c.tar.xz gsoc2013-evolution-425b07fa747e1bd02a5bb86e207de172e65d580c.tar.zst gsoc2013-evolution-425b07fa747e1bd02a5bb86e207de172e65d580c.zip |
New function to query a service for the authentication protocols it
* camel-service.c (camel_service_query_auth_types): New function
to query a service for the authentication protocols it supports.
* providers/pop3/camel-pop3-store.c (query_auth_types): implement
svn path=/trunk/; revision=2147
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 7 | ||||
-rw-r--r-- | camel/camel-service.c | 32 | ||||
-rw-r--r-- | camel/camel-service.h | 11 | ||||
-rw-r--r-- | camel/providers/pop3/camel-pop3-store.c | 20 |
4 files changed, 70 insertions, 0 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 527325a93f..0c11050043 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,12 @@ 2000-03-22 Dan Winship <danw@helixcode.com> + * camel-service.c (camel_service_query_auth_types): New function + to query a service for the authentication protocols it supports. + * providers/pop3/camel-pop3-store.c (query_auth_types): implement + + * camel-provider.c (camel_provider_scan): New function to + scan the provider dir and return a list of all providers. + * providers/pop3/camel-pop3-folder.c: fill this in partially * providers/pop3/camel-pop3-store.c: make camel_pop3_command return the text after "+OK"/"-ERR" and add a separate diff --git a/camel/camel-service.c b/camel/camel-service.c index 86e871dd73..19683782c5 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -38,6 +38,7 @@ static gboolean _connect_with_url (CamelService *service, Gurl *url, CamelException *ex); static gboolean _disconnect(CamelService *service, CamelException *ex); static gboolean _is_connected (CamelService *service); +static GList * _query_auth_types (CamelService *service); static void _finalize (GtkObject *object); static gboolean _set_url (CamelService *service, Gurl *url, CamelException *ex); @@ -55,6 +56,7 @@ camel_service_class_init (CamelServiceClass *camel_service_class) camel_service_class->connect_with_url = _connect_with_url; camel_service_class->disconnect = _disconnect; camel_service_class->is_connected = _is_connected; + camel_service_class->query_auth_types = _query_auth_types; /* virtual method overload */ gtk_object_class->finalize = _finalize; @@ -363,3 +365,33 @@ camel_service_get_session (CamelService *service) { return service->session; } + + +GList * +_query_auth_types (CamelService *service) +{ + return NULL; +} + +/** + * camel_service_query_auth_types: return a list of supported + * authentication types. + * @service: a CamelService + * + * This is used by the mail source wizard to get the list of + * authentication types supported by the protocol, and information + * about them. + * + * This may be called on a service with or without an associated URL. + * If there is no URL, the routine must return a generic answer. If + * the service does have a URL, the routine MAY connect to the server + * and query what authentication mechanisms it supports. + * + * Return value: a list of CamelServiceAuthType records. The caller + * must free the list when it is done. + **/ +GList * +camel_service_query_auth_types (CamelService *service) +{ + return CSERV_CLASS(service)->query_auth_types(service); +} diff --git a/camel/camel-service.h b/camel/camel-service.h index 5e81e6a80e..d09524c8c4 100644 --- a/camel/camel-service.h +++ b/camel/camel-service.h @@ -70,16 +70,25 @@ typedef struct { gboolean (*is_connected) (CamelService *service); + GList * (*query_auth_types) (CamelService *service); + } CamelServiceClass; /* flags for url_flags. (others can be added if needed) */ #define CAMEL_SERVICE_URL_NEED_USER (1 << 1) +#define CAMEL_SERVICE_URL_NEED_AUTH (1 << 2) #define CAMEL_SERVICE_URL_NEED_HOST (1 << 4) #define CAMEL_SERVICE_URL_NEED_PATH (1 << 6) +/* query_auth_types returns a GList of these */ +typedef struct { + char *name, *description, *authproto; + gboolean need_password; +} CamelServiceAuthType; + /* public methods */ CamelService * camel_service_new (GtkType type, @@ -99,6 +108,8 @@ gboolean camel_service_is_connected (CamelService *service); char * camel_service_get_url (CamelService *service); CamelSession * camel_service_get_session (CamelService *service); +GList * camel_service_query_auth_types (CamelService *service); + /* Standard Gtk function */ GtkType camel_service_get_type (void); diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index 2d3f4cbb86..019e314ce7 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -46,6 +46,8 @@ static gboolean pop3_connect (CamelService *service, CamelException *ex); +static GList *query_auth_types (CamelService *service); + static CamelFolder *get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex); @@ -60,6 +62,7 @@ camel_pop3_store_class_init (CamelPop3StoreClass *camel_pop3_store_class) /* virtual method overload */ camel_service_class->connect = pop3_connect; + camel_service_class->query_auth_types = query_auth_types; camel_store_class->get_root_folder = camel_pop3_folder_new; camel_store_class->get_default_folder = camel_pop3_folder_new; @@ -105,6 +108,23 @@ camel_pop3_store_get_type (void) } +static CamelServiceAuthType password_authtype = { + "Password/APOP", + + "This option will connect to the POP server using the APOP " + "protocol if possible, or a plaintext password if not.", + + "", + TRUE +}; + +static GList *query_auth_types (CamelService *service) +{ + GList *ret; + + ret = g_list_append (NULL, &password_authtype); + return ret; +} static gboolean pop3_connect (CamelService *service, CamelException *ex) |