Back to index

courier  0.68.2
Classes | Enumerations | Functions
searchinfo.h File Reference
#include "maildir/maildirsearch.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  searchinfo

Enumerations

enum  search_type {
  search_messageset, search_all, search_msgflag, search_msgkeyword,
  search_not, search_and, search_or, search_header,
  search_before, search_body, search_larger, search_on,
  search_sentbefore, search_senton, search_sentsince, search_since,
  search_smaller, search_text, search_uid, search_orderedsubj,
  search_references1, search_references2, search_references3, search_references4,
  search_arrival, search_cc, search_date, search_from,
  search_reverse, search_size, search_to
}

Functions

void free_search (struct searchinfo *)
struct searchinfoalloc_search (struct searchinfo **)
struct searchinfoalloc_parsesearch (struct searchinfo **)
struct searchinfoalloc_searchextra (struct searchinfo *, struct searchinfo **, search_type)
void debug_search (struct searchinfo *)
void dosearch (struct searchinfo *, struct searchinfo *, const char *, int)
void search_internal (struct searchinfo *, struct searchinfo *, const char *, int, void(*)(struct searchinfo *, struct searchinfo *, int, unsigned long, void *), void *)
void search_set_charset_conv (struct searchinfo *, const char *)

Class Documentation

struct searchinfo

Definition at line 83 of file searchinfo.h.

Collaboration diagram for searchinfo:
Class Members
struct searchinfo * a
char * as
struct searchinfo * b
char * bs
struct unicode_info * bs_charset
char * cs
struct libmail_keywordEntry * ke
struct searchinfo * next
search_type type
int value

Enumeration Type Documentation

Enumerator:
search_messageset 
search_all 
search_msgflag 
search_msgkeyword 
search_not 
search_and 
search_or 
search_header 
search_before 
search_body 
search_larger 
search_on 
search_sentbefore 
search_senton 
search_sentsince 
search_since 
search_smaller 
search_text 
search_uid 
search_orderedsubj 
search_references1 
search_references2 
search_references3 
search_references4 
search_arrival 
search_cc 
search_date 
search_from 
search_reverse 
search_size 
search_to 

Definition at line 14 of file searchinfo.h.

             {
       search_messageset,
       search_all,
       search_msgflag,      /* Includes ANSWERED DELETED DRAFT FLAGGED RECENT SEEN */
       search_msgkeyword, /* KEYWORD */

       search_not,   /* Logical NOT, used to implement UNANSWERED
                     UNDELETED UNDRAFT UNFLAGGED UNKEYWORD UNSEEN, etc... */

       /* NOTE: NEW gets parsed as ( RECENT UNSEEN )  OLD gets parsed as
       NOT RECENT */

       search_and,
       search_or,


       search_header, /* Also used to implement BCC, CC, FROM, TO, SUBJECT */

       search_before,
       search_body,
       search_larger,
       search_on,
       search_sentbefore,
       search_senton,
       search_sentsince,
       search_since,
       search_smaller,
       search_text,
       search_uid,

       /*
       ** search_orderedsubj is a dummy node that's allocated in order to
       ** implement an ORDEREDSUBJ THREAD/SORT. as points to the stripped
       ** subject from the message.
       */

       search_orderedsubj,

       /*
       ** search_references? are dummy nodes that are allocated in order to
       ** implement a REFERENCES THREAD.
       */

       search_references1,  /*  References: and In-Reply-To: header */
       search_references2,  /*  Date: header */
       search_references3,  /*  Subject: header */
       search_references4,  /*  Message-ID: header */

       /*
       ** And the following dummies are used for similar purposes for the
       ** SORT command.
       */

       search_arrival,
       search_cc,
       search_date,
       search_from,
       search_reverse,
       search_size,
       search_to

       } search_type;

Function Documentation

struct searchinfo* alloc_parsesearch ( struct searchinfo **  ) [read]

Definition at line 54 of file searchinfo.c.

{
struct searchinfo *si;

       *head=0;
       if ((si=alloc_search_andlist(head)) == 0)
       {
              free_search(*head);
              return (0);
       }
       return (si);
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct searchinfo* alloc_search ( struct searchinfo **  ) [read]

Definition at line 20 of file searchinfo.c.

{
struct searchinfo *si=(struct searchinfo *)malloc(sizeof(**head));

       if (si == 0)  write_error_exit(0);
       memset(si, 0, sizeof(*si));
       maildir_search_init(&si->sei);
       si->next= *head;
       *head=si;
       return (si);
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct searchinfo* alloc_searchextra ( struct searchinfo ,
struct searchinfo **  ,
search_type   
) [read]

Definition at line 67 of file searchinfo.c.

{
       struct searchinfo *si;

       if (t == search_references1)
       {
              /* Automatically add third and second dummy node */

              top=alloc_searchextra(top, head, search_references4);
              top=alloc_searchextra(top, head, search_references3);
              top=alloc_searchextra(top, head, search_references2);
       }
       si=alloc_search(head);
       si->type=t;
       si->a=top;
       return (si);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void debug_search ( struct searchinfo )

Here is the caller graph for this function:

void dosearch ( struct searchinfo ,
struct searchinfo ,
const char *  ,
int   
)

Definition at line 73 of file search.c.

{
       search_internal(si, sihead, charset, isuid, search_callback, 0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void free_search ( struct searchinfo )

Definition at line 32 of file searchinfo.c.

{
struct searchinfo *p;

       while (si)
       {
              p=si->next;
              if (si->as)   free(si->as);
              if (si->bs)   free(si->bs);
              if (si->cs)   free(si->cs);

              maildir_search_destroy(&si->sei);

              free(si);
              si=p;
       }
}

Here is the caller graph for this function:

void search_internal ( struct searchinfo ,
struct searchinfo ,
const char *  ,
int  ,
void(*)(struct searchinfo *, struct searchinfo *, int, unsigned long, void *)  ,
void *   
)

Definition at line 104 of file search.c.

{
       unsigned long i;
       struct searchinfo *p;

       for (p=sihead; p; p=p->next)
              fill_search_preparse(p);

       /* Shortcuts for keyword-based searches */

       if (si->type == search_msgkeyword && si->bs == NULL && si->ke)
              search_byKeyword(NULL, si, sihead, charset, isuid,
                            callback_func, voidarg);
       else if (si->type == search_and &&
               si->a->type == search_msgkeyword && si->a->bs == NULL
               && si->a->ke)
              search_byKeyword(si->b, si->a, sihead, charset, isuid,
                            callback_func, voidarg);
       else for (i=0; i<current_maildir_info.nmessages; i++)
              search_oneatatime(si, i, sihead, charset, isuid,
                              callback_func, voidarg);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void search_set_charset_conv ( struct searchinfo ,
const char *   
)

Definition at line 509 of file searchinfo.c.

{
       for (; si; si=si->next)
       {
              if (si->type != search_text && si->type != search_body
                  && si->type != search_header)
                     continue;
              if (si->value > 0)
                     continue; /* Already found, no need to do this again */

              if (maildir_search_start_str_chset(&si->sei,
                                             si->as ? si->as:"",
                                             charset))
              {
                     si->value=0;
                     continue;
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function: