+2005-07-20 [colin] 1.9.12cvs87
+
+ * src/folder.c
+ * src/textview.c
+ Gcc 2.9x compilation fixes, thanks to Darko
+ * src/plugins/clamav/clamav_plugin.c
+ Little optimisation: load virus database only once
+ * src/plugins/spamassassin/spamassassin.c
+ Big optimisation: filtering one mail took at least 1 second,
+ now it takes at least 50ms. Doesn't speed up spamassassin
+ itself, but should already be much more tolerable.
+
2005-07-20 [colin] 1.9.12cvs86
* src/summaryview.c
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
+static struct cl_node *cl_database;
struct scan_parameters {
gboolean is_infected;
- struct cl_node *root;
struct cl_limits limits;
+ struct cl_node *root;
gboolean scan_archive;
};
MsgInfo *msginfo = mail_filtering_data->msginfo;
MimeInfo *mimeinfo;
- int ret, no = 0;
struct scan_parameters params;
if (!config.clamav_enable)
message_callback(_("ClamAV: scanning message..."));
params.is_infected = FALSE;
- params.root = NULL;
+ params.root = cl_database;
params.limits.maxfiles = 1000; /* max files */
params.limits.maxfilesize = config.clamav_max_size * 1048576; /* maximum archived file size */
if (config.clamav_enable_arc)
params.scan_archive = TRUE;
- if ((ret = cl_loaddbdir(cl_retdbdir(), ¶ms.root, &no))) {
- debug_print("cl_loaddbdir: %s\n", cl_strerror(ret));
- return FALSE;
- }
-
- debug_print("Database loaded (containing in total %d signatures)\n", no);
-
- cl_buildtrie(params.root);
-
g_node_traverse(mimeinfo->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1, scan_func, ¶ms);
if (params.is_infected) {
}
}
- cl_freetrie(params.root);
procmime_mimeinfo_free_all(mimeinfo);
return params.is_infected;
gint plugin_init(gchar **error)
{
gchar *rcpath;
-
+ int no, ret;
if ((sylpheed_get_version() > VERSION_NUMERIC)) {
*error = g_strdup("Your sylpheed version is newer than the version the plugin was built with");
return -1;
rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
prefs_read_config(param, "ClamAV", rcpath, NULL);
g_free(rcpath);
-
+
+ if ((ret = cl_loaddbdir(cl_retdbdir(), &cl_database, &no)) != 0) {
+ debug_print("cl_loaddbdir: %s\n", cl_strerror(ret));
+ return -1;
+ }
+
+ debug_print("Database loaded (containing in total %d signatures)\n", no);
+
+ cl_buildtrie(cl_database);
+
debug_print("ClamAV plugin loaded\n");
return 0;
{
hooks_unregister_hook(MAIL_FILTERING_HOOKLIST, hook_id);
g_free(config.clamav_save_folder);
-
+ cl_freetrie(cl_database);
debug_print("ClamAV plugin unloaded\n");
}
GtkTextIter iter;
gchar *mybuf = g_strdup(linebuf);
- if (!g_utf8_validate(linebuf, -1, NULL)) {
- mybuf = g_malloc(strlen(linebuf)*2 +1);
- conv_localetodisp(mybuf, strlen(linebuf)*2 +1, linebuf);
- }
-
/* parse table - in order of priority */
struct table {
const gchar *needle; /* token */
struct txtpos *next; /* next */
} head = {NULL, NULL, 0, NULL}, *last = &head;
+ if (!g_utf8_validate(linebuf, -1, NULL)) {
+ mybuf = g_malloc(strlen(linebuf)*2 +1);
+ conv_localetodisp(mybuf, strlen(linebuf)*2 +1, linebuf);
+ }
+
gtk_text_buffer_get_end_iter(buffer, &iter);
/* parse for clickable parts, and build a list of begin and end positions */