Back to index

courier  0.68.2
imaprefs.h
Go to the documentation of this file.
00001 /*
00002 */
00003 #ifndef       imaprefs_h
00004 #define       imaprefs_h
00005 
00006 /*
00007 ** Copyright 2000-2003 Double Precision, Inc.
00008 ** See COPYING for distribution information.
00009 */
00010 
00011 #if    HAVE_CONFIG_H
00012 #include      "../rfc822/config.h"
00013 #endif
00014 
00015 #ifdef  __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 /*
00020 ** Implement REFERENCES threading.
00021 */
00022 
00023 /* The data structures */
00024 
00025 struct imap_refmsg {
00026        struct imap_refmsg *next, *last;   /* Link list of all msgs */
00027        struct imap_refmsg *parent;        /* my parent */
00028        struct imap_refmsg *firstchild, *lastchild; /* Children link list */
00029        struct imap_refmsg *prevsib, *nextsib;    /* Link list of siblings */
00030 
00031        char isdummy;               /* this is a dummy node (for now) */
00032        char flag2;                 /* Additional flag */
00033 
00034        char *msgid;                /* msgid of this message */
00035 
00036        char *subj;                 /* dynalloced subject of this msg */
00037        time_t timestamp;           /* Timestamp */
00038        unsigned long seqnum;              /* Sequence number */
00039 } ;
00040 
00041 struct imap_refmsgtable {
00042         struct imap_refmsg *firstmsg, *lastmsg; /* Link list of all msgs */
00043 
00044         /* hash table message id lookup */
00045 
00046         struct imap_refmsghash *hashtable[512];
00047 
00048         struct imap_subjlookup *subjtable[512];
00049 
00050         struct imap_refmsg *rootptr;            /* The root */
00051 } ;
00052 
00053 struct imap_refmsgtable *rfc822_threadalloc(void);
00054 void rfc822_threadfree(struct imap_refmsgtable *);
00055 struct imap_refmsg *rfc822_threadmsg(struct imap_refmsgtable *mt,
00056                                  const char *msgidhdr,
00057                                  const char *refhdr,
00058                                  const char *subjheader,
00059 
00060                                  const char *dateheader,
00061                                  time_t dateheader_tm,
00062                                  /* Set one or other */
00063 
00064                                  unsigned long seqnum);
00065 
00066 struct imap_refmsg *rfc822_threadmsgrefs(struct imap_refmsgtable *mt,
00067                                     const char *msgid_s,
00068                                     const char * const * msgidList,
00069                                     const char *subjheader,
00070                                     const char *dateheader,
00071                                     time_t dateheader_tm,
00072                                     unsigned long seqnum);
00073 
00074 struct imap_refmsg *rfc822_thread(struct imap_refmsgtable *mt);
00075 
00076        /* INTERNAL FUNCTIONS FOLLOW */
00077 
00078 
00079 struct imap_refmsghash {
00080        struct imap_refmsghash *nexthash;
00081        struct imap_refmsg *msg;
00082 } ;
00083 
00084 struct imap_subjlookup {
00085        struct imap_subjlookup *nextsubj;
00086        char *subj;
00087        struct imap_refmsg *msg;
00088        int msgisrefwd;
00089 } ;
00090 
00091 struct imap_refmsg *rfc822_threadallocmsg(struct imap_refmsgtable *mt,
00092                                      const char *msgid);
00093 void rfc822_threadprune(struct imap_refmsgtable *mt);
00094 struct imap_refmsg *rfc822_threadgetroot(struct imap_refmsgtable *mt);
00095 struct imap_refmsg *rfc822_threadsearchmsg(struct imap_refmsgtable *mt,
00096                                       const char *msgid);
00097 int rfc822_threadsortsubj(struct imap_refmsg *root);
00098 int rfc822_threadgathersubj(struct imap_refmsgtable *mt,
00099                        struct imap_refmsg *root);
00100 int rfc822_threadmergesubj(struct imap_refmsgtable *mt,
00101                         struct imap_refmsg *root);
00102 int rfc822_threadsortbydate(struct imap_refmsgtable *mt);
00103 
00104 
00105 #ifdef  __cplusplus
00106 }
00107 #endif
00108 
00109 #endif