Changeset 1809

Show
Ignore:
Timestamp:
04/20/07 15:13:47
Author:
pvanhoof
Message:

Bugfix for merge folders

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c

    r1740 r1809  
    221221                CamelImapResponse *response; 
    222222                CamelException internal_ex; 
    223                  
     223 
    224224                response = camel_imap_command (store, folder, ex, NULL); 
    225225                if (!response) 
    226226                        return FALSE; 
    227227                camel_exception_init (&internal_ex); 
    228                 camel_imap_folder_selected (folder, response, &internal_ex); 
     228                /* g_print ("select\n"); */ 
     229                camel_imap_folder_selected (folder, response, &internal_ex, FALSE); 
    229230                camel_imap_response_free (store, response); 
    230231                if (camel_exception_is_set (&internal_ex)) { 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c

    r1808 r1809  
    385385void 
    386386camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response, 
    387                             CamelException *ex
     387                            CamelException *ex, gboolean idle
    388388{ 
    389389        CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); 
     
    637637        if (highestmodseq != NULL) 
    638638                g_free (highestmodseq); 
    639          
    640         camel_imap_folder_start_idle (folder); 
     639 
     640        if (idle) 
     641                camel_imap_folder_start_idle (folder); 
    641642} 
    642643 
     
    775776                response = camel_imap_command (imap_store, folder, ex, NULL); 
    776777                if (response) { 
    777                         camel_imap_folder_selected (folder, response, ex); 
     778                        camel_imap_folder_selected (folder, response, ex, TRUE); 
    778779                        camel_imap_response_free (imap_store, response); 
    779                         camel_imap_folder_start_idle (folder); 
    780780                } 
    781781        } else if (imap_folder->need_rescan) { 
     
    38343834        CamelStream *stream = NULL; 
    38353835        gboolean connected = FALSE, idle_rt = FALSE; 
    3836         CamelException tex = CAMEL_EXCEPTION_INITIALISER
     3836        CamelException tex = CAMEL_EXCEPTION_INITIALISER, myex = CAMEL_EXCEPTION_INITIALISER
    38373837        ssize_t nread = 0;  
     3838        gchar *a_resp = NULL; 
    38383839 
    38393840        /* EXPUNGE responses have to modify the cache, which means 
     
    38763877                return stream; 
    38773878 
    3878         camel_exception_clear(ex); 
    3879  
    3880         CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock); 
    3881  
    38823879        if (!camel_disco_store_check_online ((CamelDiscoStore*)store, ex)) { 
    38833880                camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, 
     
    38863883                return NULL; 
    38873884        } 
    3888          
    38893885        camel_exception_clear (ex); 
    38903886 
    3891         if (!store->ostream || ((CamelObject *)store->ostream)->ref_count <= 0){  
    3892                 /* err = TRUE; */ 
    3893                 goto errorhander;  
    3894         } 
    3895          
    3896         if (!store->istream || ((CamelObject *)store->istream)->ref_count <= 0){  
    3897                 /* err = TRUE; */ 
    3898                 goto errorhander;  
    3899         } 
     3887  CAMEL_SERVICE_REC_LOCK(store, connect_lock); 
     3888 
     3889        camel_exception_clear(ex); 
     3890 
     3891        CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock); 
    39003892 
    39013893        if (type & CAMEL_FOLDER_RECEIVE_FULL) 
     
    39093901                stream = camel_stream_mem_new (); 
    39103902 
    3911         if (!stream) {  
    3912                 /* err = TRUE; */ 
    3913                 goto errorhander;  
    3914         } 
    3915  
    3916          
    39173903        if (type & CAMEL_FOLDER_RECEIVE_FULL) 
    39183904        { 
     
    39393925                        g_mutex_lock (store->stream_lock); 
    39403926 
    3941                         if (!store->ostream || ((CamelObject *)store->ostream)->ref_count <= 0) 
    3942                         { 
    3943                                 err = TRUE; 
    3944                                 two_bytes[0]='\n'; 
    3945                                 nread = -1; 
    3946                                 goto berrorhander; 
    3947                         } 
    3948  
    39493927                        two_bytes [0] = ' '; 
    39503928 
     
    39603938                                nread = camel_stream_read (store->ostream, two_bytes, 1); 
    39613939                                line [f] = two_bytes [0]; 
     3940/* printf ("%c%c", two_bytes[0], two_bytes[1]); */ 
    39623941                                f++; 
    39633942                        } 
    39643943                        line[f] = '\0'; 
     3944/* printf ("\n"); */ 
    39653945 
    39663946                        /* The first line is very unlikely going to consume 1023 bytes */ 
    3967                         if (f > 1023 || nread <= 0) 
     3947                        if (f > 1023 || nread <= 0) { 
     3948                                g_warning ("BINARY: Long first line, UID=%s", uid); 
    39683949                                goto berrorhander; 
     3950                        } 
    39693951 
    39703952                        /* If the line doesn't start with "* " */ 
    39713953                        if (*line != '*' || *(line + 1) != ' ') 
    3972                                 { err = TRUE; goto berrorhander; } 
     3954                                { err = TRUE; g_warning ("BINARY: Line doesn't start with \"* \", UID=%s (%s)", uid, line); goto berrorhander; } 
    39733955                        pos = strchr (line, '{'); 
    39743956 
    39753957                        /* If we don't find a '{' character */ 
    39763958                        if (!pos)  
    3977                                 { err = TRUE; goto berrorhander; } 
     3959                                { err = TRUE; g_warning ("BINARY: Line doesn't contain a {, UID=%s (%s)", uid, line); goto berrorhander; } 
    39783960 
    39793961                        /* Set the '}' character to \0 */ 
     
    39823964                                *ppos = '\0'; 
    39833965                        else /* If we didn't find it */ 
    3984                                 { err = TRUE; goto berrorhander; } 
     3966                                { err = TRUE; g_warning ("BINARY: Line doesn't contain a }, UID=%s (%s)", uid, line); goto berrorhander; } 
    39853967 
    39863968                        length = strtol (pos + 1, NULL, 10); 
     
    39883970                        /* If strtol failed (it's important enough to check this) */ 
    39893971                        if (errno == ERANGE) 
    3990                                 { err = TRUE; goto berrorhander; } 
     3972                                { err = TRUE; g_warning ("BINARY: strtol failed, UID=%s (%s)", uid, line); goto berrorhander; } 
    39913973 
    39923974                        /* Until we have reached the length, read 1024 at the time */ 
     
    40454027 
    40464028                        g_mutex_lock (store->stream_lock); 
    4047  
    4048                         if (!store->istream || ((CamelObject *)store->istream)->ref_count <= 0) 
    4049                         { 
    4050                                 err = TRUE; 
    4051                                 nread = -1; 
    4052                                 goto merrorhandler; 
    4053                         } 
    4054  
    4055                         if (!store->ostream || ((CamelObject *)store->ostream)->ref_count <= 0) 
    4056                         { 
    4057                                 err = TRUE; 
    4058                                 nread = -1; 
    4059                                 goto merrorhandler; 
    4060                         } 
    4061  
    4062                         if (camel_imap_store_restore_stream_buffer (store)) 
    4063                                 server_stream = store->istream ? CAMEL_STREAM_BUFFER (store->istream) : NULL; 
    4064                         else  
    4065                                 server_stream = NULL; 
     4029                        server_stream = (CamelStreamBuffer*) store->istream; 
    40664030 
    40674031                        if (!server_stream) 
     
    40704034                                store->command++; 
    40714035 
    4072                          
    40734036                        if (server_stream)  
    40744037                          while (nread = camel_stream_buffer_gets (server_stream, line, MAX_LINE_LEN) > 0) 
     
    42894252        CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 
    42904253 
     4254  CAMEL_SERVICE_REC_UNLOCK(store, connect_lock); 
     4255 
    42914256        return stream; 
    42924257 
     
    43064271        if (stream && ((CamelObject *)stream)->ref_count > 0) 
    43074272                camel_object_unref (CAMEL_OBJECT (stream)); 
     4273 
     4274  CAMEL_SERVICE_REC_UNLOCK(store, connect_lock); 
    43084275 
    43094276        return NULL; 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.h

    r1739 r1809  
    7676void camel_imap_folder_selected (CamelFolder *folder, 
    7777                                 CamelImapResponse *response, 
    78                                  CamelException *ex); 
     78                                 CamelException *ex, gboolean idle); 
    7979 
    8080void camel_imap_folder_changed (CamelFolder *folder, int exists, 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r1740 r1809  
    24282428                /* camel_object_ref (new_folder); */ 
    24292429                camel_exception_init (&local_ex); 
    2430                 camel_imap_folder_selected (new_folder, response, &local_ex); 
     2430                camel_imap_folder_selected (new_folder, response, &local_ex, TRUE); 
    24312431 
    24322432                if (camel_exception_is_set (&local_ex)) {