aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-mbox-summary.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-11-11 14:24:56 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-11-11 14:24:56 +0800
commit3eabd14ace6523781473486b533b8e4ac355fc14 (patch)
tree29d9174bec983d227fefa0d5e480ee8a7aff1509 /camel/providers/local/camel-mbox-summary.c
parentd11a036199c97b083f531c03004f6ef20b38f843 (diff)
downloadgsoc2013-evolution-3eabd14ace6523781473486b533b8e4ac355fc14.tar
gsoc2013-evolution-3eabd14ace6523781473486b533b8e4ac355fc14.tar.gz
gsoc2013-evolution-3eabd14ace6523781473486b533b8e4ac355fc14.tar.bz2
gsoc2013-evolution-3eabd14ace6523781473486b533b8e4ac355fc14.tar.lz
gsoc2013-evolution-3eabd14ace6523781473486b533b8e4ac355fc14.tar.xz
gsoc2013-evolution-3eabd14ace6523781473486b533b8e4ac355fc14.tar.zst
gsoc2013-evolution-3eabd14ace6523781473486b533b8e4ac355fc14.zip
Use g_strerror when setting an exception string (we need it to be in
2002-11-11 Jeffrey Stedfast <fejj@ximian.com> * providers/local/camel-spool-summary.c (spool_summary_sync_full): Use g_strerror when setting an exception string (we need it to be in UTF-8). (spool_summary_check): Here too. * providers/local/camel-spool-store.c (construct): Use g_strerror when setting an exception string (we need it to be in UTF-8). (get_folder): Same. (scan_dir): Here too. * providers/local/camel-spool-folder.c (spool_lock): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-mh-summary.c (mh_summary_check): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-mh-store.c (delete_folder): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-mbox-summary.c (summary_update): Use g_strerror when setting an exception string (we need it to be in UTF-8). (mbox_summary_sync_full): Here too. (mbox_summary_sync_quick): Same. (mbox_summary_sync): Also here. (camel_mbox_summary_sync_mbox): Again here. * providers/local/camel-mbox-folder.c (mbox_lock): Use g_strerror when setting an exception string (we need it to be in UTF-8). (mbox_append_message): Same. (mbox_get_message): Here too. * providers/local/camel-maildir-summary.c (maildir_summary_load): Use g_strerror when setting an exception string (we need it to be in UTF-8). (maildir_summary_check): Same. * providers/local/camel-maildir-store.c (get_folder): Use g_strerror when setting an exception string (we need it to be in UTF-8). (delete_folder): Same. (delete_folder): Here too. * providers/local/camel-local-summary.c (local_summary_sync): Use g_strerror when setting an exception string (we need it to be in UTF-8). * providers/local/camel-local-store.c (get_folder): Use g_strerror when setting an exception string (we need it to be in UTF-8). (create_folder): Same. (xrename): Here too. (rename_folder): And here. (delete_folder): Also here. * camel-provider.c (camel_provider_init): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). * camel-movemail.c (camel_movemail): Use g_strerror when setting an exception string (we need it to be in UTF-8). (movemail_external): Same. (camel_movemail_copy_file): Here too. (camel_movemail_solaris): Also here. * camel-mime-utils.c (rfc2047_decode_word): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). (header_encode_param): Same. * camel-mime-part-utils.c (convert_buffer): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). * camel-lock-client.c (camel_lock_helper_init): Use g_strerror when setting an exception string (we need it to be in UTF-8). * camel-data-cache.c (camel_data_cache_remove): Use g_strerror when setting an exception string (we need it to be in UTF-8). * camel-tcp-stream-raw.c (flaky_tcp_write): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). (flaky_tcp_read): Same. * camel-gpg-context.c (gpg_ctx_op_step): For debugging printfs, we want to use normal strerror (we want locale charset, not UTF-8). * camel-service.c (camel_gethostbyname): Use g_strerror when setting an exception string (we need it to be in UTF-8). * camel-lock.c (camel_lock_dot): Use g_strerror when setting an exception string (we need it to be in UTF-8). (camel_lock_fcntl): Same. svn path=/trunk/; revision=18689
Diffstat (limited to 'camel/providers/local/camel-mbox-summary.c')
-rw-r--r--camel/providers/local/camel-mbox-summary.c87
1 files changed, 47 insertions, 40 deletions
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 564914aa59..5b001c0977 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -346,9 +346,10 @@ summary_update(CamelLocalSummary *cls, off_t offset, CamelFolderChangeInfo *chan
fd = open(cls->folder_path, O_RDONLY);
if (fd == -1) {
- d(printf("%s failed to open: %s\n", cls->folder_path, strerror(errno)));
- camel_exception_setv(ex, 1, _("Could not open folder: %s: %s"),
- cls->folder_path, strerror(errno));
+ d(printf("%s failed to open: %s\n", cls->folder_path, strerror (errno)));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not open folder: %s: %s"),
+ cls->folder_path, g_strerror (errno));
camel_operation_end(NULL);
return -1;
}
@@ -450,7 +451,9 @@ mbox_summary_check(CamelLocalSummary *cls, CamelFolderChangeInfo *changes, Camel
/* check if the summary is up-to-date */
if (stat(cls->folder_path, &st) == -1) {
camel_folder_summary_clear(s);
- camel_exception_setv(ex, 1, _("Cannot check folder: %s: %s"), cls->folder_path, strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot check folder: %s: %s"),
+ cls->folder_path, g_strerror (errno));
return -1;
}
@@ -584,9 +587,9 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
fd = open(cls->folder_path, O_RDONLY);
if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open file: %s: %s"),
- cls->folder_path, strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not open file: %s: %s"),
+ cls->folder_path, g_strerror (errno));
camel_operation_end(NULL);
return -1;
}
@@ -596,8 +599,9 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
d(printf("Writing tmp file to %s\n", tmpname));
fdout = open(tmpname, O_WRONLY|O_CREAT|O_TRUNC, 0600);
if (fdout == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot open temporary mailbox: %s"), strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot open temporary mailbox: %s"),
+ g_strerror (errno));
goto error;
}
@@ -607,19 +611,19 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
d(printf("Closing folders\n"));
if (close(fd) == -1) {
- g_warning("Cannot close source folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not close source folder %s: %s"),
- cls->folder_path, strerror(errno));
+ g_warning("Cannot close source folder: %s", strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not close source folder %s: %s"),
+ cls->folder_path, g_strerror (errno));
fd = -1;
goto error;
}
if (close(fdout) == -1) {
- g_warning("Cannot close tmp folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not close temp folder: %s"),
- strerror(errno));
+ g_warning("Cannot close tmp folder: %s", strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not close temp folder: %s"),
+ g_strerror (errno));
fdout = -1;
goto error;
}
@@ -627,10 +631,10 @@ mbox_summary_sync_full(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChang
/* this should probably either use unlink/link/unlink, or recopy over
the original mailbox, for various locking reasons/etc */
if (rename(tmpname, cls->folder_path) == -1) {
- g_warning("Cannot rename folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not rename folder: %s"),
- strerror(errno));
+ g_warning("Cannot rename folder: %s", strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not rename folder: %s"),
+ g_strerror (errno));
goto error;
}
tmpname = NULL;
@@ -674,9 +678,9 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
fd = open(cls->folder_path, O_RDWR);
if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not open file: %s: %s"),
- cls->folder_path, strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not open file: %s: %s"),
+ cls->folder_path, g_strerror (errno));
camel_operation_end(NULL);
return -1;
@@ -769,10 +773,10 @@ mbox_summary_sync_quick(CamelMboxSummary *mbs, gboolean expunge, CamelFolderChan
d(printf("Closing folders\n"));
if (close(fd) == -1) {
- g_warning("Cannot close source folder: %s", strerror(errno));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not close source folder %s: %s"),
- cls->folder_path, strerror(errno));
+ g_warning ("Cannot close source folder: %s", strerror (errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not close source folder %s: %s"),
+ cls->folder_path, g_strerror (errno));
fd = -1;
goto error;
}
@@ -845,7 +849,8 @@ mbox_summary_sync(CamelLocalSummary *cls, gboolean expunge, CamelFolderChangeInf
return -1;
if (stat(cls->folder_path, &st) == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Unknown error: %s"), strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Unknown error: %s"), g_strerror (errno));
return -1;
}
@@ -879,8 +884,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
/* need to dup this because the mime-parser owns the fd after we give it to it */
fd = dup(fd);
if (fd == -1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Could not store folder: %s"), strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Could not store folder: %s"),
+ g_strerror (errno));
return -1;
}
@@ -972,9 +978,9 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
#endif
if (len == -1) {
d(printf("Error writing to tmp mailbox\n"));
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Error writing to temp mailbox: %s"),
- strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Error writing to temp mailbox: %s"),
+ g_strerror (errno));
goto error;
}
info->info.flags &= 0xffff;
@@ -989,17 +995,18 @@ camel_mbox_summary_sync_mbox(CamelMboxSummary *cls, guint32 flags, CamelFolderCh
while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_PRE_FROM) {
/*d(printf("copying mbox contents to tmp: '%.*s'\n", len, buffer));*/
if (write(fdout, buffer, len) != len) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Writing to tmp mailbox failed: %s: %s"),
- ((CamelLocalSummary *)cls)->folder_path, strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Writing to tmp mailbox failed: %s: %s"),
+ ((CamelLocalSummary *)cls)->folder_path,
+ g_strerror (errno));
goto error;
}
}
if (write(fdout, "\n", 1) != 1) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
- _("Error writing to temp mailbox: %s"),
- strerror(errno));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Error writing to temp mailbox: %s"),
+ g_strerror (errno));
goto error;
}