aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-command.c
Commit message (Collapse)AuthorAgeFilesLines
* Lock the command channel while searching. (imap_body_contains): IfNot Zed2000-12-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-12-24 Not Zed <NotZed@HelixCode.com> * providers/imap/camel-imap-search.c (imap_body_contains): Lock the command channel while searching. (imap_body_contains): If performing a whole uid search, then add references to our own summary items, dont look it up in the folder. This way they can't vanish unexpectedly. * providers/imap/camel-imap-folder.h (CamelImapFolder): Added a private field. * providers/imap/camel-imap-private.h: Added lock for imap searches. * Merge from camel-mt-branch. * providers/imap/camel-imap-folder.c (imap_update_summary): Merge fix, use the folder->summary. (imap_get_message_flags, imap_set_message_flags, imap_get_message_user_flag, imap_set_message_user_flag): Removed again. (camel_imap_folder_init): Setup private data/lock. (imap_finalize): Free private data/search lock. (imap_search_free): Lock the search_lock. (imap_search_by_expression): Lock the search lock when using the search object. Also copy/ref hte summary, rather than getting it directly. (imap_refresh_info): Free any info lookups. Use folder->summary not imap_folder->summary. And lock around commands. svn path=/trunk/; revision=7150
* Change the semantics of fmt: Now %S (capital S) means an IMAP "string",Dan Winship2000-12-191-4/+119
| | | | | | | | | | | | | | | | | | | | | * providers/imap/camel-imap-command.c (camel_imap_command): Change the semantics of fmt: Now %S (capital S) means an IMAP "string", (which can be sent as either a quoted string or a literal). If the server supports LITERAL+, these will be sent as extended literals (which don't require any special escaping). Otherwise they'll be sent as quoted strings (and it now properly deals with " or \ in the string). (imap_command_strdup_vprintf): Utility routine that does the real work for the functionality mentioned above. * providers/imap/camel-imap-utils.c (imap_quote_string): Turns a string into a proper IMAP "quoted string". * providers/imap/camel-imap-store.c: * providers/imap/camel-imap-folder.c: Use %S instead of "%s" where appropriate. svn path=/trunk/; revision=7070
* Fix some off-by-one-ness.Dan Winship2000-11-301-3/+3
| | | | | | | | | | * providers/imap/camel-imap-command.c (imap_read_untagged): Fix some off-by-one-ness. * camel-stream-buffer.c (stream_read): Fix another bug found in previously-unused code here. svn path=/trunk/; revision=6718
* Make this gratuitously more complicated. No wait, I mean, fix bugs. NowDan Winship2000-11-281-48/+89
| | | | | | | | | | | | | * providers/imap/camel-imap-command.c (imap_read_untagged): Make this gratuitously more complicated. No wait, I mean, fix bugs. Now fully handles NULs in the data stream (which "can't happen" but do) and also handles responses containing multiple literals. Also does less copying than the original code. * camel-stream-buffer.c (stream_read): Fix a bug that could make it lose sync and/or overrun buffers. svn path=/trunk/; revision=6688
* Fixed to return the correct bytecount in all cases which is the real fixJeffrey Stedfast2000-11-211-3/+3
| | | | | | | | | | | | | | | | 2000-11-20 Jeffrey Stedfast <fejj@helixcode.com> * camel-remote-store.c (remote_recv_line): Fixed to return the correct bytecount in all cases which is the real fix to imap_parse_nstring. * providers/imap/camel-imap-command.c (imap_read_untagged): Again, don't use strlen for the post-data, use 'n'. * providers/imap/camel-imap-utils.c (imap_parse_nstring): Undo my previous temp-fix. svn path=/trunk/; revision=6621
* Use the byte-read count to decrement the number of bytes left to readJeffrey Stedfast2000-11-171-5/+5
| | | | | | | | | | | | | | | | | 2000-11-17 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-command.c (imap_read_untagged): Use the byte-read count to decrement the number of bytes left to read rather than using strlen. Not only does this protect against a DoS (embedded NUL chars in the literal string would make strlen inaccurate) but it also improves performace a little. * camel-remote-store.c (remote_recv_line): *Sigh* Return the number of bytes read on success rather than 0. Also don't use camel_stream_buffer_read_line since we can't get an accurate octet count. svn path=/trunk/; revision=6599
* Improved IMAP namespace handling: leave the namespace in theDan Winship2000-10-301-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | folder names rather than constantly prepending it and stripping it off. Also some subscription fixes. * camel-store.c (camel_folder_info_build): Fix for the case where @top isn't in @folders. * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Add a "short_name" argument rather than figuring it out ourselves. (imap_get_full_name): Implementation of CamelFolder::get_full_name that strips off namespace so the user doesn't have to see it. (imap_append_message, imap_copy_message_to, imap_move_message_to): Use folder->full_name rather than calling camel_imap_store_get_folder_path. * providers/imap/camel-imap-utils.c (imap_parse_list_response): Update this: make @flags a bitmask and @sep a char rather than a string. Make all of the out arguments optional. Handle literals in the server response. * providers/imap/camel-imap-store.c (imap_connect): Do a better job of getting the correct dir_sep for the namespace we're using. Construct a base_url here that will be used by get_folder_info. (camel_imap_store_folder_path): Removed (imap_folder_exists): Add an argument to return the short name of the folder (parsed out of the LIST response). Update for imap_parse_list_response change. (get_folder): Update for the various other changes. (get_folder_info): Update for the various other changes. Be more consistent about the returned layout: put everything underneath the "namespace" directory, including INBOX, even if it doesn't belong there. Don't destroy the list of subscribed folders until we've actually gotten the new list. (folder_subscribed, subscribe_folder, unsubscribe_folder): Use folder_name directly rather than camel_imap_store_folder_Path. * providers/imap/camel-imap-command.c (camel_imap_command): Update for folder name changes. svn path=/trunk/; revision=6256
* lots of i18n fixesDan Winship2000-10-241-7/+7
| | | | svn path=/trunk/; revision=6143
* Fix a "how could this have been working before" memory overrun bug foundDan Winship2000-10-241-0/+3
| | | | | | | | * providers/imap/camel-imap-command.c (imap_read_untagged): Fix a "how could this have been working before" memory overrun bug found by Vlad. svn path=/trunk/; revision=6129
* Don't imap_next_word(respbuf + 2), instead use imap_next_word(respbuf) orJeffrey Stedfast2000-10-171-1/+1
| | | | | | | | | | | 2000-10-16 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-command.c (imap_read_response): Don't imap_next_word(respbuf + 2), instead use imap_next_word(respbuf) or else we'll skip over the second token. svn path=/trunk/; revision=5961
* Don't free 'resp' as it doesn't point to the beginning of the allocatedJeffrey Stedfast2000-10-171-10/+11
| | | | | | | | | | | | | | | | | 2000-10-16 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-command.c (camel_imap_response_extract): Don't free 'resp' as it doesn't point to the beginning of the allocated data, instead free response->untagged->pdata[i]. Also, if '*resp' is equal to a space character, then set resp = imap_next_word (resp) rather than expecting resp++ to work (there's a list broken IMAP daemons that like to put extra spaces between tokens). (imap_read_response): Don't expect 'respbuf+2' to be where the untagged number response to start (see above fix for an explanation). svn path=/trunk/; revision=5960
* Only send the LOGOUT command if the store is connected. (imap_connect):Jeffrey Stedfast2000-10-171-1/+10
| | | | | | | | | | | | | | | | | | | 2000-10-16 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-store.c (imap_disconnect): Only send the LOGOUT command if the store is connected. (imap_connect): Set the 'connected' state to TRUE when we successfully connect. (get_folder_info): if (!topfi), 'topfi' was allocated but then 'fi' was set. I think Dan meant to set topfi since fi is an uninitialized value at this point. * providers/imap/camel-imap-command.c (imap_read_response): Check for the untagged BYE response and set the 'connected' state to FALSE if we receive the BYE response. Return NULL if we get a BYE response. svn path=/trunk/; revision=5944
* Simple subclass of CamelFolderSummary that also keeps a UIDVALIDITY valueDan Winship2000-10-131-15/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * providers/imap/camel-imap-summary.c: Simple subclass of CamelFolderSummary that also keeps a UIDVALIDITY value (and doesn't, for the moment, build content info). * providers/imap/camel-imap-folder.c: (various): Use a CamelImapSummary to store/fetch summary info. (camel_imap_folder_new): Take a path to a file to use for the summary. Set the folder's permanent_flags correctly according to the server response. Read in the summary (checking the UIDVALIDITY) and update it if it's out of date. (imap_refresh_info): Just fetch UIDs and flags. If the UIDs all match, update the flags as needed and be done with it. Otherwise, delete messages that have been expunged from the server and fetch full summary info for any new messages. (imap_sync): Save the summary to disk. (imap_update_summary): Renamed from imap_get_summary_internal. Can now be told to get summary for only a subset of messages. Use camel-mime-utils functions rather than rolling our own header parsing. (imap_get_message_info_internal): Merged into imap_update_summary. (imap_set_message_flags): Don't marked the message FOLDER_FLAGGED if we're not actually changing the value of any of the flags. (camel_imap_folder_changed): Deal with EXISTS rather than RECENT. * providers/imap/camel-imap-store.c (imap_connect): Call camel_session_get_storage_path and save the value. (get_folder): Create a local directory to store summary information and pass a summary file name to camel_imap_folder_new. Don't call camel_folder_refresh_info from here any more since camel_imap_folder_new does it again. * providers/imap/camel-imap-command.c (camel_imap_command): Add a special case to this to make it possible to get the repsonses from a SELECT and still have store->current_folder be updated correctly. (imap_read_response): parse EXISTS rather than RECENT * camel-session.c (camel_session_get_storage_path): Use e_mkdir_hier. * camel-folder-summary.c (camel_folder_summary_remove_index): New function. * camel-mime-utils.c (header_raw_append_parse): fix this. (camel-mime-parser.c doesn't use this code because of the MEMPOOL optimization, so nothing was ever actually calling it before.) svn path=/trunk/; revision=5891
* Quote the mailbox name when sending a SELECT request otherwise mailboxesJeffrey Stedfast2000-10-041-1/+1
| | | | | | | | | | | | | | 2000-10-03 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-command.c (camel_imap_command): Quote the mailbox name when sending a SELECT request otherwise mailboxes with spaces in their names will cause problems. * camel-mime-message.c (camel_mime_message_set_reply_to): encode before setting. (camel_mime_message_set_from): Same. svn path=/trunk/; revision=5697
* New file containing camel_imap_command and friends. MajorDan Winship2000-10-041-0/+391
* providers/imap/camel-imap-command.c: New file containing camel_imap_command and friends. Major camel_imap_command rewrite to remove duplicated code, make the parsing of literals be more safe/correct, deal with RECENT/EXPUNGE responses more consistently, and make it possible to implement the AUTHENTICATE command. * providers/imap/camel-imap-utils.c (imap_parse_nstring): New function, to parse an IMAP "nstring". * providers/imap/camel-imap-store.c: Move command stuff to camel-imap-command.c. Update for camel_imap_command changes. * providers/imap/camel-imap-folder.c: Update for camel_imap_command changes. (imap_append_message): CRLF filter the message before sending it. * providers/imap/Makefile.am: Add camel-imap-command.[ch], remove camel-imap-stream.[ch] for now. svn path=/trunk/; revision=5693