diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-02-21 00:01:01 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-02-21 00:01:01 +0800 |
commit | bc081447ebfff72bd9310306f40f286415f319c9 (patch) | |
tree | 2697dff521b5a182cf245f80ac4971fce81ee809 /mail/mail-ops.c | |
parent | 3c48cf5fc086d2f2b5ad0f56f6f58f2b83280fb7 (diff) | |
download | gsoc2013-evolution-bc081447ebfff72bd9310306f40f286415f319c9.tar.gz gsoc2013-evolution-bc081447ebfff72bd9310306f40f286415f319c9.tar.zst gsoc2013-evolution-bc081447ebfff72bd9310306f40f286415f319c9.zip |
Fix for bug 322160.
svn path=/trunk/; revision=31548
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 119c203571..23dc550e0a 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -2083,6 +2083,7 @@ struct _save_part_msg { char *path; void (*done)(CamelMimePart *part, char *path, int saved, void *data); void *data; + gboolean readonly; }; static char *save_part_desc(struct _mail_msg *mm, int done) @@ -2097,7 +2098,14 @@ save_part_save (struct _mail_msg *mm) CamelDataWrapper *content; CamelStream *stream; - if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) { + if(!m->readonly){ + if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0666))) { + camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, + _("Cannot create output file: %s:\n %s"), + m->path, g_strerror (errno)); + return; + } + } else if (!(stream = camel_stream_fs_new_with_name (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0444))) { camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create output file: %s:\n %s"), m->path, g_strerror (errno)); @@ -2128,7 +2136,6 @@ static void save_part_free (struct _mail_msg *mm) { struct _save_part_msg *m = (struct _save_part_msg *)mm; - camel_object_unref (m->part); g_free (m->path); } @@ -2142,17 +2149,17 @@ static struct _mail_msg_op save_part_op = { int mail_save_part (CamelMimePart *part, const char *path, - void (*done)(CamelMimePart *part, char *path, int saved, void *data), void *data) + void (*done)(CamelMimePart *part, char *path, int saved, void *data), void *data, gboolean readonly) { struct _save_part_msg *m; int id; - m = mail_msg_new (&save_part_op, NULL, sizeof (*m)); m->part = part; camel_object_ref (part); m->path = g_strdup (path); m->data = data; m->done = done; + m->readonly = readonly; id = m->msg.seq; e_thread_put (mail_thread_new, (EMsg *)m); |