struct expression_argument *arg;
GMimeObject *parent;
const GMimeContentType *ct;
-
+ gint *pdiff;
if (args == NULL) {
debug_task ("no threshold is specified, assume it 100");
}
}
+ if ((pdiff = memory_pool_get_variable (task->task_pool, "parts_distance")) != NULL) {
+ diff = *pdiff;
+ if (diff != -1 && diff <= threshold) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+ }
+
if (g_list_length (task->text_parts) == 2) {
cur = g_list_first (task->text_parts);
p1 = cur->data;
cur = g_list_next (cur);
+ pdiff = memory_pool_alloc (task->task_pool, sizeof (gint));
+ *pdiff = -1;
+
if (cur == NULL) {
msg_info ("bad parts list");
return FALSE;
if (ct == NULL || ! g_mime_content_type_is_type ((GMimeContentType *)ct, "multipart", "alternative")) {
#endif
debug_task ("two parts are not belong to multipart/alternative container, skip check");
+ memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL);
return FALSE;
}
}
else {
debug_task ("message contains two parts but they are in different multi-parts");
+ memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL);
return FALSE;
}
if (!p1->is_empty && !p2->is_empty) {
diff = fuzzy_compare_parts (p1, p2);
debug_task ("got likeliness between parts of %d%%, threshold is %d%%", diff, threshold);
+ *pdiff = diff;
+ memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL);
if (diff <= threshold) {
return TRUE;
}
}
else if ((p1->is_empty && !p2->is_empty) || (!p1->is_empty && p2->is_empty)) {
/* Empty and non empty parts are different */
+ *pdiff = 0;
+ memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL);
return TRUE;
}
}
else {
debug_task ("message has too many text parts, so do not try to compare them with each other");
+ memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL);
return FALSE;
}
+ memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL);
return FALSE;
}