2 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
4 * Authors: Michael Zucchi <notzed@ximian.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU Lesser General Public
8 * License as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef CAMEL_SEARCH_PRIVATE_H
22 #define CAMEL_SEARCH_PRIVATE_H
24 /* POSIX requires <sys/types.h> be included before <regex.h> */
25 #include <sys/types.h>
29 #include <camel/camel.h>
34 CAMEL_SEARCH_MATCH_START = 1 << 0,
35 CAMEL_SEARCH_MATCH_END = 1 << 1,
36 CAMEL_SEARCH_MATCH_REGEX = 1 << 2, /* disables the first 2 */
37 CAMEL_SEARCH_MATCH_ICASE = 1 << 3,
38 CAMEL_SEARCH_MATCH_NEWLINE = 1 << 4
39 } camel_search_flags_t;
42 CAMEL_SEARCH_MATCH_EXACT,
43 CAMEL_SEARCH_MATCH_CONTAINS,
44 CAMEL_SEARCH_MATCH_WORD,
45 CAMEL_SEARCH_MATCH_STARTS,
46 CAMEL_SEARCH_MATCH_ENDS,
47 CAMEL_SEARCH_MATCH_SOUNDEX
48 } camel_search_match_t;
51 CAMEL_SEARCH_TYPE_ASIS,
52 CAMEL_SEARCH_TYPE_ENCODED,
53 CAMEL_SEARCH_TYPE_ADDRESS,
54 CAMEL_SEARCH_TYPE_ADDRESS_ENCODED,
55 CAMEL_SEARCH_TYPE_MLIST /* its a mailing list pseudo-header */
58 /* builds a regex that represents a string search */
59 gint camel_search_build_match_regex (regex_t *pattern,
60 camel_search_flags_t type,
62 CamelSExpResult **argv,
64 gboolean camel_search_message_body_contains
65 (CamelDataWrapper *object,
68 gboolean camel_search_header_match (const gchar *value,
70 camel_search_match_t how,
72 const gchar *default_charset);
73 gboolean camel_search_camel_header_soundex
77 /* TODO: replace with a real search function */
78 const gchar * camel_ustrstrcase (const gchar *haystack,
81 /* Some crappy utility functions for handling multiple search words */
82 typedef enum _camel_search_word_t {
83 CAMEL_SEARCH_WORD_SIMPLE = 1,
84 CAMEL_SEARCH_WORD_COMPLEX = 2,
85 CAMEL_SEARCH_WORD_8BIT = 4
86 } camel_search_word_t;
88 struct _camel_search_word {
89 camel_search_word_t type;
93 struct _camel_search_words {
95 camel_search_word_t type; /* OR of all word types in list */
96 struct _camel_search_word **words;
99 struct _camel_search_words *
100 camel_search_words_split (const guchar *in);
101 struct _camel_search_words *
102 camel_search_words_simple (struct _camel_search_words *words);
103 void camel_search_words_free (struct _camel_search_words *words);
107 #endif /* CAMEL_SEARCH_PRIVATE_H */