aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Delayed loading of IMAP message parts.Dan Winship2001-01-171-4/+246
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * camel-types.h: typedef CamelMessageInfo and CamelMessageContentInfo here * camel-folder-summary.h: Add a "size" field to CamelMessageContentInfo. * camel-folder-summary.c (camel_folder_summary_content_info_new, camel_folder_summary_content_info_free): Renamed and made non-static for providers that construct their own content info. (content_info_load, content_info_save): load/save size * camel-data-wrapper.c (camel_data_wrapper_is_offline): New function to return if a data wrapper's contents are "offline". (So that, for example, we don't make thumbnails of images that haven't been loaded off the IMAP server yet.) Defaults to FALSE. * providers/imap/camel-imap-folder.c (camel_imap_folder_selected): Fix a bug in re-selecting a folder when messages have been expunged from it by another client in the meantime. (imap_get_message): Rewrite. If the message is larger than a certain size, just create a skeleton message containing CamelImapWrappers that will read parts as needed. This way, large attachments only need to be downloaded if the user looks at them, and multipart/alternative alternatives that aren't used will never be downloaded at all. (imap_update_summary): Rewrite this a bunch too to make the parsing more robust. * providers/imap/camel-imap-summary.c (CAMEL_IMAP_SUMMARY_VERSION): bump. (camel_imap_summary_new): Set build_content to TRUE. (content_info_load, content_info_save): Only save/load the content for messages that have it. (The content info gets created as a side effect of imap_get_message.) * providers/imap/camel-imap-utils.c (imap_parse_body): New routine (and helpers) to parse an IMAP 'body' FETCH response and fill in a CamelMessageContentInfo from it. * providers/imap/Makefile.am (libcamelimap_la_SOURCES, libcamelimap_la_HEADERS): add camel-imap-wrapper. svn path=/trunk/; revision=7557
* IMAP randomness.Dan Winship2001-01-031-49/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * providers/imap/camel-imap-stream.[ch]: Remove. To be replaced. * providers/imap/Makefile.am (libcamelimapinclude_HEADERS): Remove camel-imap-stream.h * providers/imap/camel-imap-utils.c (imap_parse_flag_list): Take a char ** instead of char *, to return the position at the end of parsing like the string parsing functions. (imap_parse_string_generic): New function to parse a string, nstring, or astring. (imap_parse_nstring, imap_parse_astring): Now macros (imap_parse_string): Added * providers/imap/camel-imap-folder.h: Remove the "exists" field from CamelImapFolder. * providers/imap/camel-imap-folder.c: Remove unused include of camel-imap-stream.h. (camel_imap_folder_init): Remove no-longer-relevant summary initialization. (camel_imap_folder_new): Update for imap_parse_flag_list change, exists removal, and imap_rescan. (imap_rescan): New function that does most of the work of the old imap_refresh_info, but taking "exists" as an argument instead of getting it from the folder. Also calls camel_imap_folder_changed to do the summary updating and signalling, rather than duplicating that code. (imap_refresh_info): Just call imap_rescan (using the size of the folder summary as "exists"). (imap_update_summary): Update for imap_parse_flag_list change (camel_imap_folder_changed): Update for "exists" change. svn path=/trunk/; revision=7216
* New CamelFolderSearch subclass that just reimplements body_contains (usingDan Winship2000-12-221-393/+0
| | | | | | | | | | | | | | | | | | * providers/imap/camel-imap-search.c: New CamelFolderSearch subclass that just reimplements body_contains (using the IMAP SEARCH command). All other kinds of searching are done against the local summary. * providers/imap/camel-imap-folder.c (imap_search_by_expression): Use a CamelImapSearch to do searching. * providers/imap/camel-imap-utils.c (imap_translate_sexp, etc): No longer needed. * camel-folder-search.h: Add missing CAMEL_FOLDER_SEARCH_TYPE #define svn path=/trunk/; revision=7119
* Change the semantics of fmt: Now %S (capital S) means an IMAP "string",Dan Winship2000-12-191-0/+35
| | | | | | | | | | | | | | | | | | | | | * 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
* Fixed to return the correct bytecount in all cases which is the real fixJeffrey Stedfast2000-11-211-3/+0
| | | | | | | | | | | | | | | | 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
* lso make sure not to go past the end of the buffer ;-)Jeffrey Stedfast2000-11-171-1/+1
| | | | svn path=/trunk/; revision=6601
* When extracting a literal string, capture up until the end of the lastJeffrey Stedfast2000-11-171-0/+4
| | | | | | | | | | | | | | | | | | | | | 2000-11-17 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c (imap_parse_nstring): When extracting a literal string, capture up until the end of the last line - this we we don't lose any data if the byte count is off. * 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=6600
* Improved IMAP namespace handling: leave the namespace in theDan Winship2000-10-301-42/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix a bug with "INBOX" (or anything else with NIL hierarchy separator) asDan Winship2000-10-201-1/+1
| | | | | | | | * providers/imap/camel-imap-utils.c (imap_parse_list_response): Fix a bug with "INBOX" (or anything else with NIL hierarchy separator) as the namespace. svn path=/trunk/; revision=6065
* New file containing camel_imap_command and friends. MajorDan Winship2000-10-041-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | * 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
* Remove camel_folder_{get,free}_subfolder_info, as we want to be able toDan Winship2000-10-031-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * camel-folder.[ch]: Remove camel_folder_{get,free}_subfolder_info, as we want to be able to scan the whole subfolder tree without having to open any folders, so this needs to be in CamelStore. Remove can_hold_folders and can_hold_messages flags; things that don't hold messages are no longer considered CamelFolders. * camel-folder-summary.[ch]: Remove CamelFolderInfo stuff. * camel-store.[ch]: Add camel_store_{get,free}_folder_info, as well as camel_store_free_folder_info_full and ..._nop for default implementations, and camel_folder_info_free and camel_folder_info_build as convenience functions. Turn CamelFolderInfo into a tree structure and also add an "url" member. * providers/*/camel-*-folder.c: Remove subfolder_info and can_hold stuff. * providers/*/camel-*-store.c: Add folder_info stuff. * providers/imap/camel-imap-folder.c (imap_summary_free): Free the summary elements with camel_message_info_free, not camel_folder_info_free. Oops. * providers/imap/camel-imap-utils.c: const poison svn path=/trunk/; revision=5663
* Quote the folder name as it may contain spaces.Jeffrey Stedfast2000-09-271-22/+21
| | | | | | | | | | | | | | | | | | | | 2000-09-26 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c (imap_get_message_count_internal): Quote the folder name as it may contain spaces. (imap_get_subfolder_info_internal): Same. * providers/imap/camel-imap-utils.c (imap_parse_list_response): Do proper unquoting for folder names. (func_get_current_date): Implemented. * providers/imap/camel-imap-store.c (imap_folder_exists): Quote the folder name as it may have spaces. (imap_create): Same. (check_current_folder): Same. svn path=/trunk/; revision=5592
* Again...wrap the folder names in quotesJeffrey Stedfast2000-09-231-3/+4
| | | | | | | | | | | | | | | | | | | | 2000-09-22 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c (imap_get_message_count_internal): Again...wrap the folder names in quotes * providers/imap/camel-imap-store.c (imap_folder_exists): Wrap the mailbox name in the LIST command in quotes just in case the folder has spaces in the name. (imap_create): Again, wrap folder name in quotes. (check_current_folder): Same... * providers/imap/camel-imap-utils.c (imap_parse_list_response): Update to unquote mailbox if it's quoted (allows us to get folders with spaces in the name). svn path=/trunk/; revision=5556
* New function to convert Camel flags to an IMAP flag_list.Dan Winship2000-09-221-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | * providers/imap/camel-imap-utils.c (imap_create_flag_list): New function to convert Camel flags to an IMAP flag_list. (imap_parse_flag_list): Contrariwise. * providers/imap/camel-imap-store.c (camel_imap_command_*): Make the @ret arg actually optional, as (mostly) documented. (various): Don't pass "&result" to camel_imap_command_* if we're just going to immediately free it. Don't record status if we're not going to look at it. * providers/imap/camel-imap-folder.c: Likewise. (imap_summary_free): Use camel_folder_info_free. (imap_sync): Use imap_create_flag_list. Clear CAMEL_MESSAGE_FOLDER_FLAGGED after syncing so we don't keep re-syncing. (imap_append_message): Use imap_create_flag_list. Don't leak the memstream if the append fails. (imap_move_message_to): Use camel_folder_delete_message rather than doing it by hand. (imap_get_summary_internal, imap_get_message_info_internal): Use imap_parse_flag_list and header_raw_clear. (camel_imap_folder_changed): Use camel_message_info_free. svn path=/trunk/; revision=5544
* Removed some unused functions.Christopher James Lahey2000-09-021-45/+0
| | | | | | | | | 2000-09-01 Christopher James Lahey <clahey@helixcode.com> * providers/imap/camel-imap-utils.c: Removed some unused functions. svn path=/trunk/; revision=5169
* Reimplemented. It should now work correctly for most possible VFolderJeffrey Stedfast2000-09-011-175/+327
| | | | | | | | | | 2000-08-31 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c (imap_translate_sexp): Reimplemented. It should now work correctly for most possible VFolder rules. svn path=/trunk/; revision=5151
* Removed old code that will never be needed againJeffrey Stedfast2000-08-301-97/+2
| | | | | | | | | | | | | | 2000-08-29 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c: Removed old code that will never be needed again * providers/imap/camel-imap-store.c: Removed old code for try_connect - will never need this code (slurp_response): Update to make sure we aren't falsely detecting EXPUNGE flags svn path=/trunk/; revision=5106
* If we are trying to get a subfolder listing of the root folder, alwaysJeffrey Stedfast2000-08-081-3/+7
| | | | | | | | | | | | | | 2000-08-07 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c (imap_get_subfolder_names_internal): If we are trying to get a subfolder listing of the root folder, always make sure INBOX is there... * providers/imap/camel-imap-utils.c (imap_parse_list_response): Check for NIL as a directory separator. svn path=/trunk/; revision=4582
* Strip all \n's from the expressionJeffrey Stedfast2000-08-081-4/+7
| | | | | | | | | | | | 2000-08-07 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c (imap_translate_sexp): Strip all \n's from the expression * string-utils.c (strip): New convenience function to strip occurences of a single char from a string svn path=/trunk/; revision=4576
* Only call imap_get_summary_internal if the folder can hold messagesJeffrey Stedfast2000-08-041-5/+6
| | | | | | | | | | | | 2000-08-03 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c (camel_imap_folder_new): Only call imap_get_summary_internal if the folder can hold messages * providers/nntp/camel-nntp-provider.c (camel_provider_module_init): Initialize the service_cache for the news/nntp providers svn path=/trunk/; revision=4519
* New and improved sexp parser. An honest try at using e-sexp is wrapped inJeffrey Stedfast2000-08-021-221/+313
| | | | | | | | | | | | | | 2000-08-01 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c (imap_translate_sexp): New and improved sexp parser. An honest try at using e-sexp is wrapped in a #ifdef at the bottom of the file but is currently not used * providers/imap/camel-imap-folder.c (imap_search_by_expression): We want to do a UID SEARCH so we get UIDs back instead of sequence numbers svn path=/trunk/; revision=4461
* Some IMAP servers don't wrap the UID in ()'s so don't depend on thatJeffrey Stedfast2000-08-011-190/+235
| | | | | | | | | | 2000-07-31 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-folder.c (imap_get_message_info_internal): Some IMAP servers don't wrap the UID in ()'s so don't depend on that (imap_get_summary_internal): Same svn path=/trunk/; revision=4443
* Oops, forgot to free node->function - not good.Jeffrey Stedfast2000-08-011-0/+1
| | | | | | | | | 2000-07-31 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c (free_sexp_node): Oops, forgot to free node->function - not good. svn path=/trunk/; revision=4438
* New convenience function to translate a Camel sexp into the equivalentJeffrey Stedfast2000-08-011-0/+243
| | | | | | | | | | | | | | | | 2000-07-31 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/camel-imap-utils.c (imap_translate_sexp): New convenience function to translate a Camel sexp into the equivalent IMAP sexp. * providers/imap/camel-imap-store.c: More places now use imap_next_word * providers/imap/camel-imap-folder.c (imap_search_by_expression): Implemented initial version (this may or may not work quite right) svn path=/trunk/; revision=4428
* Added camel-imap-utils.[c,h]Jeffrey Stedfast2000-07-281-0/+97
2000-07-27 Jeffrey Stedfast <fejj@helixcode.com> * providers/imap/Makefile.am: Added camel-imap-utils.[c,h] * providers/imap/camel-imap-utils.[c,h]: Utilities for parsing server responses for use in both camel-imap-store.c and camel-imap-folder.c * providers/imap/camel-imap-folder.c (imap_get_summary_internal): Free all the pointers in the headers array. (imap_get_subfolder_names_internal): Updated to use imap_parse_list_response (imap_parse_subfolder_list): Removed in favor of imap_parse_list_response * providers/imap/camel-imap-store.c (camel_imap_command_extended): Free all the pointers in the data array. (imap_connect): Updated to use imap_parse_list_response and fixed a leak (folder_is_selectable): Updated. svn path=/trunk/; revision=4400