From: Colin Leroy Date: Thu, 31 Jan 2008 08:48:27 +0000 (+0000) Subject: 2008-01-31 [colin] 3.2.0cvs70 X-Git-Tag: rel_3_3_0~9 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=39cb1db917db028540f3d6d18ec0e4bf4762d1b0 2008-01-31 [colin] 3.2.0cvs70 * configure.ac * po/POTFILES.in * src/compose.c * src/plugins/Makefile.am * src/plugins/clamav/.cvsignore * src/plugins/clamav/Makefile.am * src/plugins/clamav/README * src/plugins/clamav/clamav_plugin.c * src/plugins/clamav/clamav_plugin.h * src/plugins/clamav/clamav_plugin_gtk.c * src/plugins/clamav/clamav_plugin_gtk.deps Remove the Clamav plugin from the core --- diff --git a/ChangeLog b/ChangeLog index 8aa8775b1..128811da6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-01-31 [colin] 3.2.0cvs70 + + * configure.ac + * po/POTFILES.in + * src/compose.c + * src/plugins/Makefile.am + * src/plugins/clamav/.cvsignore + * src/plugins/clamav/Makefile.am + * src/plugins/clamav/README + * src/plugins/clamav/clamav_plugin.c + * src/plugins/clamav/clamav_plugin.h + * src/plugins/clamav/clamav_plugin_gtk.c + * src/plugins/clamav/clamav_plugin_gtk.deps + Remove the Clamav plugin from the core + 2008-01-28 [wwp] 3.2.0cvs69 * src/compose.c diff --git a/PATCHSETS b/PATCHSETS index f27a5c138..91a1d0cf7 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -3206,3 +3206,4 @@ ( cvs diff -u -r 1.1.4.95 -r 1.1.4.96 src/etpan/imap-thread.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/etpan/nntp-thread.c; ) > 3.2.0cvs67.patchset ( cvs diff -u -r 1.12.2.16 -r 1.12.2.17 po/en_GB.po; cvs diff -u -r 1.60.2.55 -r 1.60.2.56 src/prefs_actions.c; cvs diff -u -r 1.59.2.64 -r 1.59.2.65 src/prefs_filtering.c; cvs diff -u -r 1.52.2.56 -r 1.52.2.57 src/prefs_folder_item.c; cvs diff -u -r 1.12.2.54 -r 1.12.2.55 src/prefs_template.c; cvs diff -u -r 1.4.2.58 -r 1.4.2.59 src/gtk/about.c; ) > 3.2.0cvs68.patchset ( cvs diff -u -r 1.382.2.433 -r 1.382.2.434 src/compose.c; cvs diff -u -r 1.12.2.55 -r 1.12.2.56 src/prefs_template.c; cvs diff -u -r 1.1.16.7 -r 1.1.16.8 src/prefs_template.h; cvs diff -u -r 1.8.2.26 -r 1.8.2.27 src/quote_fmt.c; cvs diff -u -r 1.5.12.13 -r 1.5.12.14 src/quote_fmt.h; cvs diff -u -r 1.8.2.16 -r 1.8.2.17 src/quote_fmt_lex.l; cvs diff -u -r 1.22.2.38 -r 1.22.2.39 src/quote_fmt_parse.y; ) > 3.2.0cvs69.patchset +( cvs diff -u -r 1.654.2.3265 -r 1.654.2.3266 configure.ac; cvs diff -u -r 1.53.2.33 -r 1.53.2.34 po/POTFILES.in; cvs diff -u -r 1.382.2.434 -r 1.382.2.435 src/compose.c; cvs diff -u -r 1.8.2.6 -r 1.8.2.7 src/plugins/Makefile.am; cvs diff -u -r -1.1 -r -1.2 src/plugins/clamav/.cvsignore; cvs diff -u -r -1.4.2.9 -r -1.4.2.10 src/plugins/clamav/Makefile.am; cvs diff -u -r -1.1.4.2 -r -1.1.4.3 src/plugins/clamav/README; cvs diff -u -r -1.13.2.36 -r -1.13.2.37 src/plugins/clamav/clamav_plugin.c; cvs diff -u -r -1.3.2.9 -r -1.3.2.10 src/plugins/clamav/clamav_plugin.h; cvs diff -u -r -1.9.2.27 -r -1.9.2.28 src/plugins/clamav/clamav_plugin_gtk.c; cvs diff -u -r -1.1.2.1 -r -1.1.2.2 src/plugins/clamav/clamav_plugin_gtk.deps; ) > 3.2.0cvs70.patchset diff --git a/configure.ac b/configure.ac index e2a10c150..1eefa2c4e 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=2 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=69 +EXTRA_VERSION=70 EXTRA_RELEASE= EXTRA_GTK2_VERSION= @@ -865,27 +865,6 @@ if test x"$ac_cv_enable_demo_plugin" = xyes; then fi AM_CONDITIONAL(BUILD_DEMO_PLUGIN, test x"$ac_cv_enable_demo_plugin" = xyes) -dnl --- ClamAV --- -AC_MSG_CHECKING([whether to build ClamAV plugin]) -AC_ARG_ENABLE(clamav-plugin, - [ --disable-clamav-plugin do not build Clam AntiVirus plugin], - [ac_cv_enable_clamav_plugin=$enableval], [ac_cv_enable_clamav_plugin=yes]) -if test x"$ac_cv_enable_clamav_plugin" = xyes; then - AC_MSG_RESULT(yes) - PKG_CHECK_MODULES(CLAMAV, libclamav, ac_cv_enable_clamav_plugin=yes, - ac_cv_enable_clamav_plugin=no) - if test x"$ac_cv_enable_clamav_plugin" = xyes; then - PLUGINS="clamav $PLUGINS" - else - AC_MSG_RESULT(not found) - AC_MSG_WARN([*** ClamAV plugin will not be built ***]) - fi -else - AC_MSG_RESULT(no) -fi -AC_SUBST(CLAMAV_LIBS) -AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes) - dnl Libetpan AC_MSG_CHECKING([whether to use libetpan]) AC_ARG_ENABLE(libetpan, @@ -998,7 +977,6 @@ src/plugins/spamassassin/Makefile src/plugins/dillo_viewer/Makefile src/plugins/trayicon/Makefile src/plugins/trayicon/libeggtrayicon/Makefile -src/plugins/clamav/Makefile src/plugins/pgpcore/Makefile src/plugins/pgpmime/Makefile src/plugins/pgpinline/Makefile diff --git a/po/POTFILES.in b/po/POTFILES.in index 78c2e9b06..8155e35b5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -76,8 +76,6 @@ src/news.c src/news_gtk.c src/plugins/bogofilter/bogofilter.c src/plugins/bogofilter/bogofilter_gtk.c -src/plugins/clamav/clamav_plugin.c -src/plugins/clamav/clamav_plugin_gtk.c src/plugins/demo/demo.c src/plugins/dillo_viewer/dillo_prefs.c src/plugins/dillo_viewer/dillo_viewer.c diff --git a/src/compose.c b/src/compose.c index 475ecea3f..7c5b4e364 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1067,8 +1067,10 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI } } else { if (mailto && *mailto != '\0') { - compose_entries_set(compose, mailto, COMPOSE_NEWSGROUPS); - + if (!strchr(mailto, '@')) + compose_entries_set(compose, mailto, COMPOSE_NEWSGROUPS); + else + compose_entries_set(compose, mailto, COMPOSE_TO); } else if (item && FOLDER_CLASS(item->folder) == news_get_class()) { compose_entry_append(compose, item->path, COMPOSE_NEWSGROUPS); } diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index bf62e5e59..47c8a0437 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -18,10 +18,6 @@ if BUILD_TRAYICON_PLUGIN trayicon_dir = trayicon endif -if BUILD_CLAMAV_PLUGIN -clamav_dir = clamav -endif - if BUILD_PGPCORE_PLUGIN pgpcore_dir = pgpcore if BUILD_PGPMIME_PLUGIN @@ -37,7 +33,6 @@ SUBDIRS = $(demo_dir) \ $(bogofilter_dir) \ $(dillo_viewer_dir) \ $(trayicon_dir) \ - $(clamav_dir) \ $(pgpcore_dir) \ $(pgpmime_dir) \ $(pgpinline_dir) diff --git a/src/plugins/clamav/.cvsignore b/src/plugins/clamav/.cvsignore deleted file mode 100644 index 2a6ab490b..000000000 --- a/src/plugins/clamav/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.o -*.lo -*.la diff --git a/src/plugins/clamav/Makefile.am b/src/plugins/clamav/Makefile.am deleted file mode 100644 index 1f8cb316a..000000000 --- a/src/plugins/clamav/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -plugindir = $(pkglibdir)/plugins - -plugin_LTLIBRARIES = clamav_plugin.la - -clamav_plugin_la_SOURCES = \ - clamav_plugin.c clamav_plugin.h \ - clamav_plugin_gtk.c clamav_plugin.h - -clamav_plugin_la_LDFLAGS = \ - -avoid-version -module -if CYGWIN -cygwin_export_lib = -L$(top_builddir)/src -lclaws-mail -else -cygwin_export_lib = -endif -clamav_plugin_la_LIBADD = $(cygwin_export_lib) \ - $(GTK_LIBS) \ - $(CLAMAV_LIBS) \ - $(MAEMO_LIBS) - -INCLUDES = \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/common \ - -I$(top_srcdir)/src/gtk - -AM_CPPFLAGS = \ - $(ASPELL_CFLAGS) \ - $(GLIB_CFLAGS) \ - $(GTK_CFLAGS) \ - $(MAEMO_CFLAGS) - -EXTRA_DIST = \ - README diff --git a/src/plugins/clamav/README b/src/plugins/clamav/README deleted file mode 100644 index 5e95b98d2..000000000 --- a/src/plugins/clamav/README +++ /dev/null @@ -1,48 +0,0 @@ -Clam AntiVirus Plugin ---------------------- - -This plugin will scan incoming messages for viruses using -Clam AntiVirus (libclamav). It can be used with Local, IMAP -and POP accounts. - -Messages that have infected attachments can be automatically -deleted or moved to a folder that can be specified in the -configuration, if the folder is not specified or not found -the default trash folder will be used. - -The plugin is built automatically if you have the required -libraries available. It will be installed in -$PREFIX/lib/claws-mail/plugins/ as clamav_plugin.so. - -Configuration preferences are found on the -"/Configuration/Preferences.../Plugins/Clam AntiVirus" page. - -The Clam AntiVirus plugin uses its own block in the 'clawsrc' -file in your config directory (default: '~/.claws-mail'). It -has the following options: - -[ClamAV] -clamav_enable=1 enable scanning with Clam AntiVirus - [default: 0] - -clamav_enable_arc=1 enable archive scanning with Clam - AntiVirus - [default: 0] - -clamav_max_size=1 maximum size an attachment can have - (in MB), larger attachments will not - be scanned - [default: 1] - -clamav_recv_infected=1 enable to save infected messages to a - mailfolder. If not enabled the mails - will be deleted - [default: 1] - -clamav_save_folder=#mh/Mailbox/virus the folder that should be used to save - infected mails, if empty the default - trash folder is used - [default: none, use default trash] - -Clam AntiVirus is licensed under the GPL and can be downloaded from -http://clamav.sourceforge.net/ diff --git a/src/plugins/clamav/clamav_plugin.c b/src/plugins/clamav/clamav_plugin.c deleted file mode 100644 index 68b488a36..000000000 --- a/src/plugins/clamav/clamav_plugin.c +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 2003-2007 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "defs.h" - -#include -#include -#include - -#ifdef CL_DB_STDOPT -#define NEW_CLAMAV 1 -#else -#undef NEW_CLAMAV -#endif - -#include "common/claws.h" -#include "common/version.h" -#include "plugin.h" -#include "utils.h" -#include "hooks.h" -#include "inc.h" -#include "mimeview.h" -#include "folder.h" -#include "prefs.h" -#include "prefs_gtk.h" - -#include "clamav_plugin.h" - -#define PLUGIN_NAME (_("Clam AntiVirus")) - -static guint hook_id; -static MessageCallback message_callback; - -static ClamAvConfig config; - -static PrefParam param[] = { - {"clamav_enable", "FALSE", &config.clamav_enable, P_BOOL, - NULL, NULL, NULL}, - {"clamav_enable_arc", "FALSE", &config.clamav_enable_arc, P_BOOL, - NULL, NULL, NULL}, - {"clamav_max_size", "1", &config.clamav_max_size, P_USHORT, - NULL, NULL, NULL}, - {"clamav_recv_infected", "TRUE", &config.clamav_recv_infected, P_BOOL, - NULL, NULL, NULL}, - {"clamav_save_folder", NULL, &config.clamav_save_folder, P_STRING, - NULL, NULL, NULL}, - - {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL} -}; - -#ifdef NEW_CLAMAV -static struct cl_engine *engine; -#else -static struct cl_node *cl_database; -#endif - -struct scan_parameters { - gboolean is_infected; - - struct cl_limits limits; -#ifdef NEW_CLAMAV - struct cl_engine *engine; -#else - struct cl_node *root; -#endif - gboolean scan_archive; -}; - -static gboolean scan_func(GNode *node, gpointer data) -{ - struct scan_parameters *params = (struct scan_parameters *) data; - MimeInfo *mimeinfo = (MimeInfo *) node->data; - gchar *outfile; - int ret; - unsigned long int size; - const char *virname; - - outfile = procmime_get_tmp_file_name(mimeinfo); - if (procmime_get_part(outfile, mimeinfo) < 0) - g_warning("Can't get the part of multipart message."); - else { - debug_print("Scanning %s\n", outfile); -#ifdef NEW_CLAMAV - if ((ret = cl_scanfile(outfile, &virname, &size, params->engine, - ¶ms->limits, params->scan_archive)) == CL_VIRUS) { -#else - if ((ret = cl_scanfile(outfile, &virname, &size, params->root, - ¶ms->limits, params->scan_archive)) == CL_VIRUS) { -#endif - params->is_infected = TRUE; - debug_print("Detected %s virus.\n", virname); - } else { - debug_print("No virus detected.\n"); - if (ret != CL_CLEAN) - debug_print("Error: %s\n", cl_strerror(ret)); - } - - g_unlink(outfile); - } - - return params->is_infected; -} - -static gboolean mail_filtering_hook(gpointer source, gpointer data) -{ - MailFilteringData *mail_filtering_data = (MailFilteringData *) source; - MsgInfo *msginfo = mail_filtering_data->msginfo; - MimeInfo *mimeinfo; - - struct scan_parameters params; - - if (!config.clamav_enable) - return FALSE; - - mimeinfo = procmime_scan_message(msginfo); - if (!mimeinfo) return FALSE; - - debug_print("Scanning message %d for viruses\n", msginfo->msgnum); - if (message_callback != NULL) - message_callback(_("ClamAV: scanning message...")); - - params.is_infected = FALSE; -#ifdef NEW_CLAMAV - params.engine = engine; -#else - params.root = cl_database; -#endif - - params.limits.maxfiles = 1000; /* max files */ - params.limits.maxfilesize = config.clamav_max_size * 1048576; /* maximum archived file size */ - params.limits.maxreclevel = 8; /* maximum recursion level */ - params.limits.maxratio = 200; /* maximal compression ratio */ - - if (config.clamav_enable_arc) - params.scan_archive = TRUE; - - g_node_traverse(mimeinfo->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, scan_func, ¶ms); - - if (params.is_infected) { - if (config.clamav_recv_infected) { - FolderItem *clamav_save_folder; - - if ((!config.clamav_save_folder) || - (config.clamav_save_folder[0] == '\0') || - ((clamav_save_folder = folder_find_item_from_identifier(config.clamav_save_folder)) == NULL)) - clamav_save_folder = folder_get_default_trash(); - - procmsg_msginfo_unset_flags(msginfo, ~0, 0); - msginfo->filter_op = IS_MOVE; - msginfo->to_filter_folder = clamav_save_folder; - } else { - folder_item_remove_msg(msginfo->folder, msginfo->msgnum); - } - } - - procmime_mimeinfo_free_all(mimeinfo); - - return params.is_infected; -} - -ClamAvConfig *clamav_get_config(void) -{ - return &config; -} - -void clamav_save_config(void) -{ - PrefFile *pfile; - gchar *rcpath; - - debug_print("Saving ClamAV Page\n"); - - rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); - pfile = prefs_write_open(rcpath); - g_free(rcpath); - if (!pfile || (prefs_set_block_label(pfile, "ClamAV") < 0)) - return; - - if (prefs_write_param(param, pfile->fp) < 0) { - g_warning("failed to write ClamAV configuration to file\n"); - prefs_file_close_revert(pfile); - return; - } - if (fprintf(pfile->fp, "\n") < 0) { - FILE_OP_ERROR(rcpath, "fprintf"); - prefs_file_close_revert(pfile); - } else - prefs_file_close(pfile); -} - -void clamav_set_message_callback(MessageCallback callback) -{ - message_callback = callback; -} - -#ifdef NEW_CLAMAV -int cl_build(struct cl_engine *engine); -void cl_free(struct cl_engine *engine); -#else -int cl_build(struct cl_node *root); -void cl_free(struct cl_node *root); -#endif - -gint plugin_init(gchar **error) -{ - gchar *rcpath; - int ret; -#ifdef NEW_CLAMAV - unsigned int sigs = 0; -#else - unsigned int no; -#endif - - if (!check_plugin_version(MAKE_NUMERIC_VERSION(2,9,2,72), - VERSION_NUMERIC, PLUGIN_NAME, error)) - return -1; - - hook_id = hooks_register_hook(MAIL_FILTERING_HOOKLIST, mail_filtering_hook, NULL); - if (hook_id == -1) { - *error = g_strdup(_("Failed to register mail filtering hook")); - return -1; - } - - prefs_set_default(param); - rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); - prefs_read_config(param, "ClamAV", rcpath, NULL); - g_free(rcpath); - - clamav_gtk_init(); - -#ifdef NEW_CLAMAV - if ((ret = cl_load(cl_retdbdir(), &engine, &sigs, CL_DB_STDOPT))) { - debug_print("cl_load: %s\n", cl_strerror(ret)); - *error = g_strdup_printf("cl_load: %s\n", cl_strerror(ret)); - return -1; - } - debug_print("Database loaded (containing in total %d signatures)\n", sigs); -#else - if ((ret = cl_loaddbdir(cl_retdbdir(), &cl_database, &no))) { - debug_print("cl_loaddbdir: %s\n", cl_strerror(ret)); - *error = g_strdup_printf("cl_loaddbdir: %s\n", cl_strerror(ret)); - return -1; - } - debug_print("Database loaded (containing in total %d signatures)\n", no); -#endif - - -#ifdef NEW_CLAMAV - if((ret = cl_build(engine))) { -#else - if((ret = cl_build(cl_database))) { -#endif - debug_print("Database initialization error: %s\n", cl_strerror(ret)); - *error = g_strdup_printf("Database initialization error: %s\n", cl_strerror(ret)); - return -1; - } - - debug_print("ClamAV plugin loaded\n"); - - return 0; - -} - -gboolean plugin_done(void) -{ - hooks_unregister_hook(MAIL_FILTERING_HOOKLIST, hook_id); - g_free(config.clamav_save_folder); -#ifdef NEW_CLAMAV - cl_free(engine); -#else - cl_free(cl_database); -#endif - clamav_gtk_done(); - - debug_print("ClamAV plugin unloaded\n"); - return TRUE; -} - -const gchar *plugin_name(void) -{ - return PLUGIN_NAME; -} - -const gchar *plugin_desc(void) -{ - return _("This plugin uses Clam AntiVirus to scan all messages that are " - "received from an IMAP, LOCAL or POP account.\n" - "\n" - "When a message attachment is found to contain a virus it can be " - "deleted or saved in a specially designated folder.\n" - "\n" - "Options can be found in /Configuration/Preferences/Plugins/Clam AntiVirus"); -} - -const gchar *plugin_type(void) -{ - return "GTK2"; -} - -const gchar *plugin_licence(void) -{ - return "GPL3+"; -} - -const gchar *plugin_version(void) -{ - return VERSION; -} - -struct PluginFeature *plugin_provides(void) -{ - static struct PluginFeature features[] = - { {PLUGIN_FILTERING, N_("Virus detection")}, - {PLUGIN_NOTHING, NULL}}; - return features; -} diff --git a/src/plugins/clamav/clamav_plugin.h b/src/plugins/clamav/clamav_plugin.h deleted file mode 100644 index ff78ab0c9..000000000 --- a/src/plugins/clamav/clamav_plugin.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 2003-2007 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef CLAMAV_PLUGIN_H -#define CLAMAV_PLUGIN_H 1 - -#include - -typedef struct _ClamAvConfig ClamAvConfig; - -typedef void (*MessageCallback) (gchar *); - -struct _ClamAvConfig -{ - gboolean clamav_enable; - gboolean clamav_enable_arc; - guint clamav_max_size; - gboolean clamav_recv_infected; - gchar *clamav_save_folder; -}; - -ClamAvConfig *clamav_get_config (void); -void clamav_save_config (void); -void clamav_set_message_callback (MessageCallback callback); -gint clamav_gtk_init(void); -void clamav_gtk_done(void); - -#endif diff --git a/src/plugins/clamav/clamav_plugin_gtk.c b/src/plugins/clamav/clamav_plugin_gtk.c deleted file mode 100644 index cd9457ec5..000000000 --- a/src/plugins/clamav/clamav_plugin_gtk.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 2003-2007 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "defs.h" - -#include -#include -#include -#include - -#include "common/claws.h" -#include "common/version.h" -#include "plugin.h" -#include "utils.h" -#include "prefs.h" -#include "folder.h" -#include "prefs_gtk.h" -#include "foldersel.h" -#include "clamav_plugin.h" -#include "statusbar.h" - -struct ClamAvPage -{ - PrefsPage page; - - GtkWidget *enable_clamav; - GtkWidget *enable_arc; - GtkWidget *max_size; - GtkWidget *recv_infected; - GtkWidget *save_folder; -}; - -static void foldersel_cb(GtkWidget *widget, gpointer data) -{ - struct ClamAvPage *page = (struct ClamAvPage *) data; - FolderItem *item; - gchar *item_id; - gint newpos = 0; - - item = foldersel_folder_sel(NULL, FOLDER_SEL_MOVE, NULL); - if (item && (item_id = folder_item_get_identifier(item)) != NULL) { - gtk_editable_delete_text(GTK_EDITABLE(page->save_folder), 0, -1); - gtk_editable_insert_text(GTK_EDITABLE(page->save_folder), item_id, strlen(item_id), &newpos); - g_free(item_id); - } -} - -static void clamav_create_widget_func(PrefsPage * _page, GtkWindow *window, gpointer data) -{ - struct ClamAvPage *page = (struct ClamAvPage *) _page; - ClamAvConfig *config; - - GtkWidget *vbox1, *vbox2; - GtkWidget *enable_clamav; - GtkWidget *label1; - GtkWidget *enable_arc; - GtkWidget *label2; - GtkObject *max_size_adj; - GtkWidget *max_size; - GtkWidget *hbox1; - GtkWidget *recv_infected; - GtkWidget *save_folder; - GtkWidget *save_folder_select; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new(); - - vbox1 = gtk_vbox_new (FALSE, VSPACING); - gtk_widget_show (vbox1); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER); - - vbox2 = gtk_vbox_new (FALSE, 4); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0); - - PACK_CHECK_BUTTON (vbox2, enable_clamav, _("Enable virus scanning")); - PACK_CHECK_BUTTON (vbox2, enable_arc, _("Scan archive contents")); - - SET_TOGGLE_SENSITIVITY (enable_clamav, enable_arc); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - SET_TOGGLE_SENSITIVITY (enable_arc, hbox1); - - label1 = gtk_label_new(_("Maximum attachment size")); - gtk_widget_show (label1); - gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, FALSE, 0); - SET_TOGGLE_SENSITIVITY (enable_clamav, label1); - - max_size_adj = gtk_adjustment_new (1, 1, 1024, 1, 10, 10); - max_size = gtk_spin_button_new (GTK_ADJUSTMENT (max_size_adj), 1, 0); - gtk_widget_show (max_size); - gtk_box_pack_start (GTK_BOX (hbox1), max_size, FALSE, FALSE, 0); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (max_size), TRUE); - gtk_tooltips_set_tip(tooltips, max_size, - _("Message attachments larger than this will not be scanned"), - NULL); - SET_TOGGLE_SENSITIVITY (enable_clamav, max_size); - - label2 = gtk_label_new(_("MB")); - gtk_widget_show (label2); - gtk_box_pack_start (GTK_BOX (hbox1), label2, FALSE, FALSE, 0); - SET_TOGGLE_SENSITIVITY (enable_clamav, label2); - - hbox1 = gtk_hbox_new (FALSE, 8); - gtk_widget_show (hbox1); - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); - - recv_infected = gtk_check_button_new_with_label(_("Save infected mail in")); - gtk_widget_show (recv_infected); - gtk_box_pack_start (GTK_BOX (hbox1), recv_infected, FALSE, FALSE, 0); - gtk_tooltips_set_tip(tooltips, recv_infected, - _("Save mail that contains viruses"), - NULL); - SET_TOGGLE_SENSITIVITY (enable_clamav, recv_infected); - - save_folder = gtk_entry_new (); - gtk_widget_show (save_folder); - gtk_box_pack_start (GTK_BOX (hbox1), save_folder, TRUE, TRUE, 0); - gtk_tooltips_set_tip(tooltips, save_folder, - _("Folder for storing infected mail. Leave empty to use the default trash folder"), - NULL); - SET_TOGGLE_SENSITIVITY (enable_clamav, save_folder); - - save_folder_select = gtkut_get_browse_directory_btn(_("_Browse")); - gtk_widget_show (save_folder_select); - gtk_box_pack_start (GTK_BOX (hbox1), save_folder_select, FALSE, FALSE, 0); - gtk_tooltips_set_tip(tooltips, save_folder_select, - _("Click this button to select a folder for storing infected mail"), - NULL); - SET_TOGGLE_SENSITIVITY (enable_clamav, save_folder_select); - - config = clamav_get_config(); - - g_signal_connect(G_OBJECT(save_folder_select), "clicked", - G_CALLBACK(foldersel_cb), page); - - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_clamav), config->clamav_enable); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_arc), config->clamav_enable_arc); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size), (float) config->clamav_max_size); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(recv_infected), config->clamav_recv_infected); - if (config->clamav_save_folder != NULL) - gtk_entry_set_text(GTK_ENTRY(save_folder), config->clamav_save_folder); - - page->enable_clamav = enable_clamav; - page->enable_arc = enable_arc; - page->max_size = max_size; - page->recv_infected = recv_infected; - page->save_folder = save_folder; - - page->page.widget = vbox1; -} - -static void clamav_destroy_widget_func(PrefsPage *_page) -{ - debug_print("Destroying ClamAV widget\n"); -} - -static void clamav_save_func(PrefsPage *_page) -{ - struct ClamAvPage *page = (struct ClamAvPage *) _page; - ClamAvConfig *config; - - debug_print("Saving ClamAV Page\n"); - - config = clamav_get_config(); - - config->clamav_enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_clamav)); - config->clamav_enable_arc = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_arc)); - - config->clamav_max_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->max_size)); - config->clamav_recv_infected = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->recv_infected)); - g_free(config->clamav_save_folder); - config->clamav_save_folder = gtk_editable_get_chars(GTK_EDITABLE(page->save_folder), 0, -1); - - clamav_save_config(); -} - -static struct ClamAvPage clamav_page; - -static void gtk_message_callback(gchar *message) -{ - statusbar_print_all("%s", message); -} - -gint clamav_gtk_init(void) -{ - static gchar *path[3]; - - path[0] = _("Plugins"); - path[1] = _("Clam AntiVirus"); - path[2] = NULL; - - clamav_page.page.path = path; - clamav_page.page.create_widget = clamav_create_widget_func; - clamav_page.page.destroy_widget = clamav_destroy_widget_func; - clamav_page.page.save_page = clamav_save_func; - clamav_page.page.weight = 35.0; - - prefs_gtk_register_page((PrefsPage *) &clamav_page); - clamav_set_message_callback(gtk_message_callback); - - debug_print("ClamAV GTK plugin loaded\n"); - return 0; -} - -void clamav_gtk_done(void) -{ - prefs_gtk_unregister_page((PrefsPage *) &clamav_page); -} diff --git a/src/plugins/clamav/clamav_plugin_gtk.deps b/src/plugins/clamav/clamav_plugin_gtk.deps deleted file mode 100644 index 7ca2837f3..000000000 --- a/src/plugins/clamav/clamav_plugin_gtk.deps +++ /dev/null @@ -1 +0,0 @@ -clamav_plugin