* fix for the crash in NB#74605
[modest] / src / modest-protocol-info.h
index 6683536..9ddc12b 100644 (file)
@@ -35,7 +35,9 @@
 
 G_BEGIN_DECLS
 
+/** Transport and Store protocols. */
 typedef enum {
+       MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN,
        MODEST_PROTOCOL_TRANSPORT_SENDMAIL,
        MODEST_PROTOCOL_TRANSPORT_SMTP,
 
@@ -44,7 +46,8 @@ typedef enum {
        MODEST_PROTOCOL_STORE_MAILDIR,
        MODEST_PROTOCOL_STORE_MBOX
 } ModestTransportStoreProtocol;
-       
+
+/** Secure connection methods. */
 typedef enum {    
        MODEST_PROTOCOL_CONNECTION_NORMAL,
        MODEST_PROTOCOL_CONNECTION_SSL,   
@@ -52,26 +55,31 @@ typedef enum {
        MODEST_PROTOCOL_CONNECTION_TLS_OP
 } ModestConnectionProtocol;
 
+/** Secure authentication methods. */
 typedef enum {    
        MODEST_PROTOCOL_AUTH_NONE,
        MODEST_PROTOCOL_AUTH_PASSWORD,
        MODEST_PROTOCOL_AUTH_CRAMMD5
 } ModestAuthProtocol;
 
-typedef enum {
-       MODEST_TRANSPORT_STORE_PROTOCOL,
-       MODEST_CONNECTION_PROTOCOL,
-       MODEST_AUTH_PROTOCOL
-} ModestProtocolType;
 
 
-typedef guint ModestProtocol;
 
-#define MODEST_PROTOCOL_UNKNOWN 666
+/**
+ * modest_protocol_info_get_transport_store_protocol_pair_list:
+ * 
+ * return the list of <protocol,display-name>-tupels of protocols.
+ * The elements of the returned list are ModestPairs
+ * This is a convenience function for use with ModestComboBox
+ *  
+ * Returns: a list of protocols. After use, it should be freed
+ * with modest_pair_list_free
+ */
+ModestPairList*
+modest_protocol_info_get_transport_store_protocol_pair_list ();
 
 /**
- * modest_protocol_info_get_protocol_pair_list:
- * @proto_type: the type of protocol you want to have
+ * modest_protocol_info_get_auth_protocol_pair_list:
  * 
  * return the list of <protocol,display-name>-tupels of protocols.
  * The elements of the returned list are ModestPairs
@@ -80,44 +88,82 @@ typedef guint ModestProtocol;
  * Returns: a list of protocols. After use, it should be freed
  * with modest_pair_list_free
  */
-ModestPairList*   modest_protocol_info_get_protocol_pair_list (ModestProtocolType proto_type);
+ModestPairList* modest_protocol_info_get_auth_protocol_pair_list (void);
+
 
 /**
- * modest_protocol_info_get_protocol_type:
- * @name: the name of the  ModestProtocol
- * @proto_type: the type of protocol you want to have
+ * modest_protocol_info_get_connection_protocol_pair_list:
+ * 
+ * return the list of <protocol,display-name>-tupels of protocols.
+ * The elements of the returned list are ModestPairs
+ * This is a convenience function for use with ModestComboBox
+ *  
+ * Returns: a list of protocols. After use, it should be freed
+ * with modest_pair_list_free
+ */
+ModestPairList* modest_protocol_info_get_connection_protocol_pair_list (void);
+       
+       
+/**
+ * modest_protocol_info_get_transport_store_protocol:
+ * @name: the name of the  #ModestTransportStoreProtocol
  *
  * return the id of the protocol with the given name
  *  
- * Returns: the id of the protocol or MODEST_PROTOCOL_UNKNOWN
+ * Returns: the id of the protocol or MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN
+ */
+ModestTransportStoreProtocol modest_protocol_info_get_transport_store_protocol (const gchar* name);
+
+/**
+ * modest_protocol_info_get_auth_protocol:
+ * @name: The name of the #ModestAuthProtocol
+ *
+ * Returns the ID of the protocol with the given name
+ *
+ * Returns: The ID of the protocol or MODEST_PROTOCOL_AUTH_NONE
  */
-ModestProtocol modest_protocol_info_get_protocol (const gchar* name, ModestProtocolType proto_type);
+ModestAuthProtocol modest_protocol_info_get_auth_protocol (const gchar* name);
 
 /**
- * modest_protocol_info_get_protocol_name:
+ * modest_protocol_info_get_transport_store_protocol_name:
  * @proto: the protocol you are looking for
- * @proto_type: the type of protocol you want to have
  * 
- * return the string id of the proto (such as "imap", or "tls")
+ * return the string id of the proto (such as "imap", or "smtp")
  *  
  * 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,
-                                                    ModestProtocolType proto_type);
+const gchar* modest_protocol_info_get_transport_store_protocol_name (ModestTransportStoreProtocol proto);
 
 /**
- * modest_protocol_info_get_protocol_display_name:
+ * modest_protocol_info_get_auth_protocol_name:
  * @proto: the protocol you are looking for
- * @proto_type: the type of protocol you want to have
- *
- * 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_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
  */
-const gchar* modest_protocol_info_get_protocol_display_name (ModestProtocol proto,
-                                                            ModestProtocolType proto_type);
+ModestPairList* modest_protocol_info_get_auth_protocol_pair_list (void);
 
+/**
+ * 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);
 
 
 /**
@@ -144,6 +190,29 @@ gboolean modest_protocol_info_protocol_is_store (ModestTransportStoreProtocol pr
 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
 #endif /* __MODEST_PROTOCOL_INFO_H__ */