Changeset 1809
- Timestamp:
- 04/20/07 15:13:47
- Files:
-
- trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c (modified) (15 diffs)
- trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.h (modified) (1 diff)
- trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-command.c
r1740 r1809 221 221 CamelImapResponse *response; 222 222 CamelException internal_ex; 223 223 224 224 response = camel_imap_command (store, folder, ex, NULL); 225 225 if (!response) 226 226 return FALSE; 227 227 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); 229 230 camel_imap_response_free (store, response); 230 231 if (camel_exception_is_set (&internal_ex)) { trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c
r1808 r1809 385 385 void 386 386 camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response, 387 CamelException *ex )387 CamelException *ex, gboolean idle) 388 388 { 389 389 CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); … … 637 637 if (highestmodseq != NULL) 638 638 g_free (highestmodseq); 639 640 camel_imap_folder_start_idle (folder); 639 640 if (idle) 641 camel_imap_folder_start_idle (folder); 641 642 } 642 643 … … 775 776 response = camel_imap_command (imap_store, folder, ex, NULL); 776 777 if (response) { 777 camel_imap_folder_selected (folder, response, ex );778 camel_imap_folder_selected (folder, response, ex, TRUE); 778 779 camel_imap_response_free (imap_store, response); 779 camel_imap_folder_start_idle (folder);780 780 } 781 781 } else if (imap_folder->need_rescan) { … … 3834 3834 CamelStream *stream = NULL; 3835 3835 gboolean connected = FALSE, idle_rt = FALSE; 3836 CamelException tex = CAMEL_EXCEPTION_INITIALISER ;3836 CamelException tex = CAMEL_EXCEPTION_INITIALISER, myex = CAMEL_EXCEPTION_INITIALISER; 3837 3837 ssize_t nread = 0; 3838 gchar *a_resp = NULL; 3838 3839 3839 3840 /* EXPUNGE responses have to modify the cache, which means … … 3876 3877 return stream; 3877 3878 3878 camel_exception_clear(ex);3879 3880 CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);3881 3882 3879 if (!camel_disco_store_check_online ((CamelDiscoStore*)store, ex)) { 3883 3880 camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, … … 3886 3883 return NULL; 3887 3884 } 3888 3889 3885 camel_exception_clear (ex); 3890 3886 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); 3900 3892 3901 3893 if (type & CAMEL_FOLDER_RECEIVE_FULL) … … 3909 3901 stream = camel_stream_mem_new (); 3910 3902 3911 if (!stream) {3912 /* err = TRUE; */3913 goto errorhander;3914 }3915 3916 3917 3903 if (type & CAMEL_FOLDER_RECEIVE_FULL) 3918 3904 { … … 3939 3925 g_mutex_lock (store->stream_lock); 3940 3926 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 3949 3927 two_bytes [0] = ' '; 3950 3928 … … 3960 3938 nread = camel_stream_read (store->ostream, two_bytes, 1); 3961 3939 line [f] = two_bytes [0]; 3940 /* printf ("%c%c", two_bytes[0], two_bytes[1]); */ 3962 3941 f++; 3963 3942 } 3964 3943 line[f] = '\0'; 3944 /* printf ("\n"); */ 3965 3945 3966 3946 /* 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); 3968 3949 goto berrorhander; 3950 } 3969 3951 3970 3952 /* If the line doesn't start with "* " */ 3971 3953 if (*line != '*' || *(line + 1) != ' ') 3972 { err = TRUE; g oto berrorhander; }3954 { err = TRUE; g_warning ("BINARY: Line doesn't start with \"* \", UID=%s (%s)", uid, line); goto berrorhander; } 3973 3955 pos = strchr (line, '{'); 3974 3956 3975 3957 /* If we don't find a '{' character */ 3976 3958 if (!pos) 3977 { err = TRUE; g oto berrorhander; }3959 { err = TRUE; g_warning ("BINARY: Line doesn't contain a {, UID=%s (%s)", uid, line); goto berrorhander; } 3978 3960 3979 3961 /* Set the '}' character to \0 */ … … 3982 3964 *ppos = '\0'; 3983 3965 else /* If we didn't find it */ 3984 { err = TRUE; g oto berrorhander; }3966 { err = TRUE; g_warning ("BINARY: Line doesn't contain a }, UID=%s (%s)", uid, line); goto berrorhander; } 3985 3967 3986 3968 length = strtol (pos + 1, NULL, 10); … … 3988 3970 /* If strtol failed (it's important enough to check this) */ 3989 3971 if (errno == ERANGE) 3990 { err = TRUE; g oto berrorhander; }3972 { err = TRUE; g_warning ("BINARY: strtol failed, UID=%s (%s)", uid, line); goto berrorhander; } 3991 3973 3992 3974 /* Until we have reached the length, read 1024 at the time */ … … 4045 4027 4046 4028 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; 4066 4030 4067 4031 if (!server_stream) … … 4070 4034 store->command++; 4071 4035 4072 4073 4036 if (server_stream) 4074 4037 while (nread = camel_stream_buffer_gets (server_stream, line, MAX_LINE_LEN) > 0) … … 4289 4252 CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock); 4290 4253 4254 CAMEL_SERVICE_REC_UNLOCK(store, connect_lock); 4255 4291 4256 return stream; 4292 4257 … … 4306 4271 if (stream && ((CamelObject *)stream)->ref_count > 0) 4307 4272 camel_object_unref (CAMEL_OBJECT (stream)); 4273 4274 CAMEL_SERVICE_REC_UNLOCK(store, connect_lock); 4308 4275 4309 4276 return NULL; trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.h
r1739 r1809 76 76 void camel_imap_folder_selected (CamelFolder *folder, 77 77 CamelImapResponse *response, 78 CamelException *ex );78 CamelException *ex, gboolean idle); 79 79 80 80 void camel_imap_folder_changed (CamelFolder *folder, int exists, trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
r1740 r1809 2428 2428 /* camel_object_ref (new_folder); */ 2429 2429 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); 2431 2431 2432 2432 if (camel_exception_is_set (&local_ex)) {
