2 ** Copyright 2000 Double Precision, Inc.
3 ** See COPYING for distribution information.
30 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
34 rfc822_threadallocmsg(mt
, buf
);
36 rfc822_threadallocmsg(mt
, buf
);
38 printf("%s\n", (rfc822_threadsearchmsg(mt
, "a@b")
39 ? "found":"not found"));
40 printf("%s\n", (rfc822_threadsearchmsg(mt
, "c@d")
41 ? "found":"not found"));
42 printf("%s\n", (rfc822_threadsearchmsg(mt
, "e@f")
43 ? "found":"not found"));
45 rfc822_threadfree(mt
);
48 static void prtree(struct imap_refmsg
*m
)
50 printf("<%s>", m
->msgid
? m
->msgid
:"");
59 printf("<%s>", m
->parent
->msgid
? m
->parent
->msgid
:"");
65 for (m
=m
->firstchild
; m
; m
=m
->nextsib
)
69 static void prpc(struct imap_refmsgtable
*mt
)
71 struct imap_refmsg
*root
=rfc822_threadgetroot(mt
), *m
;
76 for (m
=root
->firstchild
; m
; m
=m
->nextsib
)
84 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
86 rfc822_threadmsg(mt
, "<1>", NULL
,
88 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
90 rfc822_threadmsg(mt
, "<2>",
93 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
95 rfc822_threadmsg(mt
, "<4>",
98 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
101 rfc822_threadfree(mt
);
106 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
108 rfc822_threadmsg(mt
, "<4>",
111 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
113 rfc822_threadmsg(mt
, "<3>",
116 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
118 rfc822_threadmsg(mt
, "<2>",
121 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
123 rfc822_threadmsg(mt
, "<1>", NULL
,
125 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
128 rfc822_threadfree(mt
);
133 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
135 rfc822_threadmsg(mt
, "<1>", NULL
,
137 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
139 rfc822_threadmsg(mt
, "<2>", "<1>",
141 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
143 rfc822_threadmsg(mt
, "<4>", "<1> <2> <3>",
145 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
148 rfc822_threadprune(mt
);
150 rfc822_threadfree(mt
);
155 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
157 rfc822_threadmsg(mt
, "<4>", "<1> <2> <3>",
159 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
161 rfc822_threadmsg(mt
, "<3>", NULL
,
163 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
166 rfc822_threadprune(mt
);
168 rfc822_threadfree(mt
);
171 static void prsubj(struct imap_refmsgtable
*p
)
173 struct imap_subjlookup
*s
;
176 for (i
=0; i
<sizeof(p
->subjtable
)/sizeof(p
->subjtable
[0]); i
++)
177 for (s
=p
->subjtable
[i
]; s
; s
=s
->nextsubj
)
178 printf("subject(%s)=<%s>\n", s
->subj
,
179 s
->msg
->msgid
? s
->msg
->msgid
:"");
185 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
187 rfc822_threadmsg(mt
, "<message1>", NULL
,
189 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
191 rfc822_threadmsg(mt
, "<message10>", NULL
,
193 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 2);
195 rfc822_threadmsg(mt
, "<message3>", "<message2>",
197 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 3);
199 rfc822_threadmsg(mt
, "<message11>", NULL
,
201 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 4);
203 rfc822_threadmsg(mt
, "<message12>", NULL
,
205 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 5);
207 rfc822_threadmsg(mt
, "<message13>", NULL
,
209 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 6);
211 rfc822_threadmsg(mt
, "<message14>", NULL
,
213 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 7);
215 rfc822_threadprune(mt
);
216 rfc822_threadsortsubj(rfc822_threadgetroot(mt
));
217 rfc822_threadgathersubj(mt
, rfc822_threadgetroot(mt
));
220 rfc822_threadfree(mt
);
225 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
227 rfc822_threadmsg(mt
, "<message1>", "<message1-dummy>",
229 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
231 rfc822_threadmsg(mt
, "<message2>", "<message2-dummy>",
233 "Thu, 29 Jun 2000 14:41:58 -0700", 0, 1);
234 rfc822_threadprune(mt
);
235 rfc822_threadsortsubj(rfc822_threadgetroot(mt
));
236 rfc822_threadgathersubj(mt
, rfc822_threadgetroot(mt
));
239 rfc822_threadmergesubj(mt
, rfc822_threadgetroot(mt
));
241 rfc822_threadfree(mt
);
246 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
248 rfc822_threadmsg(mt
, "<message4>", NULL
,
250 "Thu, 29 Jun 2000 14:41:51 -0700", 0, 1);
252 rfc822_threadmsg(mt
, "<message2>", NULL
,
254 "Thu, 29 Jun 2000 14:41:52 -0700", 0, 1);
256 rfc822_threadmsg(mt
, "<message1>", "<message1-dummy>",
258 "Thu, 29 Jun 2000 14:41:53 -0700", 0, 1);
260 rfc822_threadmsg(mt
, "<message3>", NULL
,
262 "Thu, 29 Jun 2000 14:41:54 -0700", 0, 1);
264 rfc822_threadmsg(mt
, "<message10>", NULL
,
266 "Thu, 29 Jun 2000 14:41:55 -0700", 0, 1);
268 rfc822_threadmsg(mt
, "<message11>", NULL
,
270 "Thu, 29 Jun 2000 14:41:56 -0700", 0, 1);
272 rfc822_threadprune(mt
);
273 rfc822_threadsortsubj(rfc822_threadgetroot(mt
));
274 rfc822_threadgathersubj(mt
, rfc822_threadgetroot(mt
));
277 rfc822_threadmergesubj(mt
, rfc822_threadgetroot(mt
));
279 rfc822_threadfree(mt
);
284 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
286 rfc822_threadmsg(mt
, "<message1>", NULL
,
288 "Thu, 20 Jun 2000 14:41:55 -0700", 0, 1);
290 rfc822_threadmsg(mt
, "<message2>", NULL
,
292 "Thu, 19 Jun 2000 14:41:51 -0700", 0, 2);
294 rfc822_threadmsg(mt
, "<message3>", NULL
,
296 "Thu, 21 Jun 2000 14:41:56 -0700", 0, 3);
298 rfc822_threadmsg(mt
, "<message4>", "<message2>",
300 "Thu, 21 Jun 2000 14:41:54 -0700", 0, 6);
302 rfc822_threadmsg(mt
, "<message5>", "<message2>",
304 "Thu, 21 Jun 2000 14:41:53 -0700", 0, 5);
306 rfc822_threadmsg(mt
, "<message6>", "<message2>",
308 "Thu, 20 Jun 2000 14:41:52 -0700", 0, 4);
311 rfc822_threadprune(mt
);
312 rfc822_threadsortsubj(rfc822_threadgetroot(mt
));
313 rfc822_threadgathersubj(mt
, rfc822_threadgetroot(mt
));
314 rfc822_threadmergesubj(mt
, rfc822_threadgetroot(mt
));
315 rfc822_threadsortbydate(mt
);
317 rfc822_threadfree(mt
);
322 struct imap_refmsgtable
*mt
=rfc822_threadalloc();
324 rfc822_threadmsg(mt
, "<message1>", NULL
,
326 "Thu, 20 Jun 2000 14:41:58 -0700", 0, 1);
328 rfc822_threadmsg(mt
, "<message4>", "<message1>",
330 "Thu, 21 Jun 2000 14:41:58 -0700", 0, 6);
332 rfc822_threadmsg(mt
, "<message1>", NULL
,
334 "Thu, 21 Jun 2000 14:41:58 -0700", 0, 5);
336 rfc822_threadmsg(mt
, "<message4>", "<message1>",
338 "Thu, 21 Jun 2000 14:41:58 -0700", 0, 6);
340 rfc822_threadprune(mt
);
341 rfc822_threadsortsubj(rfc822_threadgetroot(mt
));
342 rfc822_threadgathersubj(mt
, rfc822_threadgetroot(mt
));
343 rfc822_threadmergesubj(mt
, rfc822_threadgetroot(mt
));
344 rfc822_threadsortbydate(mt
);
346 rfc822_threadfree(mt
);
349 int main(int argc
, char **argv
)
353 setlocale(LC_ALL
, "C");