Changeset 3612

Show
Ignore:
Timestamp:
04/22/08 13:00:40
Author:
pvanhoof
Message:
        • Support for value-less cameloptions
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3609 r3612  
    44        * tny_camel_account_clear_options added 
    55        * tny_camel_account_get_options added 
     6        * Support for value-less cameloptions 
    67 
    78        * This was a major API change in libtinymail-camel 
  • trunk/libtinymail-camel/tny-camel-account.c

    r3609 r3612  
    444444 * <informalexample><programlisting> 
    445445 * tny_camel_account_add_option (account, tny_pair_new ("use_ssl", "tls")) 
     446 * </programlisting></informalexample> 
     447 * 
     448 * If the Camel option is a single word, just use "" for the value part of the  
     449 * pair: 
     450 * 
     451 * <informalexample><programlisting> 
     452 * tny_camel_account_add_option (account, tny_pair_new ("use_lsub", "")) 
    446453 * </programlisting></informalexample> 
    447454 * 
     
    489496        GList *copy = priv->options; 
    490497        gboolean found = FALSE; 
    491         gchar *option_str
     498        gchar *option_str, *val
    492499 
    493500        if (!option) 
     
    501508        g_assert (TNY_IS_PAIR (option)); 
    502509 
    503         option_str = g_strdup_printf ("%s=%s", 
    504                 tny_pair_get_name (option),  
    505                 tny_pair_get_value (option)); 
     510        val = (gchar *) tny_pair_get_value (option); 
     511 
     512        if (val && strlen (val) > 0) 
     513                option_str = g_strdup_printf ("%s=%s", 
     514                        tny_pair_get_name (option),  
     515                        tny_pair_get_value (option)); 
     516        else 
     517                option_str = g_strdup_printf ("%s", 
     518                        tny_pair_get_name (option)); 
    506519 
    507520        while (copy)  { 
     
    558571                TnyPair *pair; 
    559572 
    560                 *value = '\0'; 
    561                 value++; 
     573                if (value) { 
     574                        *value = '\0'; 
     575                        value++; 
     576                } else  
     577                        value = ""; 
    562578 
    563579                pair = tny_pair_new (key, value); 
  • trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c

    r3609 r3612  
    252252                                        gchar *key = options->data; 
    253253                                        gchar *value = strchr (options->data, '='); 
    254                                         *value = '\0'; 
    255                                         value++; 
     254 
     255                                        if (value) { 
     256                                                *value = '\0'; 
     257                                                value++; 
     258                                        } else 
     259                                                value = ""; 
    256260 
    257261                                        tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account),  
  • trunk/libtinymail-gpe/tny-gpe-account-store.c

    r3609 r3612  
    252252                                        gchar *key = options->data; 
    253253                                        gchar *value = strchr (options->data, '='); 
    254                                         *value = '\0'; 
    255                                         value++; 
     254 
     255                                        if (value) { 
     256                                                *value = '\0'; 
     257                                                value++; 
     258                                        } else 
     259                                                value = ""; 
    256260 
    257261                                        tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account),  
  • trunk/libtinymail-maemo/tny-maemo-account-store.c

    r3609 r3612  
    259259                                        gchar *key = options->data; 
    260260                                        gchar *value = strchr (options->data, '='); 
    261                                         *value = '\0'; 
    262                                         value++; 
     261 
     262                                        if (value) { 
     263                                                *value = '\0'; 
     264                                                value++; 
     265                                        } else 
     266                                                value = ""; 
    263267 
    264268                                        tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account),  
  • trunk/libtinymail-olpc/tny-olpc-account-store.c

    r3609 r3612  
    223223                                        gchar *key = options[i]; 
    224224                                        gchar *value = strchr (options[i], '='); 
    225                                         *value = '\0'; 
    226                                         value++; 
     225 
     226                                        if (value) { 
     227                                                *value = '\0'; 
     228                                                value++; 
     229                                        } else 
     230                                                value = ""; 
     231 
    227232                                        tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (account),  
    228233                                                tny_pair_new (key, value));