diff options
author | Not Zed <NotZed@Ximian.com> | 2004-03-17 17:23:49 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-03-17 17:23:49 +0800 |
commit | bc5fc28e5b2e3602b186ee430d45c48c919ae9da (patch) | |
tree | aac73e0cd1cac5beaf610e49773fd4fac98a4a5f /camel/camel-disco-diary.c | |
parent | cf4811b131d3d791da98de338a477a452663d183 (diff) | |
download | gsoc2013-evolution-bc5fc28e5b2e3602b186ee430d45c48c919ae9da.tar.gz gsoc2013-evolution-bc5fc28e5b2e3602b186ee430d45c48c919ae9da.tar.zst gsoc2013-evolution-bc5fc28e5b2e3602b186ee430d45c48c919ae9da.zip |
See bug #55618.
2004-03-17 Not Zed <NotZed@Ximian.com>
* See bug #55618.
* camel-disco-diary.c (camel_disco_diary_new): seek to the end of
the file after we open it. c99 apparently says the file merely
adds to the end of the file when you write, not that it is opened
and positioned at the end of the file (linux's man pages are out
of date).
* camel-folder-summary.c (content_info_new): setup the content
type as well, from the headers.
* providers/imap/camel-imap-summary.c
(camel_imap_summary_add_offline): copy size from the source info.
svn path=/trunk/; revision=25096
Diffstat (limited to 'camel/camel-disco-diary.c')
-rw-r--r-- | camel/camel-disco-diary.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/camel/camel-disco-diary.c b/camel/camel-disco-diary.c index 927a97f432..5080ddea8e 100644 --- a/camel/camel-disco-diary.c +++ b/camel/camel-disco-diary.c @@ -39,6 +39,7 @@ #include "camel-session.h" #include "camel-store.h" +#define d(x) static void camel_disco_diary_class_init (CamelDiscoDiaryClass *camel_disco_diary_class) @@ -119,6 +120,8 @@ camel_disco_diary_log (CamelDiscoDiary *diary, CamelDiscoDiaryAction action, va_list ap; int status; + d(printf("diary log: %s\n", diary->file?"ok":"no file!")); + /* You may already be a loser. */ if (!diary->file) return; @@ -134,6 +137,8 @@ camel_disco_diary_log (CamelDiscoDiary *diary, CamelDiscoDiaryAction action, CamelFolder *folder = va_arg (ap, CamelFolder *); GPtrArray *uids = va_arg (ap, GPtrArray *); + d(printf(" folder expunge '%s'\n", folder->full_name)); + status = camel_file_util_encode_string (diary->file, folder->full_name); if (status != -1) status = diary_encode_uids (diary, uids); @@ -145,6 +150,8 @@ camel_disco_diary_log (CamelDiscoDiary *diary, CamelDiscoDiaryAction action, CamelFolder *folder = va_arg (ap, CamelFolder *); char *uid = va_arg (ap, char *); + d(printf(" folder append '%s'\n", folder->full_name)); + status = camel_file_util_encode_string (diary->file, folder->full_name); if (status != -1) status = camel_file_util_encode_string (diary->file, uid); @@ -158,6 +165,8 @@ camel_disco_diary_log (CamelDiscoDiary *diary, CamelDiscoDiaryAction action, GPtrArray *uids = va_arg (ap, GPtrArray *); gboolean delete_originals = va_arg (ap, gboolean); + d(printf(" folder transfer '%s' to '%s'\n", source->full_name, destination->full_name)); + status = camel_file_util_encode_string (diary->file, source->full_name); if (status == -1) break; @@ -274,6 +283,8 @@ camel_disco_diary_replay (CamelDiscoDiary *diary, CamelException *ex) off_t size; double pc; + d(printf("disco diary replay\n")); + fseek (diary->file, 0, SEEK_END); size = ftell (diary->file); g_return_if_fail (size != 0); @@ -403,6 +414,20 @@ camel_disco_diary_new (CamelDiscoStore *store, const char *filename, CamelExcept diary = CAMEL_DISCO_DIARY (camel_object_new (CAMEL_DISCO_DIARY_TYPE)); diary->store = store; + d(printf("diary log file '%s'\n", filename)); + + /* Note that the linux man page says: + + a+ Open for reading and appending (writing at end of file). The + file is created if it does not exist. The stream is positioned + at the end of the file. + However, c99 (which glibc uses?) says: + a+ append; open or create text file for update, writing at + end-of-file + + So we must seek ourselves. + */ + diary->file = fopen (filename, "a+"); if (!diary->file) { camel_object_unref (diary); @@ -412,6 +437,10 @@ camel_disco_diary_new (CamelDiscoStore *store, const char *filename, CamelExcept return NULL; } + fseek(diary->file, 0, SEEK_END); + + d(printf(" is at %ld\n", ftell(diary->file))); + return diary; } |