X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-protocol-info.h;h=c358d1d527ebc59afc665355d68b4ccde9b78186;hp=523eef39c1d851209c14233ddf89bb836def5a97;hb=40a8f5cbe03bd040fe3403dbfa6806df4fb6bc8a;hpb=7dd43ed0b3b827799299291a53300db93d9b2711 diff --git a/src/modest-protocol-info.h b/src/modest-protocol-info.h index 523eef3..c358d1d 100644 --- a/src/modest-protocol-info.h +++ b/src/modest-protocol-info.h @@ -17,7 +17,7 @@ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +\ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -31,63 +31,43 @@ #define __MODEST_PROTOCOL_INFO_H__ #include +#include G_BEGIN_DECLS -/* NOTE: be careful to check modest-protocol-info.c - * if you make any changes here */ +/** Transport and Store protocols. */ typedef enum { - MODEST_PROTOCOL_UNKNOWN, - + MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN, MODEST_PROTOCOL_TRANSPORT_SENDMAIL, MODEST_PROTOCOL_TRANSPORT_SMTP, - + MODEST_PROTOCOL_STORE_POP, MODEST_PROTOCOL_STORE_IMAP, MODEST_PROTOCOL_STORE_MAILDIR, MODEST_PROTOCOL_STORE_MBOX -} ModestProtocol; - - -typedef enum { - MODEST_PROTOCOL_TYPE_UNKNOWN, - MODEST_PROTOCOL_TYPE_TRANSPORT, - MODEST_PROTOCOL_TYPE_STORE -} ModestProtocolType; +} ModestTransportStoreProtocol; +/** Secure connection methods. */ typedef enum { - MODEST_PROTOCOL_SECURITY_NONE, - MODEST_PROTOCOL_SECURITY_SSL, - MODEST_PROTOCOL_SECURITY_TLS, - MODEST_PROTOCOL_SECURITY_TLS_OP -} ModestSecureConnection; + MODEST_PROTOCOL_CONNECTION_NORMAL, + MODEST_PROTOCOL_CONNECTION_SSL, + MODEST_PROTOCOL_CONNECTION_TLS, + MODEST_PROTOCOL_CONNECTION_TLS_OP +} ModestConnectionProtocol; +/** Secure authentication methods. */ typedef enum { MODEST_PROTOCOL_AUTH_NONE, MODEST_PROTOCOL_AUTH_PASSWORD, MODEST_PROTOCOL_AUTH_CRAMMD5 -} ModestSecureAuthentication; +} ModestAuthProtocol; -#if 0 -/** - * modest_protocol_info_get_list: - * @type: the type of list you want, it should NOT be MODEST_PROTOCOL_TYPE_UNKNOWN - * - * return the list of protocols of the given @type. - * the elements of the returned list are ModestProtocols (use GPOINTER_TO_INT to get it) - * - * Returns: a list of protocols of the given @type; after use, it should be freed - * with g_slist_free. The elements should not be freed, as there is no memory allocated - * for them. - */ -GSList* modest_protocol_info_get_protocol_list (ModestProtocolType type); -#endif /** - * modest_protocol_info_get_protocol_pair_list: - * + * modest_protocol_info_get_transport_store_protocol_pair_list: + * * return the list of -tupels of protocols. * The elements of the returned list are ModestPairs * This is a convenience function for use with ModestComboBox @@ -95,76 +75,105 @@ GSList* modest_protocol_info_get_protocol_list (ModestProtocolType type); * Returns: a list of protocols. After use, it should be freed * with modest_pair_list_free */ -ModestPairList* modest_protocol_info_get_protocol_pair_list (); +ModestPairList* +modest_protocol_info_get_transport_store_protocol_pair_list (); /** - * modest_protocol_info_get_protocol_security_pair_list: - * - * return the list of -tupels of protocol secure connection methods. + * modest_protocol_info_get_auth_protocol_pair_list: + * + * return the list of -tupels of protocols. * The elements of the returned list are ModestPairs * This is a convenience function for use with ModestComboBox * - * Returns: a list of secure connection methods. After use, it should be freed + * Returns: a list of protocols. After use, it should be freed * with modest_pair_list_free */ -ModestPairList* modest_protocol_info_get_protocol_security_pair_list (); +ModestPairList* +modest_protocol_info_get_auth_protocol_pair_list (); + /** - * modest_protocol_info_get_protocol_auth_pair_list: - * - * return the list of -tupels of protocol secure authentication methods. + * modest_protocol_info_get_connection_protocol_pair_list: + * + * return the list of -tupels of protocols. * The elements of the returned list are ModestPairs * This is a convenience function for use with ModestComboBox * - * Returns: a list of secure authentication methods. After use, it should be freed + * Returns: a list of protocols. After use, it should be freed * with modest_pair_list_free */ -ModestPairList* modest_protocol_info_get_protocol_auth_pair_list (); - - +ModestPairList* +modest_protocol_info_get_connection_protocol_pair_list (); + + /** - * modest_protocol_info_get_protocol_type: - * @proto: the ModestProtocol you'd like to query for its type + * modest_protocol_info_get_transport_store_protocol: + * @name: the name of the ModestTransportStoreProtocol + * @proto_type: the type of protocol you want to have * - * return ModestProtocolType for the protocol + * return the id of the protocol with the given name * - * Returns: the protocol type or MODEST_PROTOCOL_TYPE_UNKNOWN + * Returns: the id of the protocol or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN */ -ModestProtocolType modest_protocol_info_get_protocol_type (ModestProtocol proto); - +ModestTransportStoreProtocol +modest_protocol_info_get_transport_store_protocol (const gchar* name); /** - * modest_protocol_info_get_protocol_type: - * @name: the name of the ModestProtocol - * - * return the id of the protocol with the given name + * modest_protocol_info_get_transport_store_protocol_name: + * @proto: the protocol you are looking for + * + * return the string id of the proto (such as "imap", or "smtp") * - * Returns: the id of the protocol or MODEST_PROTOCOL_UNKNOWN + * Returns: string id of the proto as a constant string, that should NOT be modified or freed */ -ModestProtocol modest_protocol_info_get_protocol (const gchar* name); - +const gchar* +modest_protocol_info_get_transport_store_protocol_name (ModestTransportStoreProtocol proto); /** - * modest_protocol_info_get_protocol_name: + * modest_protocol_info_get_auth_protocol_name: * @proto: the protocol you are looking for - * - * return the string id of the proto (such as "imap", or "tls") + * + * return the string id of the proto (such as "password", or "cram-md5") * * Returns: string id of the proto as a constant string, that should NOT be modified or freed */ -const gchar* modest_protocol_info_get_protocol_name (ModestProtocol proto); +const gchar* +modest_protocol_info_get_auth_protocol_name (ModestAuthProtocol proto); + +/* + * modest_protocol_get_auth_protocol_pair_list: + * + * Get the list of support authentication methods supported by modest including + * the display names of those. + * + * Returns: List of method/display name pairs + */ + +ModestPairList* +modest_protocol_info_get_auth_protocol_pair_list (); /** - * modest_protocol_info_get_protocol_display_name: + * modest_protocol_info_get_auth_protocol_name: * @proto: the protocol you are looking for + * + * return the string id of the proto (such as "ssl", or "tls") + * + * Returns: string id of the proto as a constant string, that should NOT be modified or freed + */ +const gchar* +modest_protocol_info_get_connection_protocol_name (ModestAuthProtocol proto); + + +/** + * modest_protocol_info_protocol_is_local_store: + * @proto: the protocol * - * return the string id of the proto (such as "imap", or "tls") + * is this protocol a store protocol? * - * Returns: string id of the proto as a constant string, that should NOT be modified or freed + * Returns: TRUE if it is a local store, FALSE otherwise * */ -const gchar* modest_protocol_info_get_protocol_display_name (ModestProtocol proto); - +gboolean modest_protocol_info_protocol_is_store (ModestTransportStoreProtocol proto); /** @@ -176,9 +185,30 @@ const gchar* modest_protocol_info_get_protocol_display_name (ModestProtocol prot * Returns: TRUE if it is a local store, FALSE otherwise * */ -gboolean modest_protocol_info_protocol_is_local_store (ModestProtocol proto); +gboolean modest_protocol_info_protocol_is_local_store (ModestTransportStoreProtocol proto); +/** + * modest_protocol_info_is_secure: + * @protocol + * + * is the protocol connection secure (e.g encrypted)? + * + * Returns: TRUE if it is secure, FALSE otherwise + * + */ +gboolean modest_protocol_info_is_secure(ModestConnectionProtocol protocol); + +/** + * modest_protocol_info_auth_is_secure: + * @protocol + * + * is the protocol authentication secure (e.g encrypted)? + * + * Returns: TRUE if it is secure, FALSE otherwise + * + */ +gboolean modest_protocol_info_auth_is_secure(ModestAuthProtocol protocol); G_END_DECLS