#include "advsearch.h"
#include "avatars.h"
#include "passwordstore.h"
+#include "file-utils.h"
#ifdef HAVE_LIBETPAN
#include "imap-thread.h"
{
gboolean autochk = GPOINTER_TO_INT(data);
- inc_all_account_mail(static_mainwindow, autochk,
+ if (!sc_starting) {
+ inc_all_account_mail(static_mainwindow, autochk, FALSE,
prefs_common.newmail_notify_manu);
- if (sc_starting) {
+ } else {
+ inc_all_account_mail(static_mainwindow, FALSE,
+ prefs_common.chk_on_startup,
+ prefs_common.newmail_notify_manu);
sc_starting = FALSE;
main_window_set_menu_sensitive(static_mainwindow);
toolbar_main_set_sensitive(static_mainwindow);
gchar buf[BUFFSIZE];
gboolean err = FALSE;
- oldfp = g_fopen(old_rc, "r");
+ oldfp = claws_fopen(old_rc, "r");
if (!oldfp)
return -1;
- newfp = g_fopen(new_rc, "w");
+ newfp = claws_fopen(new_rc, "w");
if (!newfp) {
- fclose(oldfp);
+ claws_fclose(oldfp);
return -1;
}
old_plugin_path = g_strdup(new_plugin_path);
}
debug_print("replacing %s with %s\n", old_plugin_path, new_plugin_path);
- while (fgets(buf, sizeof(buf), oldfp)) {
+ while (claws_fgets(buf, sizeof(buf), oldfp)) {
if (strncmp(buf, old_plugin_path, strlen(old_plugin_path))) {
- err |= (fputs(buf, newfp) == EOF);
+ err |= (claws_fputs(buf, newfp) == EOF);
} else {
debug_print("->replacing %s\n", buf);
debug_print(" with %s%s\n", new_plugin_path, buf+strlen(old_plugin_path));
- err |= (fputs(new_plugin_path, newfp) == EOF);
- err |= (fputs(buf+strlen(old_plugin_path), newfp) == EOF);
+ err |= (claws_fputs(new_plugin_path, newfp) == EOF);
+ err |= (claws_fputs(buf+strlen(old_plugin_path), newfp) == EOF);
}
}
g_free(plugin_path);
g_free(new_plugin_path);
g_free(old_plugin_path);
- fclose(oldfp);
- if (fclose(newfp) == EOF)
+ claws_fclose(oldfp);
+ if (claws_safe_fclose(newfp) == EOF)
err = TRUE;
return (err ? -1:0);
if (rename_force(logfile, oldlogfile) < 0)
FILE_OP_ERROR(logfile, "rename");
}
- win32_debug_fp = g_fopen(logfile, "w");
+ win32_debug_fp = claws_fopen(logfile, "w");
g_free(logfile);
g_free(oldlogfile);
if (win32_debug_fp)
g_log_remove_handler("", win32_log_handler_app_id);
g_log_remove_handler("GLib", win32_log_handler_glib_id);
g_log_remove_handler("Gtk", win32_log_handler_gtk_id);
- fclose(win32_debug_fp);
+ claws_fclose(win32_debug_fp);
win32_debug_fp=NULL;
}
}
#ifdef CRASH_DIALOG
if (cmd.crash) {
-#if !GTK_CHECK_VERSION(3, 0, 0)
gtk_set_locale();
-#endif
gtk_init(&argc, &argv);
crash_main(cmd.crash_params);
#ifdef G_OS_WIN32
reset_statistics();
-#if !GTK_CHECK_VERSION(3, 0, 0)
gtk_set_locale();
-#endif
gtk_init(&argc, &argv);
#ifdef G_OS_WIN32
}
#endif
-#if !GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_set_default_colormap(
gdk_screen_get_system_colormap(
gdk_screen_get_default()));
-#endif
gtkut_create_ui_manager();
folder_item_update_freeze();
}
/* make the crash-indicator file */
- str_write_to_file("foo", get_crashfile_name());
+ str_write_to_file("foo", get_crashfile_name(), FALSE);
inc_autocheck_timer_init(mainwin);
claws_done();
}
-#define G_STRING_APPEND_ENCODED_URI(gstring,source) \
- { \
- gchar tmpbuf[BUFFSIZE]; \
- encode_uri(tmpbuf, BUFFSIZE, (source)); \
- g_string_append((gstring), tmpbuf); \
- }
-
#define G_PRINT_EXIT(msg) \
{ \
g_print(msg); \
if (isstdin)
fp = stdin;
else {
- fp = g_fopen(fn, "r");
+ fp = claws_fopen(fn, "r");
if (!fp)
G_PRINT_EXIT(_("Cannot open filename for reading\n"));
}
- while (fgets(fb, sizeof(fb), fp)) {
+ while (claws_fgets(fb, sizeof(fb), fp)) {
gchar *tmp;
strretchomp(fb);
if (*fb == '\0')
g_string_append(body, to);
g_free(to);
g_string_append(body, "?body=");
- while (fgets(fb, sizeof(fb), fp)) {
+ while (claws_fgets(fb, sizeof(fb), fp)) {
g_string_append_uri_escaped(body, fb, NULL, TRUE);
}
if (!isstdin)
- fclose(fp);
+ claws_fclose(fp);
/* append the remaining headers */
g_string_append(body, headers->str);
g_string_free(headers, TRUE);
return body;
}
-#undef G_STRING_APPEND_ENCODED_URI
#undef G_PRINT_EXIT
static void parse_cmd_opt(int argc, char *argv[])
fd_gets(uxsock, buf, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';
if (!strncmp(buf, ".\n", 2)) break;
- fputs(buf, stdout);
+ claws_fputs(buf, stdout);
}
} else if (cmd.exit) {
fd_write_all(uxsock, "exit\n", 5);
fd_gets(uxsock, buf, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';
if (!strncmp(buf, ".\n", 2)) break;
- fputs(buf, stdout);
+ claws_fputs(buf, stdout);
}
} else if (cmd.reset_statistics) {
fd_write(uxsock, "reset_statistics\n", 17);
fd_gets(uxsock, buf, sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';
if (!strncmp(buf, ".\n", 2)) break;
- fputs(buf, stdout);
+ claws_fputs(buf, stdout);
}
} else {
#ifndef G_OS_WIN32
} else if (!strncmp(buf, "get_display", 11)) {
fd_write_all(sock, x_display, strlen(x_display));
} else if (!strncmp(buf, "receive_all", 11)) {
- inc_all_account_mail(mainwin, FALSE,
+ inc_all_account_mail(mainwin, FALSE, FALSE,
prefs_common.newmail_notify_manu);
} else if (!strncmp(buf, "receive", 7)) {
inc_mail(mainwin, prefs_common.newmail_notify_manu);