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
This commit is contained in:
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user