Import Debian package 0.61.0-1+lenny1
[hcoop/debian/courier-authlib.git] / rfc822 / imaprefs.h
1 /*
2 ** $Id: imaprefs.h,v 1.4 2003/07/09 21:33:20 mrsam Exp $
3 */
4 #ifndef imaprefs_h
5 #define imaprefs_h
6
7 /*
8 ** Copyright 2000-2003 Double Precision, Inc.
9 ** See COPYING for distribution information.
10 */
11
12 #if HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 /*
21 ** Implement REFERENCES threading.
22 */
23
24 /* The data structures */
25
26 struct imap_refmsg {
27 struct imap_refmsg *next, *last; /* Link list of all msgs */
28 struct imap_refmsg *parent; /* my parent */
29 struct imap_refmsg *firstchild, *lastchild; /* Children link list */
30 struct imap_refmsg *prevsib, *nextsib; /* Link list of siblings */
31
32 char isdummy; /* this is a dummy node (for now) */
33 char flag2; /* Additional flag */
34
35 char *msgid; /* msgid of this message */
36
37 char *subj; /* dynalloced subject of this msg */
38 time_t timestamp; /* Timestamp */
39 unsigned long seqnum; /* Sequence number */
40 } ;
41
42 struct imap_refmsgtable {
43 struct imap_refmsg *firstmsg, *lastmsg; /* Link list of all msgs */
44
45 /* hash table message id lookup */
46
47 struct imap_refmsghash *hashtable[512];
48
49 struct imap_subjlookup *subjtable[512];
50
51 struct imap_refmsg *rootptr; /* The root */
52 } ;
53
54 struct imap_refmsgtable *rfc822_threadalloc(void);
55 void rfc822_threadfree(struct imap_refmsgtable *);
56 struct imap_refmsg *rfc822_threadmsg(struct imap_refmsgtable *mt,
57 const char *msgidhdr,
58 const char *refhdr,
59 const char *subjheader,
60
61 const char *dateheader,
62 time_t dateheader_tm,
63 /* Set one or other */
64
65 unsigned long seqnum);
66
67 struct imap_refmsg *rfc822_threadmsgrefs(struct imap_refmsgtable *mt,
68 const char *msgid_s,
69 const char * const * msgidList,
70 const char *subjheader,
71 const char *dateheader,
72 time_t dateheader_tm,
73 unsigned long seqnum);
74
75 struct imap_refmsg *rfc822_thread(struct imap_refmsgtable *mt);
76
77 /* INTERNAL FUNCTIONS FOLLOW */
78
79
80 struct imap_refmsghash {
81 struct imap_refmsghash *nexthash;
82 struct imap_refmsg *msg;
83 } ;
84
85 struct imap_subjlookup {
86 struct imap_subjlookup *nextsubj;
87 char *subj;
88 struct imap_refmsg *msg;
89 int msgisrefwd;
90 } ;
91
92 struct imap_refmsg *rfc822_threadallocmsg(struct imap_refmsgtable *mt,
93 const char *msgid);
94 void rfc822_threadprune(struct imap_refmsgtable *mt);
95 struct imap_refmsg *rfc822_threadgetroot(struct imap_refmsgtable *mt);
96 struct imap_refmsg *rfc822_threadsearchmsg(struct imap_refmsgtable *mt,
97 const char *msgid);
98 int rfc822_threadsortsubj(struct imap_refmsg *root);
99 int rfc822_threadgathersubj(struct imap_refmsgtable *mt,
100 struct imap_refmsg *root);
101 int rfc822_threadmergesubj(struct imap_refmsgtable *mt,
102 struct imap_refmsg *root);
103 int rfc822_threadsortbydate(struct imap_refmsgtable *mt);
104
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif