Changeset 1843

Show
Ignore:
Timestamp:
04/27/07 12:04:00
Author:
pvanhoof
Message:

Creating a new connection when getting messages

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r1842 r1843  
     12007-04-27  Philip Van Hoof  <pvanhoof@gnome.org> 
     2 
     3        * Creating a new connection for getting uncached messages  
     4        with the IMAP code. 
     5 
    162007-04-27  Murray Cumming  <murrayc@murrayc.com> 
    27 
    38        * libtinymail-maemo/tny-maemo-conic-device.c: 
    4         (on_connection_event), (tny_maemo_conic_device_get_iap): Added some comments and  
    5         improved the (temporary) debug output so its more obvious what is happening. 
     9        (on_connection_event), (tny_maemo_conic_device_get_iap): Added some  
     10        comments and  improved the (temporary) debug output so its more  
     11        obvious what is happening. 
    612 
    713        * libtinymail/tny-device.c: Correct the tny_device_force_offline() and  
     
    1319        * libtinymail-maemo/tny-maemo-conic-device.c: 
    1420        (tny_maemo_conic_device_instance_init), 
    15         (tny_maemo_conic_device_new): Do all the initialization in init, because  
    16         _new functions should just call g_object_new() and not access private API,  
    17         because they are just C convenience functions. 
     21        (tny_maemo_conic_device_new): Do all the initialization in init,  
     22        because _new functions should just call g_object_new() and not  
     23        access private API, because they are just C convenience functions. 
    1824        (on_connection_event), (tny_maemo_conic_device_connect), 
    1925        (tny_maemo_conic_device_disconnect), 
     
    2329        (tny_maemo_conic_device_force_offline), 
    2430        (tny_maemo_conic_device_finalize):  
    25         Copy the iap string instead of just storing the pointer, because we have no  
    26         guarantees about the lifetime of the string that con_ic_event_get_iap_id()  
    27         returns. Free it in finalize. 
    28         Added g_return_if*() checks for priv->cnx, without which nothing could work. 
     31        Copy the iap string instead of just storing the pointer, because  
     32        we have no guarantees about the lifetime of the string that  
     33        con_ic_event_get_iap_id() returns. Free it in finalize. 
     34        Added g_return_if*() checks for priv->cnx, without which nothing  
     35        could work. 
    2936 
    30372007-04-23  Philip Van Hoof  <pvanhoof@gnome.org> 
     
    51582007-04-23 Javier Fernandez Garcia-Boente 
    5259 
    53         * Change priority flags management, using a bit mask to get assigned priority. 
     60        * Change priority flags management, using a bit mask to get assigned  
     61        priority. 
    5462        * New enumeration to define available priority flags.  
    5563 
     
    99107        Take a TnyMaemoConicDevice* instead of a TnyDevice, as that is  
    100108        the convention for derived/implemented objects. 
    101         Correct the TNY_TYPE_MAEMO_CONIC_DEVICE implementation so that this can be used.  
     109        Correct the TNY_TYPE_MAEMO_CONIC_DEVICE implementation so that  
     110        this can be used.  
    102111 
    1031122007-04-17  Shilpa Musti  <Shilpa.Musti@nokia.com> 
     
    179188        * This ain't an API change, but this new feature does make more 
    180189        possible with the same API. It might also change behaviour a little 
    181         bit (although it shouldn't for the old-style of using the TnyFolderMonitor, 
    182         or at least not as far as I know and tested). 
     190        bit (although it shouldn't for the old-style of using the  
     191        TnyFolderMonitor, or at least not as far as I know and tested). 
    183192 
    1841932007-03-23  Philip Van Hoof  <pvanhoof@gnome.org> 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c

    r1809 r1843  
    271271                store->command++, cmd); 
    272272        len = strlen (full_cmd); 
     273 
     274        /* printf ("-> %s\n", full_cmd); */ 
    273275 
    274276        nwritten = camel_stream_write (store->ostream, full_cmd, len); 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c

    r1809 r1843  
    38313831{ 
    38323832        CamelFolder *folder = CAMEL_FOLDER (imap_folder); 
    3833         CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store)
     3833        CamelImapStore *store = NULL
    38343834        CamelStream *stream = NULL; 
    38353835        gboolean connected = FALSE, idle_rt = FALSE; 
    3836         CamelException tex = CAMEL_EXCEPTION_INITIALISER, myex = CAMEL_EXCEPTION_INITIALISER; 
    3837         ssize_t nread = 0;  
     3836        CamelException  tex = CAMEL_EXCEPTION_INITIALISER,  
     3837                        myex = CAMEL_EXCEPTION_INITIALISER, 
     3838                        cex = CAMEL_EXCEPTION_INITIALISER; 
     3839        ssize_t nread = 0; gboolean amcon = FALSE; 
    38383840        gchar *a_resp = NULL; 
    38393841 
    3840         /* EXPUNGE responses have to modify the cache, which means 
    3841          * they have to grab the cache_lock while holding the 
    3842          * connect_lock. 
    3843  
    3844          * Because getting the service lock may cause MUCH unecessary 
    3845          * delay when we already have the data locally, we do the 
    3846          * locking separately.  This could cause a race 
    3847          * getting the same data from the cache, but that is only 
    3848          * an inefficiency, and bad luck. */ 
    3849  
    38503842        CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock); 
    38513843 
    3852         connected = camel_disco_store_check_online((CamelDiscoStore *)store, &tex); 
    3853  
    3854         if (!store->istream || ((CamelObject *)store->istream)->ref_count <= 0) 
    3855                 connected = FALSE; 
    3856         if (!store->ostream || ((CamelObject *)store->ostream)->ref_count <= 0) 
    3857                 connected = FALSE; 
    3858          
     3844        connected = camel_disco_store_check_online(CAMEL_DISCO_STORE (folder->parent_store), &tex); 
     3845 
    38593846        if (connected && ((type & CAMEL_FOLDER_RECEIVE_FULL) && camel_imap_message_cache_is_partial (imap_folder->cache, uid))) 
    38603847                camel_imap_message_cache_remove (imap_folder->cache, uid); 
     
    38643851        else 
    38653852        { 
    3866             stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text, ex); 
    3867  
    3868             if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0")))  
    3869             { 
    3870                     camel_exception_clear (ex); 
    3871                     stream = camel_imap_message_cache_get (imap_folder->cache, uid, "", ex); 
    3872             } 
     3853                stream = camel_imap_message_cache_get (imap_folder->cache, uid, section_text, ex); 
     3854                if (!stream && (!strcmp (section_text, "HEADER") || !strcmp (section_text, "0")))  
     3855                { 
     3856                        camel_exception_clear (ex); 
     3857                        stream = camel_imap_message_cache_get (imap_folder->cache, uid, "", ex); 
     3858                } 
    38733859        } 
    38743860        CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
    3875          
     3861 
    38763862        if (stream || cache_only) 
    38773863                return stream; 
    38783864 
    3879         if (!camel_disco_store_check_online ((CamelDiscoStore*)store, ex)) { 
     3865        if (!camel_disco_store_check_online (CAMEL_DISCO_STORE (folder->parent_store), ex))  
     3866        { 
    38803867                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
    38813868                                     _("This message is not currently available")); 
     
    38853872        camel_exception_clear (ex); 
    38863873 
    3887   CAMEL_SERVICE_REC_LOCK(store, connect_lock); 
    3888  
    3889         camel_exception_clear(ex); 
     3874        store = CAMEL_IMAP_STORE (camel_object_new (CAMEL_IMAP_STORE_TYPE)); 
     3875 
     3876        camel_service_construct (CAMEL_SERVICE (store),  
     3877                camel_service_get_session (CAMEL_SERVICE (folder->parent_store)), 
     3878                camel_service_get_provider (CAMEL_SERVICE (folder->parent_store)), 
     3879                CAMEL_SERVICE (folder->parent_store)->url, ex); 
     3880 
     3881        if (camel_exception_is_set (ex)) 
     3882        { 
     3883                g_critical ("Severe interal error while trying to construct a new connection\n"); 
     3884                camel_object_unref (store); 
     3885                return NULL; 
     3886        } 
     3887 
     3888        /* amcon = camel_imap_service_connect (CAMEL_SERVICE (store), ex); */ 
     3889        amcon = camel_service_connect (CAMEL_SERVICE (store), ex); 
     3890 
     3891        if (!amcon || camel_exception_is_set (ex) || !camel_disco_store_check_online (CAMEL_DISCO_STORE (store), ex))  
     3892        { 
     3893                camel_object_unref (store); 
     3894                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
     3895                                        _("This message is not currently available" 
     3896                                        " (can't let a new connection go online)")); 
     3897                CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
     3898                return NULL; 
     3899        } 
     3900        camel_exception_clear (ex); 
     3901 
     3902  CAMEL_SERVICE_REC_LOCK(store, connect_lock);  
    38903903 
    38913904        CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock); 
     
    42524265        CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
    42534266 
    4254   CAMEL_SERVICE_REC_UNLOCK(store, connect_lock); 
     4267  CAMEL_SERVICE_REC_UNLOCK(store, connect_lock);  
     4268 
     4269        camel_service_disconnect (CAMEL_SERVICE (store), TRUE, NULL); 
     4270        camel_object_unref (CAMEL_OBJECT (store)); 
    42554271 
    42564272        return stream; 
     
    42724288                camel_object_unref (CAMEL_OBJECT (stream)); 
    42734289 
     4290  if (store) 
     4291  { 
     4292 
    42744293  CAMEL_SERVICE_REC_UNLOCK(store, connect_lock); 
    4275  
     4294        camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); 
     4295        camel_object_unref (CAMEL_OBJECT (store)); 
     4296  } 
    42764297        return NULL; 
    42774298} 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r1809 r1843  
    374374        } 
    375375} 
     376 
     377 
    376378 
    377379static int 
     
    10611063}; 
    10621064 
    1063 gboolean 
     1065 
     1066static gboolean 
    10641067connect_to_server_wrapper (CamelService *service, CamelException *ex) 
    10651068{ 
     
    11131116         
    11141117        return ret; 
     1118} 
     1119 
     1120gboolean  
     1121camel_imap_service_connect (CamelService *service, CamelException *ex) 
     1122{ 
     1123        return connect_to_server_wrapper (service, ex); 
    11151124} 
    11161125 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.h

    r1740 r1843  
    160160ssize_t camel_imap_store_readline_nb (CamelImapStore *store, char **dest, CamelException *ex); 
    161161ssize_t camel_imap_store_readline (CamelImapStore *store, char **dest, CamelException *ex); 
    162 gboolean connect_to_server_wrapper (CamelService *service, CamelException *ex); 
     162gboolean camel_imap_service_connect (CamelService *service, CamelException *ex); 
    163163 
    164164gboolean camel_imap_store_restore_stream_buffer (CamelImapStore *store);