}
-static ModestSecureAuthentication
+static ModestAuthProtocol
get_secure_auth_for_conf_string(const gchar* value)
{
- ModestSecureAuthentication result = MODEST_PROTOCOL_AUTH_NONE;
+ ModestAuthProtocol result = MODEST_PROTOCOL_AUTH_NONE;
if (value) {
if (strcmp(value, MODEST_ACCOUNT_AUTH_MECH_VALUE_NONE) == 0)
result = MODEST_PROTOCOL_AUTH_NONE;
return result;
}
-ModestSecureAuthentication
+ModestAuthProtocol
modest_server_account_get_secure_auth (ModestAccountMgr *self,
const gchar* account_name)
{
- ModestSecureAuthentication result = MODEST_PROTOCOL_AUTH_NONE;
+ ModestAuthProtocol result = MODEST_PROTOCOL_AUTH_NONE;
gchar* value = modest_account_mgr_get_string (self, account_name, MODEST_ACCOUNT_AUTH_MECH,
TRUE /* server account */);
if (value) {
void
modest_server_account_set_secure_auth (ModestAccountMgr *self,
- const gchar* account_name, ModestSecureAuthentication secure_auth)
+ const gchar* account_name, ModestAuthProtocol secure_auth)
{
/* Get the conf string for the enum value: */
const gchar* str_value = NULL;
modest_account_mgr_set_string (self, account_name, MODEST_ACCOUNT_AUTH_MECH, str_value, TRUE);
}
-static ModestSecureConnection
+static ModestConnectionProtocol
get_security_for_conf_string(const gchar* value)
{
- ModestSecureConnection result = MODEST_PROTOCOL_SECURITY_NONE;
+ ModestConnectionProtocol result = MODEST_PROTOCOL_CONNECTION_NORMAL;
if (value) {
if (strcmp(value, MODEST_ACCOUNT_SECURITY_VALUE_NONE) == 0)
- result = MODEST_PROTOCOL_SECURITY_NONE;
+ result = MODEST_PROTOCOL_CONNECTION_NORMAL;
else if (strcmp(value, MODEST_ACCOUNT_SECURITY_VALUE_NORMAL) == 0)
- result = MODEST_PROTOCOL_SECURITY_TLS;
+ result = MODEST_PROTOCOL_CONNECTION_TLS;
else if (strcmp(value, MODEST_ACCOUNT_SECURITY_VALUE_SSL) == 0)
- result = MODEST_PROTOCOL_SECURITY_SSL;
+ result = MODEST_PROTOCOL_CONNECTION_SSL;
}
return result;
}
-ModestSecureConnection
+ModestConnectionProtocol
modest_server_account_get_security (ModestAccountMgr *self,
const gchar* account_name)
{
- ModestSecureConnection result = MODEST_PROTOCOL_SECURITY_NONE;
+ ModestConnectionProtocol result = MODEST_PROTOCOL_CONNECTION_NORMAL;
gchar* value = modest_account_mgr_get_string (self, account_name, MODEST_ACCOUNT_SECURITY,
TRUE /* server account */);
if (value) {
void
modest_server_account_set_security (ModestAccountMgr *self,
- const gchar* account_name, ModestSecureConnection security)
+ const gchar* account_name, ModestConnectionProtocol security)
{
/* Get the conf string for the enum value: */
const gchar* str_value = NULL;
- if (security == MODEST_PROTOCOL_SECURITY_NONE)
+ if (security == MODEST_PROTOCOL_CONNECTION_NORMAL)
str_value = MODEST_ACCOUNT_SECURITY_VALUE_NONE;
- else if (security == MODEST_PROTOCOL_SECURITY_TLS)
+ else if (security == MODEST_PROTOCOL_CONNECTION_TLS)
str_value = MODEST_ACCOUNT_SECURITY_VALUE_NORMAL;
- else if (security == MODEST_PROTOCOL_SECURITY_SSL)
+ else if (security == MODEST_PROTOCOL_CONNECTION_SSL)
str_value = MODEST_ACCOUNT_SECURITY_VALUE_SSL;
/* Set it in the configuration: */
data->hostname = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_HOSTNAME,TRUE);
data->username = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_USERNAME,TRUE);
proto = modest_account_mgr_get_string (self, name, MODEST_ACCOUNT_PROTO, TRUE);
- data->proto = modest_protocol_info_get_protocol (proto);
+ data->proto = modest_protocol_info_get_protocol (proto, MODEST_TRANSPORT_STORE_PROTOCOL);
g_free (proto);
data->port = modest_account_mgr_get_int (self, name, MODEST_ACCOUNT_PORT, TRUE);
gchar *password;
time_t last_updated;
gint port; /* Or 0, if the default should be used. */
- ModestSecureAuthentication secure_auth;
- ModestSecureConnection security;
+ ModestAuthProtocol secure_auth;
+ ModestConnectionProtocol security;
} ModestServerAccountData;
typedef struct {
*
* Returns: The secure authentication enum value.
*/
-ModestSecureAuthentication
+ModestAuthProtocol
modest_server_account_get_secure_auth (ModestAccountMgr *self, const gchar* account_name);
/**
*/
void
modest_server_account_set_secure_auth (ModestAccountMgr *self, const gchar* account_name,
- ModestSecureAuthentication secure_auth);
+ ModestAuthProtocol secure_auth);
/**
* modest_server_account_data_get_security:
*
* Returns: The security enum value.
*/
-ModestSecureConnection
+ModestConnectionProtocol
modest_server_account_get_security (ModestAccountMgr *self, const gchar* account_name);
/**
*/
void
modest_server_account_set_security (ModestAccountMgr *self, const gchar* account_name,
- ModestSecureConnection security);
+ ModestConnectionProtocol security);
ModestServerAccountData*
modest_account_mgr_get_server_account_data (ModestAccountMgr *self, const gchar* name);
const gchar * name, const gchar *hostname,
const gchar * username, const gchar * password,
ModestProtocol proto,
- ModestSecureConnection security,
- ModestSecureAuthentication auth)
+ ModestConnectionProtocol security,
+ ModestAuthProtocol auth)
{
ModestAccountMgrPrivate *priv;
gchar *key;
- ModestProtocolType proto_type;
gboolean ok = TRUE;
GError *err = NULL;
g_return_val_if_fail (MODEST_IS_ACCOUNT_MGR(self), FALSE);
g_return_val_if_fail (name, FALSE);
g_return_val_if_fail (strchr(name, '/') == NULL, FALSE);
-
- proto_type = modest_protocol_info_get_protocol_type (proto);
- g_return_val_if_fail (proto_type == MODEST_PROTOCOL_TYPE_TRANSPORT ||
- proto_type == MODEST_PROTOCOL_TYPE_STORE, FALSE);
priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
/* proto */
key = _modest_account_mgr_get_account_keyname (name, MODEST_ACCOUNT_PROTO, TRUE);
ok = modest_conf_set_string (priv->modest_conf, key,
- modest_protocol_info_get_protocol_name(proto), &err);
+ modest_protocol_info_get_protocol_name(proto,
+ MODEST_TRANSPORT_STORE_PROTOCOL),
+ &err);
if (err) {
g_printerr ("modest: failed to set %s: %s\n", key, err->message);
g_error_free (err);
/* auth mechanism */
key = _modest_account_mgr_get_account_keyname (name, MODEST_ACCOUNT_AUTH_MECH, TRUE);
ok = modest_conf_set_string (priv->modest_conf, key,
- modest_protocol_info_get_protocol_name (auth), &err);
+ modest_protocol_info_get_protocol_name (auth,
+ MODEST_AUTH_PROTOCOL),
+ &err);
if (err) {
g_printerr ("modest: failed to set %s: %s\n", key, err->message);
g_error_free (err);
g_free (key);
if (!ok)
goto cleanup;
-
- if (proto_type == MODEST_PROTOCOL_TYPE_STORE) {
+
+ if (modest_protocol_info_protocol_is_store(proto)) {
/* Add the security settings: */
modest_server_account_set_security (self, name, security);
}
-
+
cleanup:
if (!ok) {
g_printerr ("modest: failed to add server account\n");
/* proto */
key = _modest_account_mgr_get_account_keyname (name, MODEST_ACCOUNT_PROTO, TRUE);
ok = modest_conf_set_string (priv->modest_conf, key,
- modest_protocol_info_get_protocol_name(proto), NULL);
+ modest_protocol_info_get_protocol_name(proto, MODEST_TRANSPORT_STORE_PROTOCOL),
+ NULL);
g_free (key);
if (!ok) {
GError *err = NULL;
g_return_val_if_fail (self, NULL);
-
- if (proto != MODEST_PROTOCOL_UNKNOWN) {
- ModestProtocolType proto_type;
- proto_type = modest_protocol_info_get_protocol_type (proto);
- g_return_val_if_fail (proto_type == MODEST_PROTOCOL_TYPE_TRANSPORT ||
- proto_type == MODEST_PROTOCOL_TYPE_STORE, NULL);
- }
key = _modest_account_mgr_get_account_keyname (account_name, NULL, TRUE);
priv = MODEST_ACCOUNT_MGR_GET_PRIVATE (self);
while (cursor) {
gchar *account = _modest_account_mgr_account_from_key ((gchar*)cursor->data, NULL, NULL);
gchar *acc_proto = modest_account_mgr_get_string (self, account, MODEST_ACCOUNT_PROTO,TRUE);
- ModestProtocol this_proto = modest_protocol_info_get_protocol (acc_proto);
- ModestProtocolType this_type = modest_protocol_info_get_protocol_type (this_proto);
-
- if ((this_type != MODEST_PROTOCOL_TYPE_UNKNOWN && this_type != type) ||
- (this_proto != MODEST_PROTOCOL_UNKNOWN && this_proto != proto)) {
+ ModestProtocol this_proto = modest_protocol_info_get_protocol (acc_proto,
+ MODEST_TRANSPORT_STORE_PROTOCOL);
+ if (this_proto != MODEST_PROTOCOL_UNKNOWN && this_proto != proto) {
GSList *nxt = cursor->next;
accounts = g_slist_delete_link (accounts, cursor);
cursor = nxt;
typedef struct _ModestAccountMgr ModestAccountMgr;
typedef struct _ModestAccountMgrClass ModestAccountMgrClass;
-
struct _ModestAccountMgr {
GObject parent;
};
const gchar *username,
const gchar *password,
ModestProtocol proto,
- ModestSecureConnection security,
- ModestSecureAuthentication auth);
+ ModestConnectionProtocol security,
+ ModestAuthProtocol auth);
/**
/* Proto */
tny_account_set_proto (tny_account,
- modest_protocol_info_get_protocol_name(account_data->proto));
+ modest_protocol_info_get_protocol_name(account_data->proto,
+ MODEST_TRANSPORT_STORE_PROTOCOL));
/* mbox and maildir accounts use a URI instead of the rest: */
/* Enable secure connection settings: */
const gchar* option_security = NULL;
switch (account_data->security) {
- case MODEST_PROTOCOL_SECURITY_NONE:
+ case MODEST_PROTOCOL_CONNECTION_NORMAL:
option_security = MODEST_ACCOUNT_OPTION_SSL "= " MODEST_ACCOUNT_OPTION_SSL_NEVER;
break;
- case MODEST_PROTOCOL_SECURITY_SSL:
- case MODEST_PROTOCOL_SECURITY_TLS:
+ case MODEST_PROTOCOL_CONNECTION_SSL:
+ case MODEST_PROTOCOL_CONNECTION_TLS:
option_security = MODEST_ACCOUNT_OPTION_SSL "= " MODEST_ACCOUNT_OPTION_SSL_ALWAYS;;
break;
- case MODEST_PROTOCOL_SECURITY_TLS_OP:
+ case MODEST_PROTOCOL_CONNECTION_TLS_OP:
option_security = MODEST_ACCOUNT_OPTION_SSL "= " MODEST_ACCOUNT_OPTION_SSL_WHEN_POSSIBLE;
break;
default:
tny_account_set_secure_auth_mech (tny_account, auth_mech_name);
}
- if (account_data->proto == MODEST_PROTOCOL_TYPE_STORE) {
+ if (modest_protocol_info_protocol_is_store(account_data->proto)) {
/* Other connection options. Some options are only valid for IMAP
accounts but it's OK for just now since POP is still not
supported */
if (!account)
return -1; /* no account: nothing is allowed */
- proto = modest_protocol_info_get_protocol (
- tny_account_get_proto (account));
+ proto = modest_protocol_info_get_protocol (tny_account_get_proto (account),
+ MODEST_TRANSPORT_STORE_PROTOCOL);
if (proto == MODEST_PROTOCOL_STORE_IMAP) {
rules = 0;