From 8528776ec96ecb6abbfc1c5a1fcc923fd89fcf4d Mon Sep 17 00:00:00 2001 From: Michael Rasmussen Date: Sat, 13 Apr 2013 12:06:56 +0200 Subject: [PATCH] If 'Don't popup error dialog on receive error' is checked do not show alert_panel but write virus message to statusbar instead. --- src/plugins/clamd/clamav_plugin.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/plugins/clamd/clamav_plugin.c b/src/plugins/clamd/clamav_plugin.c index 03a8017bd..4f184e365 100644 --- a/src/plugins/clamd/clamav_plugin.c +++ b/src/plugins/clamd/clamav_plugin.c @@ -38,6 +38,8 @@ #include "prefs.h" #include "prefs_gtk.h" #include "alertpanel.h" +#include "prefs_common.h" +#include "statusbar.h" #include "clamav_plugin.h" #include "clamd-plugin.h" @@ -84,6 +86,7 @@ static gboolean scan_func(GNode *node, gpointer data) response buf; int max; struct stat info; + gchar* msg; outfile = procmime_get_tmp_file_name(mimeinfo); if (procmime_get_part(outfile, mimeinfo) < 0) @@ -107,8 +110,17 @@ static gboolean scan_func(GNode *node, gpointer data) alertpanel_warning(_("Scanning\nClamd does not respond to ping.\nIs clamd running?")); break; case VIRUS: - g_warning("Detected %s virus.\n", clamd_get_virus_name(buf.msg)); - alertpanel_warning(_("Detected %s virus."), clamd_get_virus_name(buf.msg)); + msg = g_strconcat(_("Detected %s virus."), + clamd_get_virus_name(buf.msg), NULL); + g_warning("%s\n", msg); + debug_print("no_recv: %d\n", prefs_common.no_recv_err_panel); + if (prefs_common.no_recv_err_panel) { + statusbar_print_all("%s", msg); + } + else { + alertpanel_warning("%s\n", msg); + } + g_free(msg); break; case SCAN_ERROR: debug_print("Error: %s\n", buf.msg); @@ -126,7 +138,7 @@ static gboolean scan_func(GNode *node, gpointer data) } g_unlink(outfile); } - + return (result->status == OK) ? FALSE : TRUE; } -- 2.25.1