+typedef struct _msg_filter{
+ HashList *Filter;
+ HashPos *p;
+ StrBuf *buffer;
+}msg_filter;
+
+void headers_brief_filter(long msgnum, void *userdata)
+{
+ long i, l;
+ struct CtdlMessage *msg;
+ msg_filter *flt = (msg_filter*) userdata;
+
+ l = GetCount(flt->Filter);
+ msg = CtdlFetchMessage(msgnum, 0);
+ StrBufPrintf(flt->buffer, "%ld", msgnum);
+ if (msg == NULL) {
+ for (i = 0; i < l; i++) {
+ StrBufAppendBufPlain(flt->buffer, HKEY("|"), 0);
+ }
+ }
+ else {
+ const char *k;
+ long len;
+ void *v;
+ RewindHashPos(flt->Filter, flt->p, 0);
+ while (GetNextHashPos(flt->Filter, flt->p, &len, &k, &v)) {
+ eMsgField f = (eMsgField) v;
+
+ StrBufAppendBufPlain(flt->buffer, HKEY("|"), 0);
+ if (!CM_IsEmpty(msg, f)) {
+ StrBufAppendBufPlain(flt->buffer, CM_KEY(msg, f), 0);
+ }
+ }
+ }
+ StrBufAppendBufPlain(flt->buffer, HKEY("\n"), 0);
+ cputbuf(flt->buffer);
+}
+