+2007-08-29 Armin Burgmeier <armin@openismus.com>
+
+ * src/modest-protocol-info.h:
+ * src/modest-protocol-info.c: Added
+ modest_protocol_info_get_auth_protocol() to translate an
+ authentication protocol name to the corresponding enum value.
+
+ * src/maemo/modest-maemo-utils.c: Fixed supported auth protocol list
+ generation using the newly added function.
+
+ * src/maemo/modest-account-settings-dialog.c: Use the current element
+ when traversing through the list of supported authentication methods,
+ not always the first.
+
2007-08-29 Murray Cumming <murrayc@murrayc.com>
* src/maemo/easysetup/modest-easysetup-wizard.c:
GList* method;
for (method = list_auth_methods; method != NULL; method = g_list_next(method))
{
- ModestAuthProtocol proto = (ModestAuthProtocol)(GPOINTER_TO_INT(list_auth_methods->data));
+ ModestAuthProtocol proto = (ModestAuthProtocol)(GPOINTER_TO_INT(method->data));
// Allow secure methods, e.g MD5 only
if (modest_protocol_info_auth_is_secure(proto))
{
}
printf("DEBUG: %s: auth_name=%s\n", __FUNCTION__, auth_name);
- ModestPair *matching = modest_pair_list_find_by_first_as_string (pairs,
- auth_name);
- if (matching)
- {
- result = g_list_append (result, GINT_TO_POINTER((ModestConnectionProtocol)matching->first));
- }
+
+ ModestAuthProtocol proto = modest_protocol_info_get_auth_protocol (auth_name);
+ if(proto != MODEST_PROTOCOL_AUTH_NONE)
+ result = g_list_prepend(result, GINT_TO_POINTER(proto));
+
tny_iterator_next(iter);
}
g_object_unref (iter);
{ MODEST_PROTOCOL_AUTH_CRAMMD5, MODEST_ACCOUNT_AUTH_MECH_VALUE_CRAMMD5, N_("Cram MD5") }
};
-
static ModestPairList*
get_protocol_pair_list (const ProtocolInfo* map, guint size)
{
return proto_list;
}
+static gint
+get_protocol_by_name (const ProtocolInfo* map,
+ guint size,
+ const gchar* query_name,
+ gint default_value,
+ gboolean case_sensitive)
+{
+ guint i;
+
+ g_return_val_if_fail (map, default_value);
+
+ for(i = 0; i < size; ++i)
+ {
+ if((case_sensitive && strcmp(map[i].name, query_name) == 0) ||
+ (!case_sensitive && g_ascii_strcasecmp(map[i].name, query_name) == 0))
+ {
+ return map[i].proto;
+ }
+ }
+
+ return default_value;
+}
ModestPairList*
modest_protocol_info_get_transport_store_protocol_pair_list ()
G_N_ELEMENTS(ConnectionProtocolMap));
}
-
ModestTransportStoreProtocol
modest_protocol_info_get_transport_store_protocol (const gchar* name)
{
- const ProtocolInfo *map = TransportStoreProtocolMap;
- const guint size = G_N_ELEMENTS(TransportStoreProtocolMap);
- int i;
-
- g_return_val_if_fail (name, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
-
- g_return_val_if_fail (map, MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN);
-
- for (i = 0; i != size; ++i) {
- const ProtocolInfo info = map[i];
- if (strcmp(name, info.name) == 0)
- return info.proto;
- }
-
- return MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN;
+ return get_protocol_by_name(TransportStoreProtocolMap,
+ G_N_ELEMENTS(TransportStoreProtocolMap),
+ name,
+ MODEST_PROTOCOL_TRANSPORT_STORE_UNKNOWN,
+ TRUE);
}
+ModestAuthProtocol
+modest_protocol_info_get_auth_protocol (const gchar* name)
+{
+ return get_protocol_by_name(AuthProtocolMap,
+ G_N_ELEMENTS(AuthProtocolMap),
+ name,
+ MODEST_PROTOCOL_AUTH_NONE,
+ FALSE);
+}
/* get either the name or the display_name for the protocol */
/**
* modest_protocol_info_get_transport_store_protocol:
- * @name: the name of the ModestTransportStoreProtocol
- * @proto_type: the type of protocol you want to have
+ * @name: the name of the #ModestTransportStoreProtocol
*
* return the id of the protocol with the given name
*
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
+ */
+ModestAuthProtocol
+modest_protocol_info_get_auth_protocol (const gchar* name);
+
+/**
* modest_protocol_info_get_transport_store_protocol_name:
* @proto: the protocol you are looking for
*