* small correctness fixes
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 19 Jan 2007 12:29:03 +0000 (12:29 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 19 Jan 2007 12:29:03 +0000 (12:29 +0000)
pmo-trunk-r672

src/modest-protocol-info.c
src/modest-tny-account-store.c

index 4856897..125c418 100644 (file)
@@ -120,9 +120,9 @@ modest_protocol_info_get_protocol_type (ModestProtocol proto)
        case MODEST_PROTOCOL_AUTH_NONE:
        case MODEST_PROTOCOL_AUTH_PASSWORD:
                return MODEST_PROTOCOL_TYPE_AUTH;
-
+               
        default:
-               g_return_val_if_reached (MODEST_PROTOCOL_TYPE_UNKNOWN);
+               return MODEST_PROTOCOL_TYPE_UNKNOWN;
        }
 }
 
index a3d588f..17c549d 100644 (file)
@@ -312,14 +312,14 @@ tny_account_for_proto (ModestProtocol proto)
        TnyAccount *tny_account = NULL;
        
        type  = modest_protocol_info_get_protocol_type (proto);
-
+       
        if (type == MODEST_PROTOCOL_TYPE_TRANSPORT) 
                tny_account = TNY_ACCOUNT(tny_camel_transport_account_new ());
        else if (proto == MODEST_PROTOCOL_STORE_POP)
                tny_account = TNY_ACCOUNT(tny_camel_pop_store_account_new ());
        else if (proto == MODEST_PROTOCOL_STORE_IMAP)
                tny_account = TNY_ACCOUNT(tny_camel_imap_store_account_new ());
-       else
+       else 
                g_return_val_if_reached (NULL);
        
        if (tny_account)
@@ -348,6 +348,12 @@ get_tny_account_from_server_account (ModestTnyAccountStore *self,
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
        
        /* proto */
+       if (account_data->proto == MODEST_PROTOCOL_UNKNOWN) {
+               g_printerr ("modest: '%s' does not provide a protocol\n",
+                           account_data->account_name);
+               return NULL;
+       }
+               
        tny_account = tny_account_for_proto (account_data->proto);
        if (!tny_account) {
                g_printerr ("modest: could not create tny account for '%s'\n",
@@ -506,8 +512,6 @@ get_tny_account_from_account (ModestTnyAccountStore *self, ModestAccountData *ac
                server_account = account_data->store_account;
        else if (type == TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS && account_data->transport_account)
                server_account = account_data->transport_account;
-       else
-               g_return_val_if_reached (NULL);
        
        if (!server_account) {
                g_printerr ("modest: no %s account defined for '%s'\n",