}
}
else {
- i = task->pre_result.action;
-
for (i = task->pre_result.action; i < METRIC_ACTION_MAX; i ++) {
selected_action = &mres->metric->actions[i];
sc = mres->actions_limits[i];
msg_info_config (
"statfile %s has no explicit 'spam' setting, trying to guess by symbol",
st->symbol);
- if (rspamd_strncasestr (st->symbol, "spam",
- strlen (st->symbol)) != NULL) {
+ if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"spam", 4) != -1) {
st->is_spam = TRUE;
}
- else if (rspamd_strncasestr (st->symbol, "ham",
- strlen (st->symbol)) != NULL) {
+ else if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"ham", 3) != -1) {
st->is_spam = FALSE;
}
else {
cur = cf->statfiles;
while (cur) {
st = cur->data;
- if (rspamd_strncasestr (st->symbol, "spam", -1) != NULL) {
+ if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"spam", 4) != -1) {
st->is_spam = TRUE;
}
- else if (rspamd_strncasestr (st->symbol, "ham", -1) != NULL) {
+ else if (rspamd_substring_search_caseless (st->symbol,
+ strlen (st->symbol),"ham", 3) != -1) {
st->is_spam = FALSE;
}
return (s - src - 1); /* count does not include NUL */
}
-
-/*
- * Find the first occurrence of find in s, ignore case.
- */
-gchar *
-rspamd_strncasestr (const gchar *s, const gchar *find, gint len)
-{
- gchar c, sc;
- gsize mlen;
-
- if ((c = *find++) != 0) {
- c = g_ascii_tolower (c);
- mlen = strlen (find);
- do {
- do {
- if ((sc = *s++) == 0 || len-- == 0)
- return (NULL);
- } while (g_ascii_tolower (sc) != c);
- } while (g_ascii_strncasecmp (s, find, mlen) != 0);
- s--;
- }
- return ((gchar *)s);
-}
-
/*
* Try to convert string of length to long
*/
*/
gsize rspamd_strlcpy_tolower (gchar *dst, const gchar *src, gsize siz);
-/*
- * Find string find in string s ignoring case
- */
-gchar * rspamd_strncasestr (const gchar *s, const gchar *find, gint len);
-
/*
* Try to convert string of length to long
*/