aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-10-04 23:56:32 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-10-04 23:56:32 +0800
commit47a2f8444fed208beaa353c9d1da69c970e91d4c (patch)
tree9b5f06c358ccbd0bdcb8cd1fcf9b07a5aeac9a28 /camel
parent58eba683f83f3b6e2ca023c34e6eae647d929409 (diff)
downloadgsoc2013-evolution-47a2f8444fed208beaa353c9d1da69c970e91d4c.tar.gz
gsoc2013-evolution-47a2f8444fed208beaa353c9d1da69c970e91d4c.tar.zst
gsoc2013-evolution-47a2f8444fed208beaa353c9d1da69c970e91d4c.zip
Handle the case where ct != NULL, but type and subtype are, and also match
2000-10-04 Not Zed <NotZed@HelixCode.com> * camel-mime-utils.c (header_content_type_is): Handle the case where ct != NULL, but type and subtype are, and also match that against text/plain. * camel-folder-summary.c: Bump summary file version. (message_info_save): Save the size from the messageinfo. (message_info_load): Load the size from the summary file. (message_info_load): Fixed up the time_t saving/loading. There was a reason the warning was left there ... obviously nobody could read the comment "/* warnings, leave them here */", why do i even bother. (camel_folder_summary_decode_time_t): Decode a time_t value from the summary file. (camel_folder_summary_encode_time_t): Encode a time_t value to the summary file. svn path=/trunk/; revision=5706
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog19
-rw-r--r--camel/camel-folder-summary.c47
-rw-r--r--camel/camel-folder-summary.h3
-rw-r--r--camel/camel-mime-utils.c4
4 files changed, 59 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b656d163fb..a36fcff1a1 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,21 @@
+2000-10-04 Not Zed <NotZed@HelixCode.com>
+
+ * camel-mime-utils.c (header_content_type_is): Handle the case
+ where ct != NULL, but type and subtype are, and also match that
+ against text/plain.
+
+ * camel-folder-summary.c: Bump summary file version.
+ (message_info_save): Save the size from the messageinfo.
+ (message_info_load): Load the size from the summary file.
+ (message_info_load): Fixed up the time_t saving/loading. There
+ was a reason the warning was left there ... obviously nobody could
+ read the comment "/* warnings, leave them here */", why do i even
+ bother.
+ (camel_folder_summary_decode_time_t): Decode a time_t value from
+ the summary file.
+ (camel_folder_summary_encode_time_t): Encode a time_t value to the
+ summary file.
+
2000-10-03 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-command.c (camel_imap_command): Quote
@@ -132,6 +150,7 @@
* providers/imap/camel-imap-stream.c (stream_read): Same.
+>>>>>>> 1.503
2000-09-28 Not Zed <NotZed@HelixCode.com>
* camel-mime-utils.c (header_fold): New function to fold headers.
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 2653836b13..5bbb240be1 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -48,7 +48,7 @@
extern int strdup_count, malloc_count, free_count;
#endif
-#define CAMEL_FOLDER_SUMMARY_VERSION (7)
+#define CAMEL_FOLDER_SUMMARY_VERSION (8)
struct _CamelFolderSummaryPrivate {
GHashTable *filter_charset; /* CamelMimeFilterCharset's indexed by source charset */
@@ -541,7 +541,7 @@ camel_folder_summary_encode_uint32(FILE *out, guint32 value)
int
camel_folder_summary_decode_uint32(FILE *in, guint32 *dest)
{
- gint32 value=0, v;
+ guint32 value=0, v;
/* until we get the last byte, keep decoding 7 bits at a time */
while ( ((v = fgetc(in)) & 0x80) == 0 && v!=EOF) {
@@ -583,6 +583,33 @@ camel_folder_summary_decode_fixed_int32(FILE *in, gint32 *dest)
}
}
+int
+camel_folder_summary_encode_time_t(FILE *out, time_t value)
+{
+ int i;
+
+ for (i=sizeof(time_t)-1;i>=0;i--) {
+ if (fputc((value >> (i*8)) & 0xff, out) == -1)
+ return -1;
+ }
+ return 0;
+}
+
+int
+camel_folder_summary_decode_time_t(FILE *in, time_t *dest)
+{
+ time_t save = 0;
+ unsigned int v;
+ int i = sizeof(time_t) - 1;
+
+ while ( i>=0 && (v = fgetc(in)) != EOF) {
+ save |= v << (i*8);
+ i--;
+ }
+ *dest = save;
+ return 0;
+}
+
/* should be sorted, for binary search */
/* This is a tokenisation mechanism for strings written to the
summary - to save space.
@@ -961,7 +988,6 @@ static CamelMessageInfo *
message_info_load(CamelFolderSummary *s, FILE *in)
{
CamelMessageInfo *mi;
- guint32 udate_sent, udate_received;
guint count;
int i;
@@ -971,18 +997,15 @@ message_info_load(CamelFolderSummary *s, FILE *in)
camel_folder_summary_decode_string(in, &mi->uid);
camel_folder_summary_decode_uint32(in, &mi->flags);
- camel_folder_summary_decode_uint32(in, &udate_sent); /* warnings, leave them here */
- camel_folder_summary_decode_uint32(in, &udate_received);
-/* ms->xev_offset = camel_folder_summary_decode_uint32(in);*/
+ camel_folder_summary_decode_uint32(in, &mi->size);
+ camel_folder_summary_decode_time_t(in, &mi->date_sent);
+ camel_folder_summary_decode_time_t(in, &mi->date_received);
camel_folder_summary_decode_string(in, &mi->subject);
camel_folder_summary_decode_string(in, &mi->from);
camel_folder_summary_decode_string(in, &mi->to);
camel_folder_summary_decode_string(in, &mi->cc);
mi->content = NULL;
- mi->date_sent = (time_t) udate_sent;
- mi->date_received = (time_t) udate_received;
-
camel_folder_summary_decode_string(in, &mi->message_id);
camel_folder_summary_decode_uint32(in, &count);
@@ -1025,9 +1048,9 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
camel_folder_summary_encode_string(out, mi->uid);
camel_folder_summary_encode_uint32(out, mi->flags);
- camel_folder_summary_encode_uint32(out, mi->date_sent);
- camel_folder_summary_encode_uint32(out, mi->date_received);
-/* camel_folder_summary_encode_uint32(out, ms->xev_offset);*/
+ camel_folder_summary_encode_uint32(out, mi->size);
+ camel_folder_summary_encode_time_t(out, mi->date_sent);
+ camel_folder_summary_encode_time_t(out, mi->date_received);
camel_folder_summary_encode_string(out, mi->subject);
camel_folder_summary_encode_string(out, mi->from);
camel_folder_summary_encode_string(out, mi->to);
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index cebaaa7066..ec1799e103 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -203,6 +203,9 @@ int camel_folder_summary_decode_fixed_int32(FILE *, gint32 *);
int camel_folder_summary_encode_uint32(FILE *, guint32);
int camel_folder_summary_decode_uint32(FILE *, guint32 *);
+int camel_folder_summary_encode_time_t(FILE *out, time_t value);
+int camel_folder_summary_decode_time_t(FILE *in, time_t *dest);
+
int camel_folder_summary_encode_string(FILE *, char *);
int camel_folder_summary_decode_string(FILE *, char **);
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 907fc7e4fb..d7136c79f5 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -1537,7 +1537,7 @@ int
header_content_type_is(struct _header_content_type *ct, const char *type, const char *subtype)
{
/* no type == text/plain or text/"*" */
- if (ct==NULL) {
+ if (ct==NULL || (ct->type == NULL && ct->subtype == NULL)) {
return (!strcasecmp(type, "text")
&& (!strcasecmp(subtype, "plain")
|| !strcasecmp(subtype, "*")));
@@ -1738,12 +1738,12 @@ header_decode_mailbox(const char **in)
while (pre) {
char *text;
+ /* perform internationalised decoding, and appent */
text = header_decode_string(pre);
name = g_string_append(name, text);
g_free(pre);
g_free(text);
- /* rfc_decode(pre) */
pre = header_decode_word(&inptr);
if (pre)
name = g_string_append_c(name, ' ');