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