Back to index

courier  0.68.2
searchinfo.h
Go to the documentation of this file.
00001 #ifndef       searchinfo_h
00002 #define       searchinfo_h
00003 
00004 #include "maildir/maildirsearch.h"
00005 
00006 /*
00007 ** Copyright 1998 - 2002 Double Precision, Inc.
00008 ** See COPYING for distribution information.
00009 */
00010 
00011 
00012        /* Search keys */
00013 
00014 typedef enum {
00015        search_messageset,
00016        search_all,
00017        search_msgflag,      /* Includes ANSWERED DELETED DRAFT FLAGGED RECENT SEEN */
00018        search_msgkeyword, /* KEYWORD */
00019 
00020        search_not,   /* Logical NOT, used to implement UNANSWERED
00021                      UNDELETED UNDRAFT UNFLAGGED UNKEYWORD UNSEEN, etc... */
00022 
00023        /* NOTE: NEW gets parsed as ( RECENT UNSEEN )  OLD gets parsed as
00024        NOT RECENT */
00025 
00026        search_and,
00027        search_or,
00028 
00029 
00030        search_header, /* Also used to implement BCC, CC, FROM, TO, SUBJECT */
00031 
00032        search_before,
00033        search_body,
00034        search_larger,
00035        search_on,
00036        search_sentbefore,
00037        search_senton,
00038        search_sentsince,
00039        search_since,
00040        search_smaller,
00041        search_text,
00042        search_uid,
00043 
00044        /*
00045        ** search_orderedsubj is a dummy node that's allocated in order to
00046        ** implement an ORDEREDSUBJ THREAD/SORT. as points to the stripped
00047        ** subject from the message.
00048        */
00049 
00050        search_orderedsubj,
00051 
00052        /*
00053        ** search_references? are dummy nodes that are allocated in order to
00054        ** implement a REFERENCES THREAD.
00055        */
00056 
00057        search_references1,  /*  References: and In-Reply-To: header */
00058        search_references2,  /*  Date: header */
00059        search_references3,  /*  Subject: header */
00060        search_references4,  /*  Message-ID: header */
00061 
00062        /*
00063        ** And the following dummies are used for similar purposes for the
00064        ** SORT command.
00065        */
00066 
00067        search_arrival,
00068        search_cc,
00069        search_date,
00070        search_from,
00071        search_reverse,
00072        search_size,
00073        search_to
00074 
00075        } search_type;
00076 
00077 /* This structure is used when doing content searching */
00078 
00079 
00080 
00081 /* A SEARCH request gets parsed into the following structure */
00082 
00083 struct searchinfo {
00084        struct searchinfo *next;    /* Link list of all searchinfos */
00085 
00086        struct searchinfo *a, *b;   /* Nested search requests */
00087 
00088        search_type   type;
00089 
00090        char   *as, *bs, *cs;              /* As needed */
00091 
00092        const struct unicode_info *bs_charset;
00093        /* search_text: text string in orig charset is as, text string in
00094           bs_charset charset is in bs */
00095 
00096 
00097        int    value; /* When evaluating: 0 - false, 1 - true, -1 - unknown */
00098                      /* Not used in AND, OR, and NOT nodes */
00099 
00100        struct maildir_searchengine sei;   /* Used when searching */
00101 
00102        struct libmail_keywordEntry *ke;
00103        } ;
00104 
00105 void free_search(struct searchinfo *);
00106 struct searchinfo *alloc_search(struct searchinfo **);
00107 
00108 struct searchinfo *alloc_parsesearch(struct searchinfo **);
00109 struct searchinfo *alloc_searchextra(struct searchinfo *,
00110        struct searchinfo **, search_type);
00111 void debug_search(struct searchinfo *);
00112 
00113 struct unicode_info;
00114 
00115 void dosearch(struct searchinfo *, struct searchinfo *,
00116              const char *, int);
00117 
00118 void search_internal(struct searchinfo *, struct searchinfo *,
00119                    const char *,
00120                    int, void (*)(struct searchinfo *,
00121                                struct searchinfo *, int,
00122                                unsigned long, void *), void *);
00123 
00124 void search_set_charset_conv(struct searchinfo *, const char *);
00125 
00126 #endif