diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/camel-folder.c | 70 | ||||
-rw-r--r-- | camel/camel-folder.h | 4 | ||||
-rw-r--r-- | camel/camel-service.c | 96 | ||||
-rw-r--r-- | camel/camel-service.h | 19 |
4 files changed, 158 insertions, 31 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 8f5e46b9a8..e401a06dd0 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -29,25 +29,26 @@ static GtkObjectClass *parent_class=NULL; /* Returns the class for a CamelFolder */ #define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) -static void __camel_folder_init_with_store(CamelFolder *folder, CamelStore *parent_store); -static void __camel_folder_open(CamelFolder *folder, CamelFolderOpenMode mode); -static void __camel_folder_close(CamelFolder *folder, gboolean expunge); -static void __camel_folder_set_name(CamelFolder *folder, GString *name_); -static void __camel_folder_set_full_name(CamelFolder *folder, GString *name); -static GString *__camel_folder_get_name(CamelFolder *folder); -static GString *__camel_folder_get_full_name(CamelFolder *folder); -static gboolean __camel_folder_can_hold_folders(CamelFolder *folder); +static void __camel_folder_init_with_store (CamelFolder *folder, CamelStore *parent_store); +static void __camel_folder_open (CamelFolder *folder, CamelFolderOpenMode mode); +static void __camel_folder_close (CamelFolder *folder, gboolean expunge); +static void __camel_folder_set_name (CamelFolder *folder, GString *name_); +static void __camel_folder_set_full_name (CamelFolder *folder, GString *name); +static GString *__camel_folder_get_name (CamelFolder *folder); +static GString *__camel_folder_get_full_name (CamelFolder *folder); +static gboolean __camel_folder_can_hold_folders (CamelFolder *folder); static gboolean __camel_folder_can_hold_messages(CamelFolder *folder); -static gboolean __camel_folder_exists(CamelFolder *folder); -static gboolean __camel_folder_is_open(CamelFolder *folder); -static CamelFolder *__camel_folder_get_folder(CamelFolder *folder, GString *folder_name); -static gboolean __camel_folder_create(CamelFolder *folder); +static gboolean __camel_folder_exists (CamelFolder *folder); +static gboolean __camel_folder_is_open (CamelFolder *folder); +static CamelFolder *__camel_folder_get_folder (CamelFolder *folder, GString *folder_name); +static gboolean __camel_folder_create (CamelFolder *folder); static gboolean __camel_folder_delete (CamelFolder *folder, gboolean recurse); -static gboolean __camel_folder_delete_messages(CamelFolder *folder); +static gboolean __camel_folder_delete_messages (CamelFolder *folder); static CamelFolder *__camel_folder_get_parent_folder (CamelFolder *folder); static CamelStore *__camel_folder_get_parent_store (CamelFolder *folder); -static CamelFolderOpenMode __camel_folder_get_mode(CamelFolder *folder); -static GList *__camel_folder_list_subfolders(CamelFolder *folder); +static CamelFolderOpenMode __camel_folder_get_mode (CamelFolder *folder); +static GList *__camel_folder_list_subfolders (CamelFolder *folder); +static GList *__camel_folder_expunge (CamelFolder *folder); static void camel_folder_class_init (CamelFolderClass *camel_folder_class) @@ -72,7 +73,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) camel_folder_class->get_parent_store = __camel_folder_get_parent_store; camel_folder_class->get_mode = __camel_folder_get_mode; camel_folder_class->list_subfolders = __camel_folder_list_subfolders; - + camel_folder_class->expunge = __camel_folder_expunge; /* virtual method overload */ } @@ -153,8 +154,8 @@ __camel_folder_open(CamelFolder *folder, CamelFolderOpenMode mode) static void __camel_folder_close(CamelFolder *folder, gboolean expunge) { -#warning implement the expunge flag - folder->open_state = FOLDER_CLOSE; + if (expunge) CF_CLASS(folder)->expunge(folder); + folder->open_state = FOLDER_CLOSE; } @@ -616,9 +617,42 @@ __camel_folder_list_subfolders(CamelFolder *folder) } +/** + * camel_folder_list_subfolders: list subfolders in a folder + * @folder: the folder + * + * List subfolders in a folder. + * + * Return value: list of subfolders + **/ GList * camel_folder_list_subfolders(CamelFolder *folder) { return CF_CLASS(folder)->list_subfolders(folder); } + + + +static GList * +__camel_folder_expunge(CamelFolder *folder) +{ + return NULL; +} + + +/** + * camel_folder_expunge: physically delete messages marked as DELETED + * @folder: the folder + * + * Delete messages which have been marked as deleted. + * + * + * Return value: list of expunged message objects. + **/ +GList * +camel_folder_expunge(CamelFolder *folder) +{ + return CF_CLASS(folder)->expunge(folder); +} + diff --git a/camel/camel-folder.h b/camel/camel-folder.h index 7a12bc0c9f..8d4a9f4aef 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -97,7 +97,7 @@ typedef struct { CamelStore * (*get_parent_store) (CamelFolder *folder); CamelFolderOpenMode (*get_mode) (CamelFolder *folder); GList * (*list_subfolders) (CamelFolder *folder); - + GList * (*expunge) (CamelFolder *folder); } CamelFolderClass; @@ -114,6 +114,8 @@ gboolean camel_folder_delete_messages (CamelFolder *folder); CamelFolder *camel_folder_get_parent_folder (CamelFolder *folder); CamelStore *camel_folder_get_parent_store (CamelFolder *folder); CamelFolderOpenMode camel_folder_get_mode(CamelFolder *folder); +GList *camel_folder_list_subfolders(CamelFolder *folder); +GList *camel_folder_expunge(CamelFolder *folder); diff --git a/camel/camel-service.c b/camel/camel-service.c index 970957e4b1..e843826a81 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -33,6 +33,7 @@ static void __camel_service_connect_to_with_login_passwd(CamelService *service, static void __camel_service_connect_to_with_login_passwd_port(CamelService *service, GString *host, GString *login, GString *passwd, guint port); static gboolean __camel_service_is_connected(CamelService *service); static void __camel_service_set_connected(CamelService *service, gboolean state); +static GString *__camel_service_get_url(CamelService *service); static void camel_service_class_init (CamelServiceClass *camel_service_class) @@ -45,7 +46,7 @@ camel_service_class_init (CamelServiceClass *camel_service_class) camel_service_class->connect_to_with_login_passwd_port = __camel_service_connect_to_with_login_passwd_port; camel_service_class->is_connected = __camel_service_is_connected; camel_service_class->set_connected = __camel_service_set_connected; - + camel_service_class->get_url = __camel_service_get_url; /* virtual method overload */ } @@ -96,7 +97,7 @@ camel_service_get_type (void) static void __camel_service_connect(CamelService *service) { - + CSERV_CLASS(service)->set_connected(service, TRUE); } @@ -115,6 +116,8 @@ camel_service_connect(CamelService *service) CSERV_CLASS(service)->connect(service); } + + /** * __camel_service_connect_to: connect to the specified address * @@ -129,10 +132,28 @@ camel_service_connect(CamelService *service) static void __camel_service_connect_to_with_login_passwd(CamelService *service, GString *host, GString *login, GString *passwd) { - __camel_service_set_connected(service, TRUE); + CSERV_CLASS(service)->set_connected(service, TRUE); +} + +/** + * camel_service_connect_to_with_login_passwd: connect a service + * @service: the service to connect + * @host: host to connect to + * @login: login to connect with + * @passwd: password to connect with + * + * Connect to a service, but do not use the session + * default parameters to retrieve server's address + * + **/ +void +camel_service_connect_to_with_login_passwd(CamelService *service, GString *host, GString *login, GString *passwd) +{ + CSERV_CLASS(service)->connect_to_with_login_passwd (service, host, login, passwd); } + /** * __camel_service_connect_to:login:password : connect to the specified address * @@ -149,7 +170,26 @@ __camel_service_connect_to_with_login_passwd(CamelService *service, GString *hos static void __camel_service_connect_to_with_login_passwd_port(CamelService *service, GString *host, GString *login, GString *passwd, guint port) { - __camel_service_set_connected(service, TRUE); + CSERV_CLASS(service)->set_connected(service, TRUE); +} + + +/** + * camel_service_connect_to_with_login_passwd_port: connect a service + * @service: the service to connect + * @host: host to connect to + * @login: login to connect with + * @passwd: password to connect with + * @port: port to connect to + * + * Connect to a service, but do not use the session + * default parameters to retrieve server's address + * + **/ +void +camel_service_connect_to_with_login_passwd_port(CamelService *service, GString *host, GString *login, GString *passwd, guint port) +{ + CSERV_CLASS(service)->connect_to_with_login_passwd_port (service, host, login, passwd, port); } @@ -170,6 +210,22 @@ __camel_service_is_connected(CamelService *service) /** + * camel_service_is_connected: test if a service object is connected + * + * @service: the service + * + * + * + * Return value: TRUE is the service is connected + **/ +gboolean +camel_service_is_connected(CamelService *service) +{ + return CSERV_CLASS(service)->is_connected(service); +} + + +/** * __camel_service_set_connected: set the connected state * * This routine has to be called by providers to set the @@ -187,3 +243,35 @@ __camel_service_set_connected(CamelService *service, gboolean state) } + +/** + * __camel_service_get_url: get url representing a service + * @service: the service + * + * This method merely returns the "url" field. Subclasses + * may provide more active implementations. + * + * Return value: + **/ +static GString * +__camel_service_get_url(CamelService *service) +{ + return service->url; +} + +/** + * camel_service_get_url: get the url representing a service + * @service: the service + * + * returns the URL representing a service. For security reasons + * This routine may not always return the password. + * + * Return value: the url name + **/ +GString * +camel_service_get_url(CamelService *service) +{ + return CSERV_CLASS(service)->get_url(service); +} + + diff --git a/camel/camel-service.h b/camel/camel-service.h index 1dc959e4ec..d22f97a6bc 100644 --- a/camel/camel-service.h +++ b/camel/camel-service.h @@ -53,12 +53,12 @@ typedef struct { typedef struct { GtkObjectClass parent_class; - void (*connect) (CamelService *service); - void (*connect_to_with_login_passwd) (CamelService *service, GString *host, GString *login, GString *passwd); - void (*connect_to_with_login_passwd_port) (CamelService *service, GString *host, GString *login, GString *passwd, guint port); - gboolean (*is_connected) (CamelService *service); - void (*set_connected) (CamelService *service, gboolean state); - + void (*connect) (CamelService *service); + void (*connect_to_with_login_passwd) (CamelService *service, GString *host, GString *login, GString *passwd); + void (*connect_to_with_login_passwd_port) (CamelService *service, GString *host, GString *login, GString *passwd, guint port); + gboolean (*is_connected) (CamelService *service); + void (*set_connected) (CamelService *service, gboolean state); + GString * (*get_url) (CamelService *service); } CamelServiceClass; @@ -66,8 +66,11 @@ typedef struct { /* public methods */ -void camel_service_connect(CamelService *service); - +void camel_service_connect (CamelService *service); +gboolean camel_service_is_connected (CamelService *service); +void camel_service_connect_to_with_login_passwd (CamelService *service, GString *host, GString *login, GString *passwd); +void camel_service_connect_to_with_login_passwd_port (CamelService *service, GString *host, GString *login, GString *passwd, guint port); +GString *camel_service_get_url(CamelService *service); /* Standard Gtk function */ GtkType camel_service_get_type (void); |