Switch core from strerror to g_strerror
[claws.git] / src / mbox.c
index 89c1677a30b98dedca7de26192b0fcb6e1f08473..92a6b5d65dded20fff33bff91ea8c4b547fc7a79 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
+ *
  */
 
 #ifdef HAVE_CONFIG_H
 #define _GNU_SOURCE
 #include <stdio.h>
 
+#ifdef USE_PTHREAD
+#include <pthread.h>
+#endif
+
 #include "defs.h"
 #include <glib.h>
 #include <glib/gi18n.h>
@@ -53,7 +57,7 @@
 #include "alertpanel.h"
 #include "statusbar.h"
 
-#define MSGBUFSIZE     8192
+#define MESSAGEBUFSIZE 8192
 
 #ifdef HAVE_FGETS_UNLOCKED
 #define SC_FGETS fgets_unlocked
@@ -83,7 +87,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
 /* return values: -1 error, >=0 number of msgs added */
 {
        FILE *mbox_fp;
-       gchar buf[MSGBUFSIZE];
+       gchar buf[MESSAGEBUFSIZE];
        gchar *tmp_file;
        gint msgs = 0;
        gint lines;
@@ -124,7 +128,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
        folder_item_update_freeze();
 
        if (apply_filter)
-               dropfolder = folder_get_default_processing();
+               dropfolder = folder_get_default_processing(account->account_id);
        else
                dropfolder = dest;
        
@@ -136,7 +140,9 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
                if (msgs > 0 && msgs%500 == 0) {
                        if (printed)
                                statusbar_pop_all();
-                       statusbar_print_all(_("Importing from mbox... (%d mails imported)"), msgs);
+                       statusbar_print_all(
+                                       ngettext("Importing from mbox... (%d mail imported)",
+                                               "Importing from mbox... (%d mails imported)", msgs), msgs);
                        printed=TRUE;
                        GTK_EVENTS_FLUSH();
                }
@@ -373,7 +379,8 @@ gint lock_mbox(const gchar *base, LockType type)
                
 #if HAVE_FCNTL_H && !defined(G_OS_WIN32)
                if (fcntl(lockfd, F_SETLK, &fl) == -1) {
-                       g_warning("can't fnctl %s (%s)", base, strerror(errno));
+                       g_warning("can't fnctl %s (%s)", base, g_strerror(errno));
+                       close(lockfd);
                        return -1;
                } else {
                        fcntled = TRUE;
@@ -503,7 +510,7 @@ gint copy_mbox(gint srcfd, const gchar *dest)
 
        if (save_errno != 0) {
                g_warning("error %d reading mbox: %s\n", save_errno,
-                               strerror(save_errno));
+                               g_strerror(save_errno));
                err = TRUE;
        }