diff options
-rw-r--r-- | camel/ChangeLog | 62 | ||||
-rw-r--r-- | camel/camel-folder-summary.c | 59 | ||||
-rw-r--r-- | camel/camel-folder-summary.h | 3 | ||||
-rw-r--r-- | camel/camel-folder.c | 14 | ||||
-rw-r--r-- | camel/camel-folder.h | 1 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 29 | ||||
-rw-r--r-- | camel/camel-mime-utils.h | 3 | ||||
-rw-r--r-- | camel/providers/Makefile.am | 2 |
8 files changed, 123 insertions, 50 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 29827ee439..9d8c83e245 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,65 @@ +2000-11-15 Not Zed <NotZed@HelixCode.com> + + * providers/Makefile.am: Removed local again, not quite ready. + +2000-11-14 Not Zed <NotZed@HelixCode.com> + + * 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 <NotZed@HelixCode.com> + + * 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 <NotZed@HelixCode.com> + + * 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. + 2000-11-14 Jeffrey Stedfast <fejj@helixcode.com> * camel-stream.c (camel_stream_printf): Don't cast an int to a 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, diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h index 9908c1283e..65018ba3c8 100644 --- a/camel/camel-folder-summary.h +++ b/camel/camel-folder-summary.h @@ -153,6 +153,9 @@ struct _CamelFolderSummaryClass { CamelMessageContentInfo * (*content_info_load)(CamelFolderSummary *, FILE *); int (*content_info_save)(CamelFolderSummary *, FILE *, CamelMessageContentInfo *); void (*content_info_free)(CamelFolderSummary *, CamelMessageContentInfo *); + + /* get the next uid */ + char *(*next_uid_string)(CamelFolderSummary *); }; guint camel_folder_summary_get_type (void); diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 1d929fb4f0..f2fd6a4cec 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -1321,6 +1321,20 @@ change_info_clear(GPtrArray *uids) } /** + * camel_folder_change_info_changed: + * @info: + * + * Return true if the changeset contains any changes. + * + * Return Value: + **/ +gboolean +camel_folder_change_info_changed(CamelFolderChangeInfo *info) +{ + return (info->uid_added->len || info->uid_removed->len || info->uid_changed->len); +} + +/** * camel_folder_change_info_clear: * @info: * diff --git a/camel/camel-folder.h b/camel/camel-folder.h index 12fe86f4b8..f7a3659f31 100644 --- a/camel/camel-folder.h +++ b/camel/camel-folder.h @@ -275,6 +275,7 @@ void camel_folder_free_deep (CamelFolder *folder, GPtrArray *array); CamelFolderChangeInfo * camel_folder_change_info_new (void); void camel_folder_change_info_clear (CamelFolderChangeInfo *info); void camel_folder_change_info_free (CamelFolderChangeInfo *info); +gboolean camel_folder_change_info_changed (CamelFolderChangeInfo *info); /* for building diff's automatically */ void camel_folder_change_info_add_source (CamelFolderChangeInfo *info, const char *uid); diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 0bc0fa24dc..8db0e23fe4 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -2168,7 +2168,7 @@ header_mime_decode(const char *in, int *maj, int *min) } static struct _header_param * -header_param_list_decode(const char **in) +header_decode_param_list(const char **in) { const char *inptr = *in; struct _header_param *head = NULL, *tail = NULL; @@ -2198,7 +2198,16 @@ header_param_list_decode(const char **in) return head; } -static void +struct _header_param * +header_param_list_decode(const char *in) +{ + if (in == NULL) + return NULL; + + return header_decode_param_list(&in); +} + +void header_param_list_format_append(GString *out, struct _header_param *p) { int len = out->len; @@ -2227,6 +2236,18 @@ header_param_list_format_append(GString *out, struct _header_param *p) } } +char * +header_param_list_format(struct _header_param *p) +{ + GString *out = g_string_new(""); + char *ret; + + header_param_list_format_append(out, p); + ret = out->str; + g_string_free(out, FALSE); + return ret; +} + struct _header_content_type * header_content_type_decode(const char *in) { @@ -2253,7 +2274,7 @@ header_content_type_decode(const char *in) } t = header_content_type_new(type, subtype); - t->params = header_param_list_decode(&inptr); + t->params = header_decode_param_list(&inptr); g_free(type); g_free(subtype); } else { @@ -2334,7 +2355,7 @@ CamelMimeDisposition *header_disposition_decode(const char *in) d->disposition = decode_token(&inptr); if (d->disposition == NULL) w(g_warning("Empty disposition type")); - d->params = header_param_list_decode(&inptr); + d->params = header_decode_param_list(&inptr); return d; } diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h index 33a70cc908..c5e19e667e 100644 --- a/camel/camel-mime-utils.h +++ b/camel/camel-mime-utils.h @@ -102,8 +102,11 @@ char *header_address_list_encode(struct _header_address *a); char *header_address_list_format(struct _header_address *a); /* structured header prameters */ +struct _header_param *header_param_list_decode(const char *in); char *header_param(struct _header_param *p, const char *name); struct _header_param *header_set_param(struct _header_param **l, const char *name, const char *value); +void header_param_list_format_append(GString *out, struct _header_param *p); +char *header_param_list_format(struct _header_param *p); void header_param_list_free(struct _header_param *p); /* Content-Type header */ diff --git a/camel/providers/Makefile.am b/camel/providers/Makefile.am index dedeaa0b3b..f29b0c2808 100644 --- a/camel/providers/Makefile.am +++ b/camel/providers/Makefile.am @@ -4,4 +4,4 @@ SUBDIRS = mbox pop3 sendmail smtp vee imap mh nntp # these ones are disabled for the moment. -# maildir +# maildir local |