diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-05 07:54:55 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-09-05 07:54:55 +0000 |
commit | 11776e5a524745b01ac145439ac2892a29bd0826 (patch) | |
tree | 233db0a019b3b533581f611edb9802a80d664279 /src/procmsg.c | |
parent | 51f886e4c8b44242b10c057a1af70f66f28bb2e6 (diff) |
moved procmsg.c::procmsg_get_filter_keyword() to filter.c::filter_get_keyword_from_msg().
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@547 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/procmsg.c')
-rw-r--r-- | src/procmsg.c | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/procmsg.c b/src/procmsg.c index 560c0478..0ecae5b4 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -30,8 +30,6 @@ #include "account.h" #include "procmime.h" #include "prefs_common.h" -#include "prefs_filter.h" -#include "filter.h" #include "folder.h" #include "codeconv.h" #if USE_GPGME @@ -1114,106 +1112,6 @@ gboolean procmsg_msg_exist(MsgInfo *msginfo) return ret; } -void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key, - PrefsFilterType type) -{ - static HeaderEntry hentry[] = {{"List-Id:", NULL, TRUE}, - {"X-ML-Name:", NULL, TRUE}, - {"X-List:", NULL, TRUE}, - {"X-Mailing-list:", NULL, TRUE}, - {"X-Sequence:", NULL, TRUE}, - {NULL, NULL, FALSE}}; - enum - { - H_LIST_ID = 0, - H_X_ML_NAME = 1, - H_X_LIST = 2, - H_X_MAILING_LIST = 3, - H_X_SEQUENCE = 4 - }; - - FILE *fp; - - g_return_if_fail(msginfo != NULL); - g_return_if_fail(header != NULL); - g_return_if_fail(key != NULL); - - *header = NULL; - *key = NULL; - - switch (type) { - case FILTER_BY_NONE: - return; - case FILTER_BY_AUTO: - if ((fp = procmsg_open_message(msginfo)) == NULL) - return; - procheader_get_header_fields(fp, hentry); - fclose(fp); - -#define SET_FILTER_KEY(hstr, idx) \ -{ \ - *header = g_strdup(hstr); \ - *key = hentry[idx].body; \ - hentry[idx].body = NULL; \ -} - - if (hentry[H_LIST_ID].body != NULL) { - SET_FILTER_KEY("List-Id", H_LIST_ID); - extract_list_id_str(*key); - } else if (hentry[H_X_ML_NAME].body != NULL) { - SET_FILTER_KEY("X-ML-Name", H_X_ML_NAME); - } else if (hentry[H_X_LIST].body != NULL) { - SET_FILTER_KEY("X-List", H_X_LIST); - } else if (hentry[H_X_MAILING_LIST].body != NULL) { - SET_FILTER_KEY("X-Mailing-list", H_X_MAILING_LIST); - } else if (hentry[H_X_SEQUENCE].body != NULL) { - gchar *p; - - SET_FILTER_KEY("X-Sequence", H_X_SEQUENCE); - p = *key; - while (*p != '\0') { - while (*p != '\0' && !g_ascii_isspace(*p)) p++; - while (g_ascii_isspace(*p)) p++; - if (g_ascii_isdigit(*p)) { - *p = '\0'; - break; - } - } - g_strstrip(*key); - } else if (msginfo->subject) { - *header = g_strdup("Subject"); - *key = g_strdup(msginfo->subject); - } - -#undef SET_FILTER_KEY - - g_free(hentry[H_LIST_ID].body); - hentry[H_LIST_ID].body = NULL; - g_free(hentry[H_X_ML_NAME].body); - hentry[H_X_ML_NAME].body = NULL; - g_free(hentry[H_X_LIST].body); - hentry[H_X_LIST].body = NULL; - g_free(hentry[H_X_MAILING_LIST].body); - hentry[H_X_MAILING_LIST].body = NULL; - - break; - case FILTER_BY_FROM: - *header = g_strdup("From"); - *key = g_strdup(msginfo->from); - break; - case FILTER_BY_TO: - *header = g_strdup("To"); - *key = g_strdup(msginfo->to); - break; - case FILTER_BY_SUBJECT: - *header = g_strdup("Subject"); - *key = g_strdup(msginfo->subject); - break; - default: - break; - } -} - void procmsg_empty_trash(FolderItem *trash) { if (trash && trash->total > 0) { |