Changeset 1383

Show
Ignore:
Timestamp:
01/10/07 02:03:12
Author:
pvanhoof
Message:

POP3 to Maildir implementation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-camel/tny-camel-account-priv.h

    r826 r1383  
    4040        gboolean connected, inuse_spin; 
    4141        gchar *name; GList *options; 
     42        gchar *cache_location; 
    4243        TnyAccountType account_type; 
    4344}; 
  • trunk/libtinymail-camel/tny-camel-account.c

    r1368 r1383  
    573573        TnyCamelAccount *self = (TnyCamelAccount *)instance; 
    574574        TnyCamelAccountPriv *priv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
     575 
     576        priv->cache_location = NULL; 
     577        priv->service = NULL; 
     578        priv->session = NULL; 
     579        priv->url_string = NULL; 
    575580 
    576581        priv->ex = camel_exception_new (); 
     
    690695        g_static_rec_mutex_lock (priv->service_lock); 
    691696 
     697        if (G_LIKELY (priv->cache_location)) 
     698                g_free (priv->cache_location); 
     699 
    692700        if (G_LIKELY (priv->id)) 
    693701                g_free (priv->id); 
  • trunk/libtinymail-camel/tny-camel-folder.c

    r1369 r1383  
    14951495} 
    14961496 
     1497 
    14971498static void 
    14981499tny_camel_folder_transfer_msgs_default (TnyFolder *self, TnyList *headers, TnyFolder *folder_dst, gboolean delete_originals, GError **err) 
     
    15401541        } 
    15411542 
     1543        g_object_unref (G_OBJECT (iter)); 
     1544 
    15421545        ex = camel_exception_new (); 
    15431546        camel_exception_init (ex); 
     
    15631566        camel_exception_free (ex); 
    15641567 
    1565         if (transferred_uids)  
     1568        /* Why don't these delete the arrays with TRUE? */ 
     1569        if (transferred_uids) 
    15661570                g_ptr_array_free (transferred_uids, FALSE); 
    15671571 
     
    15741578} 
    15751579 
    1576  
    15771580void 
    15781581_tny_camel_folder_set_id (TnyCamelFolder *self, const gchar *id) 
    15791582{ 
    1580         TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
    1581  
    1582         g_mutex_lock (priv->folder_lock); 
    1583  
    1584         /* unload_folder_no_lock (priv, TRUE); */ 
    1585  
    1586         if (G_UNLIKELY (priv->folder_name)) 
    1587                 g_free (priv->folder_name); 
    1588  
    1589         priv->folder_name = g_strdup (id); 
    1590  
    1591         g_mutex_unlock (priv->folder_lock); 
    1592  
    1593         return; 
    1594 
    1595  
     1583       TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
     1584 
     1585       g_mutex_lock (priv->folder_lock); 
     1586 
     1587       /* unload_folder_no_lock (priv, TRUE); */ 
     1588 
     1589       if (G_UNLIKELY (priv->folder_name)) 
     1590               g_free (priv->folder_name); 
     1591 
     1592       priv->folder_name = g_strdup (id); 
     1593 
     1594       g_mutex_unlock (priv->folder_lock); 
     1595 
     1596       return; 
     1597
    15961598 
    15971599void 
  • trunk/libtinymail-camel/tny-camel-pop-folder.c

    r1368 r1383  
    5252 
    5353static void  
    54 tny_camel_pop_folder_refresh (TnyFolder *self, GError **err
     54tny_camel_pop_folder_refresh_impl (TnyFolder *self, GError **err, CamelOperationStatusFunc status_func
    5555{ 
    5656        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
    5757        TnyCamelPopStoreAccountPriv *poppriv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (priv->account); 
    58  
    59         /*  
    60          * TODO: Reimplement this one for POP (you have poppriv->inbox) 
    61          * 
    62          * camel_folder_refresh_info (priv->folder, &ex);  
    63          * 
    64          * You don't need to do any status reporting in this one 
    65          */ 
    66  
    67         g_warning ("tny_camel_pop_folder_refresh unimplemented"); 
     58        TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->account); 
     59        CamelException ex = CAMEL_EXCEPTION_INITIALISER; 
     60        CamelURL *url = NULL; 
     61        GList *options = apriv->options; 
     62        TnyCamelFolderPriv *priv_dst; 
     63        TnyIterator *iter; 
     64        GPtrArray *uids, *transferred_uids = NULL; 
     65        guint list_length; 
     66        CamelFolder *pop_folder, *cfol_dst; 
     67        CamelStore *pop_store; 
     68        const gchar *myerr = NULL; 
     69        TnyFolder *to_folder = NULL; 
     70 
     71        to_folder = self; 
     72 
     73        url = camel_url_new ("pop://", &ex); 
     74 
     75        if (camel_exception_is_set (&ex))  
     76                goto errorhandler; 
     77 
     78        camel_url_set_protocol (url, "pop");  
     79        camel_url_set_user (url, apriv->user); 
     80        camel_url_set_host (url, apriv->host); 
     81 
     82        while (options) 
     83        { 
     84                gchar *ptr, *dup = g_strdup (options->data); 
     85                gchar *option, *value; 
     86                ptr = strchr (dup, '='); 
     87                if (ptr) { 
     88                        ptr++; 
     89                        value = g_strdup (ptr); ptr--; 
     90                        *ptr = '\0'; option = dup; 
     91                } else { 
     92                        option = dup; 
     93                        value = g_strdup ("1"); 
     94                } 
     95                camel_url_set_param (url, option, value); 
     96                g_free (value); 
     97                g_free (dup); 
     98                options = g_list_next (options); 
     99        } 
     100 
     101        if (G_LIKELY (apriv->url_string)) 
     102                g_free (apriv->url_string); 
     103 
     104        apriv->url_string = camel_url_to_string (url, 0); 
     105        camel_url_free (url); url = NULL; 
     106 
     107        g_static_rec_mutex_lock (apriv->service_lock); 
     108        apriv->service = camel_session_get_service 
     109                ((CamelSession*) apriv->session, apriv->url_string,  
     110                apriv->type, &ex); 
     111        g_static_rec_mutex_unlock (apriv->service_lock); 
     112 
     113        /* TODO: Clean these up when done */ 
     114        tny_session_camel_set_pass_func (apriv->session, priv->account, apriv->get_pass_func); 
     115        tny_session_camel_set_forget_pass_func (apriv->session, priv->account, apriv->forget_pass_func); 
     116 
     117        if (apriv->service == NULL || camel_exception_is_set (&ex)) 
     118                goto errorhandler; 
     119 
     120        if (!camel_service_connect (apriv->service, &ex)) 
     121                goto errorhandler; 
     122 
     123        if (camel_exception_is_set (&ex)) 
     124                goto errorhandler; 
     125 
     126        pop_store = CAMEL_STORE (apriv->service); 
     127 
     128        pop_folder = camel_store_get_folder (pop_store, "INBOX", 0, &ex); 
     129        if (pop_folder == NULL || camel_exception_is_set (&ex)) 
     130                goto errorhandler; 
     131 
     132        camel_folder_refresh_info (pop_folder, &ex); 
     133        if (camel_exception_is_set (&ex)) 
     134                goto errorhandler; 
     135 
     136        priv_dst = TNY_CAMEL_FOLDER_GET_PRIVATE (to_folder); 
     137 
     138        cfol_dst = _tny_camel_folder_get_camel_folder (TNY_CAMEL_FOLDER (to_folder)); 
     139 
     140        uids = camel_folder_get_uids (pop_folder); 
     141 
     142        camel_folder_transfer_messages_to (pop_folder, uids, cfol_dst,  
     143                        &transferred_uids, poppriv->delete_originals, &ex); 
     144 
     145        if (camel_exception_is_set (&ex)) { 
     146                g_mutex_unlock (priv_dst->folder_lock); 
     147                goto errorhandler; 
     148        } 
     149 
     150        if (poppriv->delete_originals) 
     151                camel_folder_sync (pop_folder, TRUE, &ex); 
     152 
     153        if (camel_exception_is_set (&ex)) { 
     154                g_mutex_unlock (priv_dst->folder_lock); 
     155                goto errorhandler; 
     156        } 
     157 
     158        /* Why don't these delete the arrays with TRUE? */ 
     159 
     160        if (transferred_uids)  
     161                g_ptr_array_free (transferred_uids, FALSE); 
     162        g_ptr_array_free (uids, FALSE); 
     163 
     164        return; 
     165 
     166errorhandler: 
     167 
     168        if (camel_exception_is_set (&ex)) 
     169        { 
     170                if (!myerr) myerr = camel_exception_get_description (&ex); 
     171                camel_exception_clear (&ex); 
     172        } else 
     173                if (!myerr) myerr = "Unknown error"; 
     174 
     175        g_set_error (err, TNY_FOLDER_ERROR,  
     176                        TNY_FOLDER_ERROR_REFRESH, myerr); 
     177 
     178        if (apriv->service) /* Must this one be unreffed? */ 
     179                apriv->service = NULL; 
     180 
     181        if (pop_folder) 
     182                camel_object_unref (CAMEL_OBJECT (pop_folder)); 
     183 
     184        if (url) 
     185                camel_url_free (url); 
     186 
     187        return; 
     188
     189 
     190static void  
     191tny_camel_pop_folder_refresh (TnyFolder *self, GError **err) 
     192
     193        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
     194        TnyCamelPopStoreAccountPriv *poppriv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (priv->account); 
     195 
     196        g_mutex_lock (priv->folder_lock); 
     197 
     198        tny_camel_pop_folder_refresh_impl (self, err, NULL); 
     199 
     200        g_mutex_unlock (priv->folder_lock); 
     201 
    68202} 
    69203 
     
    80214 
    81215 
    82  
    83216static void 
    84217tny_camel_pop_folder_refresh_async_destroyer (gpointer thr_user_data) 
     
    198331        TnyCamelFolderPriv *priv = TNY_CAMEL_FOLDER_GET_PRIVATE (self); 
    199332        TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (priv->account); 
    200  
    201         TnyCamelPopStoreAccountPriv *poppriv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (priv->account); 
    202  
    203         gchar *str; 
    204         CamelException ex = CAMEL_EXCEPTION_INITIALISER; 
     333        gchar *str; CamelException ex = CAMEL_EXCEPTION_INITIALISER; 
    205334        GError *err = NULL; 
    206335 
     
    221350        g_free (str); 
    222351 
    223  
    224         /*  
    225          * TODO: Reimplement this one for POP (you have poppriv->inbox) 
    226          * 
    227          * camel_folder_refresh_info (priv->folder, &ex);  
    228          * 
    229          * Oh and, please tell something to tny_camel_folder_refresh_async_status 
    230          * from time to times. 
    231          */ 
    232  
    233         g_warning ("tny_camel_pop_folder_refresh_async unimplemented"); 
    234  
     352        tny_camel_pop_folder_refresh_impl (self, &err,  
     353                tny_camel_pop_folder_refresh_async_status); 
    235354 
    236355        info->err = NULL; 
     
    277396tny_camel_pop_folder_refresh_async (TnyFolder *self, TnyRefreshFolderCallback callback, TnyRefreshFolderStatusCallback status_callback, gpointer user_data) 
    278397{ 
    279         RefreshPopFolderInfo *info = g_slice_new (RefreshPopFolderInfo); 
    280         GThread *thread; 
    281  
    282         info->err = NULL; 
    283         info->self = self; 
    284         info->callback = callback; 
    285         info->status_callback = status_callback; 
    286         info->user_data = user_data; 
    287         info->depth = g_main_depth (); 
    288  
    289         /* thread reference */ 
    290         g_object_ref (G_OBJECT (self)); 
    291  
    292         thread = g_thread_create (tny_camel_pop_folder_refresh_async_thread, 
    293                         info, FALSE, NULL); 
     398        if (TRUE) 
     399        { 
     400                /* Temporary solution until multithreaded authentication works */ 
     401 
     402                GError *err = NULL; 
     403 
     404                tny_camel_pop_folder_refresh_impl (self, &err, NULL); 
     405 
     406                if (callback) 
     407                        callback (self, FALSE, &err, user_data); 
     408 
     409                if (err != NULL) 
     410                        g_error_free (err); 
     411 
     412        } else  
     413        { 
     414 
     415                RefreshPopFolderInfo *info = g_slice_new (RefreshPopFolderInfo); 
     416                GThread *thread; 
     417 
     418                info->err = NULL; 
     419                info->self = self; 
     420                info->callback = callback; 
     421                info->status_callback = status_callback; 
     422                info->user_data = user_data; 
     423                info->depth = g_main_depth (); 
     424 
     425                /* thread reference */ 
     426                g_object_ref (G_OBJECT (self)); 
     427 
     428                thread = g_thread_create (tny_camel_pop_folder_refresh_async_thread, 
     429                                info, FALSE, NULL); 
     430 
     431        } 
    294432 
    295433        return; 
  • trunk/libtinymail-camel/tny-camel-pop-store-account-priv.h

    r1368 r1383  
    2727        TnyFolder *inbox; 
    2828        GMutex *lock; 
     29        gboolean delete_originals; 
    2930}; 
    3031 
  • trunk/libtinymail-camel/tny-camel-pop-store-account.c

    r1370 r1383  
    103103                                fpriv->store = mdstore; 
    104104 
    105                                 g_free (full_path); 
    106  
    107105                                return TNY_FOLDER (folder); 
    108106 
     
    128126 
    129127static void 
    130 report_error (TnyCamelAccountPriv *priv) 
    131 { 
    132         if (G_UNLIKELY (priv->service == NULL)) 
    133         { 
    134                 g_error (_("Couldn't get service %s: %s\n"), priv->url_string, 
    135                            camel_exception_get_description (priv->ex)); 
    136                 camel_exception_clear (priv->ex); 
    137                 return; 
    138         } 
    139 } 
    140  
    141 static void 
    142128tny_camel_pop_store_account_reconnect (TnyCamelAccount *self) 
    143129{ 
    144130        TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (self); 
    145131        TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (self); 
    146         CamelSession *session = (CamelSession*) apriv->session; 
    147132 
    148133        g_mutex_lock (priv->lock); 
    149134 
    150         if (G_LIKELY (apriv->session) && G_UNLIKELY (apriv->user)  
    151                 && G_UNLIKELY (apriv->host)) 
    152         { 
    153                 if (!apriv->url_string) 
     135        if (G_UNLIKELY (apriv->user) && G_UNLIKELY (apriv->host)) 
     136        { 
     137                if (!priv->inbox) 
    154138                { 
    155                         gchar *name = NULL; 
    156  
    157                         if (G_LIKELY (apriv->url_string)) 
    158                                 g_free (apriv->url_string); 
    159  
    160                         name = g_strdup_printf ("%s@%s", apriv->user, apriv->host); 
    161                         apriv->url_string = g_strdup_printf ("maildir://%s/mail/pop/%s/maildir", 
    162                                 session->storage_path, name); 
    163                         if (priv->inbox != NULL) 
    164                                 g_object_unref (G_OBJECT (priv->inbox)); 
    165                         priv->inbox = create_maildir (self, apriv, name, apriv->url_string); 
    166                         g_free (name); 
    167  
    168                         /* camel_session_get_service can launch GUI things */ 
    169  
    170                         g_static_rec_mutex_lock (apriv->service_lock); 
    171                         apriv->service = camel_session_get_service (session,  
    172                                 apriv->url_string, apriv->type, apriv->ex); 
    173                         if (apriv->service == NULL) 
    174                                 report_error (apriv); 
    175                         g_static_rec_mutex_unlock (apriv->service_lock); 
    176  
    177                         /* TODO: Handle priv->ex using GError */ 
    178  
    179                 } else if (G_LIKELY (apriv->session) && (apriv->url_string)) 
    180                 { 
    181                         /* camel_session_get_service can launch GUI things */ 
    182  
    183                         g_static_rec_mutex_lock (apriv->service_lock); 
    184                         apriv->service = camel_session_get_service (session,  
    185                                 apriv->url_string, apriv->type, apriv->ex); 
    186                         if (apriv->service == NULL) 
    187                                 report_error (apriv); 
    188                         g_static_rec_mutex_unlock (apriv->service_lock); 
    189                          
    190                         /* TODO: Handle priv->ex using GError */ 
     139                        gchar *maildirpath = NULL; 
     140                        maildirpath = g_strdup_printf ("maildir://%s/pop/%s@%s/maildir", 
     141                                apriv->cache_location, apriv->user, apriv->host); 
     142                        priv->inbox = create_maildir (self, apriv, "inbox", maildirpath); 
     143                        g_free (maildirpath); 
    191144                } 
    192145        } 
     
    314267tny_camel_pop_store_account_finalize (GObject *object) 
    315268{ 
    316      
    317         /* The abstract CamelStoreAccount finalizes everything correctly */ 
    318      
     269    TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (object); 
     270 
     271        g_mutex_lock (priv->lock); 
     272        if (priv->inbox) 
     273                g_object_unref (G_OBJECT (priv->inbox)); 
     274        g_mutex_unlock (priv->lock); 
     275 
     276        g_mutex_free (priv->lock); 
     277 
    319278        (*parent_class->finalize) (object); 
    320279 
     
    348307} 
    349308 
     309/** 
     310 * tny_camel_pop_store_account_get_delete_originals: 
     311 * @self: a TnyCamelPOPStoreAccount 
     312 * 
     313 * Get the delete originals property of @self. 
     314 * 
     315 * Return value: Whether or not to delete original messages from the service 
     316 **/ 
     317gboolean  
     318tny_camel_pop_store_account_get_delete_originals (TnyCamelPOPStoreAccount *self) 
     319{ 
     320        TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (self); 
     321 
     322        return priv->delete_originals; 
     323} 
     324 
     325/** 
     326 * tny_camel_pop_store_account_set_delete_originals: 
     327 * @self: a TnyCamelPOPStoreAccount 
     328 * @delete_originals: Whether or not to delete original messages from the service 
     329 * 
     330 * Set the delete originals property of @self. 
     331 * 
     332 **/ 
     333void  
     334tny_camel_pop_store_account_set_delete_originals (TnyCamelPOPStoreAccount *self, gboolean delete_originals) 
     335{ 
     336        TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (self); 
     337 
     338        priv->delete_originals = delete_originals; 
     339} 
    350340 
    351341static void 
    352342tny_camel_pop_store_account_instance_init (GTypeInstance *instance, gpointer g_class) 
    353343{ 
    354         /* The abstract CamelStoreAccount initializes everything correctly */ 
    355      
     344         
     345        TnyCamelPopStoreAccountPriv *priv = TNY_CAMEL_POP_STORE_ACCOUNT_GET_PRIVATE (instance); 
     346 
     347        priv->lock = g_mutex_new (); 
     348        priv->inbox = NULL; 
     349        priv->delete_originals = FALSE; 
     350 
    356351        return; 
    357352} 
  • trunk/libtinymail-camel/tny-camel-pop-store-account.h

    r1357 r1383  
    5252TnyStoreAccount* tny_camel_pop_store_account_new (void); 
    5353 
     54gboolean tny_camel_pop_store_account_get_delete_originals (TnyCamelPOPStoreAccount *self); 
     55void tny_camel_pop_store_account_set_delete_originals (TnyCamelPOPStoreAccount *self, gboolean delete_originals); 
     56 
    5457G_END_DECLS 
    5558 
  • trunk/libtinymail-camel/tny-camel-store-account.c

    r1336 r1383  
    1818 */ 
    1919 
    20 /* TODO: Refactor to a TnyIMAPStoreAccount, TnyPOPStoreAccount and  
    21 TnyNNTPStoreAccount. Maybe also add a TnyExchangeStoreAccount? This file can  
    22 stay as an abstract TnyStoreAccount type. */ 
    23  
    2420#include <config.h> 
    2521#include <glib/gi18n-lib.h> 
  • trunk/libtinymail-camel/tny-session-camel.c

    r1305 r1383  
    452452        instance->prev_constat = FALSE; 
    453453        instance->device = NULL; 
     454        instance->camel_dir = NULL; 
    454455} 
    455456 
     
    457458_tny_session_camel_add_account (TnySessionCamel *self, TnyCamelAccount *account) 
    458459{ 
     460        TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (account); 
     461 
     462        if (apriv->cache_location) 
     463                g_free (apriv->cache_location); 
     464        apriv->cache_location = g_strdup (self->camel_dir); 
     465 
    459466        self->current_accounts = g_list_prepend (self->current_accounts, account); 
    460467} 
     
    463470_tny_session_camel_forget_account (TnySessionCamel *self, TnyCamelAccount *account) 
    464471{ 
     472        TnyCamelAccountPriv *apriv = TNY_CAMEL_ACCOUNT_GET_PRIVATE (account); 
     473 
     474        if (apriv->cache_location) 
     475                g_free (apriv->cache_location); 
     476        apriv->cache_location = NULL; 
     477 
    465478        self->current_accounts = g_list_remove (self->current_accounts, account); 
    466479} 
     
    539552 
    540553        self->account_store = (gpointer)account_store;     
    541        base_directory = g_strdup (tny_account_store_get_cache_dir (account_store)); 
     554    base_directory = g_strdup (tny_account_store_get_cache_dir (account_store)); 
    542555     
    543556        if (G_LIKELY (camel_init (base_directory, TRUE) != 0)) 
     
    558571                self->first_switch);  
    559572 
    560         g_free (camel_dir)
     573        self->camel_dir = camel_dir
    561574        g_free (base_directory); 
    562575 
    563576        tny_session_camel_set_device (self, device); 
    564577     
    565        g_object_unref (G_OBJECT (device)); 
     578    g_object_unref (G_OBJECT (device)); 
    566579 
    567580        return; 
     
    583596                        (camel_object_new (TNY_TYPE_SESSION_CAMEL)); 
    584597 
     598        retval->camel_dir = NULL; 
    585599        tny_session_camel_set_account_store (retval, account_store); 
    586600 
     
    599613                        self->connchanged_signal); 
    600614        } 
     615 
     616        if (self->camel_dir) 
     617                g_free (self->camel_dir); 
    601618 
    602619        /* CamelObject types don't need parent finalization (build-in camel) 
  • trunk/libtinymail-camel/tny-session-camel.h

    r1148 r1383  
    4242        guint connchanged_signal; 
    4343        GList *current_accounts; 
     44        gchar *camel_dir; 
    4445}; 
    4546 
  • trunk/libtinymail-gnome-desktop/tny-gnome-account-store.c

    r1304 r1383  
    369369 
    370370             
     371                key = g_strdup_printf ("/apps/tinymail/accounts/%d/disabled", i); 
     372                if (gconf_client_get_bool (priv->client, (const gchar*) key, NULL)) 
     373                { 
     374                        g_free (key); 
     375                        continue; 
     376                } 
     377                g_free (key); 
     378 
    371379                key = g_strdup_printf ("/apps/tinymail/accounts/%d/type", i); 
    372380                type = gconf_client_get_string (priv->client,  
     
    389397                        else if (!g_ascii_strncasecmp (proto, "nntp", 4)) 
    390398                                account = TNY_ACCOUNT (tny_camel_nntp_store_account_new ()); 
    391                         else if (!g_ascii_strncasecmp (proto, "pop", 4)) 
     399                        else if (!g_ascii_strncasecmp (proto, "pop", 3)) 
    392400                                account = TNY_ACCOUNT (tny_camel_pop_store_account_new ()); 
    393401                        else    /* Unknown, create a generic one? */ 
  • trunk/libtinymail-gpe/tny-gpe-account-store.c

    r1290 r1383  
    250250                g_free (key); 
    251251 
     252                key = g_strdup_printf ("/apps/tinymail/accounts/%d/disabled", i); 
     253                if (gconf_client_get_bool (priv->client, (const gchar*) key, NULL)) 
     254                { 
     255                        g_free (key); 
     256                        continue; 
     257                } 
     258                g_free (key); 
     259 
    252260                key = g_strdup_printf ("/apps/tinymail/accounts/%d/type", i); 
    253261                type = gconf_client_get_string (priv->client,  
     
    271279                        else if (!g_ascii_strncasecmp (proto, "nntp", 4)) 
    272280                                account = TNY_ACCOUNT (tny_camel_nntp_store_account_new ()); 
    273                         else if (!g_ascii_strncasecmp (proto, "pop", 4)) 
     281                        else if (!g_ascii_strncasecmp (proto, "pop", 3)) 
    274282                                account = TNY_ACCOUNT (tny_camel_pop_store_account_new ()); 
    275283                        else    /* Unknown, create a generic one? */ 
  • trunk/libtinymail-maemo/tny-maemo-account-store.c

    r1290 r1383  
    251251                g_free (key); 
    252252 
     253                key = g_strdup_printf ("/apps/tinymail/accounts/%d/disabled", i); 
     254                if (gconf_client_get_bool (priv->client, (const gchar*) key, NULL)) 
     255                { 
     256                        g_free (key); 
     257                        continue; 
     258                } 
     259                g_free (key); 
     260 
    253261                key = g_strdup_printf ("/apps/tinymail/accounts/%d/type", i); 
    254262                type = gconf_client_get_string (priv->client,  
     
    272280                        else if (!g_ascii_strncasecmp (proto, "nntp", 4)) 
    273281                                account = TNY_ACCOUNT (tny_camel_nntp_store_account_new ()); 
    274                         else if (!g_ascii_strncasecmp (proto, "pop", 4)) 
     282                        else if (!g_ascii_strncasecmp (proto, "pop", 3)) 
    275283                                account = TNY_ACCOUNT (tny_camel_pop_store_account_new ()); 
    276284                        else    /* Unknown, create a generic one? */ 
  • trunk/libtinymail-olpc/tny-olpc-account-store.c

    r1290 r1383  
    212212                } 
    213213 
     214                if (g_key_file_get_boolean (keyfile, "tinymail", "disabled", NULL)) 
     215                { 
     216                        g_free (fullfilen); 
     217                        continue; 
     218                } 
     219 
    214220                type = g_key_file_get_value (keyfile, "tinymail", "type", NULL); 
    215221                proto = g_key_file_get_value (keyfile, "tinymail", "proto", NULL); 
     
    225231                        else if (!g_ascii_strncasecmp (proto, "nntp", 4)) 
    226232                                account = TNY_ACCOUNT (tny_camel_nntp_store_account_new ()); 
    227                         else if (!g_ascii_strncasecmp (proto, "pop", 4)) 
     233                        else if (!g_ascii_strncasecmp (proto, "pop", 3)) 
    228234                                account = TNY_ACCOUNT (tny_camel_pop_store_account_new ()); 
    229235                        else    /* Unknown, create a generic one? */