From fb76cad79ae9228a426fcd0e4a39d920ec17d864 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 15 Nov 2000 06:33:49 +0000 Subject: Removed local again, not quite ready. 2000-11-15 Not Zed * providers/Makefile.am: Removed local again, not quite ready. 2000-11-14 Not Zed * camel-folder-summary.c (message_info_new_from_message): Use message_info_new to create the summary from headers, instead of getting directly from the message. (format_recipients): No longer required. * providers/Makefile.am (SUBDIRS): Added local. 2000-11-11 Not Zed * camel-mime-parser.c (folder_push_part): Make sure 'atleast' is at least 1, always. This is possibly a temporary fix for a bad failure mode on bad multipart messages. (folder_scan_content): Go until inend, not inend+1. Changed the continuation and retry logic to be simpler and more robust. If we can't find a marker within the atleast we need, just set it to 1, and try again, rather than just going to the next smaller limit (boundary check checks the length anyway). (header_append): streamline the empty line case. And strip trailing \r's if there are any (\n's already stripped). (folder_scan_header): Reordered and cleaned up a lot. Check for continuation only once, and compress lwsp then. Assume the header buffer already has end of line's stripped, and simplify some things: Only check for end of headers once and easier. Dont check to remove end of line character Dont bother testing inptr-start if we get a boundary match - it is always zero. (folder_scan_header): Removed the unused part variable, and a few pointless assignments. (folder_scan_header): Change the end limit to be 1 higher, to make sure we get all content. (folder_scan_content): And here too. (folder_scan_header): Killed a warning. (folder_push_part): Removed a bad comment. Actually boundarylenfinal can be zero for a new message not in a multipart. So we fix that here. 2000-11-09 Not Zed * camel-mime-utils.c (header_decode_param_list): Renamed from header_param_list_decode. (header_param_list_decode): New external function to decode a parameter list. (header_param_list_format_append): Made public. (header_param_list_format): Another new public helper function for formatting just a param list. * camel-folder-summary.c (next_uid_string): Default implementation is the same as before. (camel_folder_summary_class_init): And set it up. * camel-folder-summary.h: Make next_uid_string a virtual function. * camel-folder.c (camel_folder_change_info_changed): New function to return true if the changeset contains any changes. svn path=/trunk/; revision=6577 --- camel/camel-folder-summary.c | 59 +++++++++++--------------------------------- 1 file changed, 14 insertions(+), 45 deletions(-) (limited to 'camel/camel-folder-summary.c') diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c index 2973083b5b..efb8c1e195 100644 --- a/camel/camel-folder-summary.c +++ b/camel/camel-folder-summary.c @@ -91,6 +91,8 @@ static CamelMessageContentInfo * content_info_load(CamelFolderSummary *, FILE *) static int content_info_save(CamelFolderSummary *, FILE *, CamelMessageContentInfo *); static void content_info_free(CamelFolderSummary *, CamelMessageContentInfo *); +const char *next_uid_string(CamelFolderSummary *s); + static CamelMessageContentInfo * summary_build_content_info(CamelFolderSummary *s, CamelMimeParser *mp); static CamelMessageContentInfo * summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msginfo, CamelMimePart *object); @@ -121,6 +123,8 @@ camel_folder_summary_class_init (CamelFolderSummaryClass *klass) klass->content_info_load = content_info_load; klass->content_info_save = content_info_save; klass->content_info_free = content_info_free; + + klass->next_uid_string = next_uid_string; } static void @@ -352,7 +356,9 @@ void camel_folder_summary_set_uid(CamelFolderSummary *s, guint32 uid) char * camel_folder_summary_next_uid_string(CamelFolderSummary *s) { - return g_strdup_printf("%u", camel_folder_summary_next_uid(s)); + char *(*next_uid_string)(CamelFolderSummary *); + + return ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->next_uid_string(s); } /* loads the content descriptions, recursively */ @@ -1369,54 +1375,11 @@ static CamelMessageContentInfo * content_info_new_from_parser(CamelFolderSummary return ci; } -static char * -format_recipients(const CamelInternetAddress *addr) -{ - const char *namep, *addrp; - char *ret; - int i; - GString *out; - - if (addr == NULL) - return NULL; - - out = g_string_new(""); - - for (i=0;camel_internet_address_get(addr, i, &namep, &addrp);i++) { - if (i>0) - g_string_append(out, ", "); - if (namep) - g_string_sprintfa(out, "%s <%s>", namep, addrp); - else - g_string_sprintfa(out, "<%s>", addrp); - } - /* well, this is probably more memory efficient, unfortunately */ - ret = g_strdup(out->str); - g_string_free(out, TRUE); - - return ret; -} - static CamelMessageInfo * message_info_new_from_message(CamelFolderSummary *s, CamelMimeMessage *msg) { CamelMessageInfo *mi; - mi = g_malloc0(s->message_info_size); - - mi->subject = g_strdup(camel_mime_message_get_subject(msg)); - mi->from = camel_address_format((CamelAddress *)camel_mime_message_get_from(msg)); - mi->to = format_recipients(camel_mime_message_get_recipients(msg, "to")); - mi->cc = format_recipients(camel_mime_message_get_recipients(msg, "cc")); - mi->user_flags = NULL; - mi->user_tags = NULL; - mi->date_sent = camel_mime_message_get_date(msg, NULL); - mi->date_received = camel_mime_message_get_date_received(msg, NULL); - mi->message_id = header_msgid_decode(camel_medium_get_header((CamelMedium *)msg, "message-id")); - /* if we have a references, use that, otherwise, see if we have an in-reply-to - header, with parsable content, otherwise *shrug* */ - mi->references = header_references_decode(camel_medium_get_header((CamelMedium *)msg, "message-id")); - if (mi->references == NULL) - mi->references = header_references_decode(camel_medium_get_header((CamelMedium *)msg, "message-id")); + mi = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new(s, ((CamelMimePart *)msg)->headers); return mi; } @@ -1706,6 +1669,12 @@ content_info_free(CamelFolderSummary *s, CamelMessageContentInfo *ci) g_free(ci); } +const char * +next_uid_string(CamelFolderSummary *s) +{ + return g_strdup_printf("%u", camel_folder_summary_next_uid(s)); +} + /* OK Now this is where all the "smarts" happen, where the content info is built, -- cgit v1.2.3