NeoMutt  2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
graphviz.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stdbool.h>
31#include <stdio.h>
32#include <string.h>
33#include <sys/stat.h>
34#include <time.h>
35#include "mutt/lib.h"
36#include "address/lib.h"
37#include "config/lib.h"
38#include "email/lib.h"
39#include "core/lib.h"
40#include "conn/lib.h"
41#include "lib.h"
42#include "attach/lib.h"
43#include "compmbox/lib.h"
44#include "imap/lib.h"
45#include "maildir/lib.h"
46#include "mbox/lib.h"
47#include "ncrypt/lib.h"
48#include "nntp/lib.h"
49#include "notmuch/lib.h"
50#include "pattern/lib.h"
51#include "pop/lib.h"
52#include "imap/adata.h" // IWYU pragma: keep
53#include "imap/mdata.h" // IWYU pragma: keep
54#include "imap/private.h" // IWYU pragma: keep
55#include "maildir/edata.h" // IWYU pragma: keep
56#include "maildir/mdata.h" // IWYU pragma: keep
57#include "mview.h"
58#include "nntp/adata.h" // IWYU pragma: keep
59#include "nntp/mdata.h" // IWYU pragma: keep
60#include "notmuch/adata.h" // IWYU pragma: keep
61#include "notmuch/mdata.h" // IWYU pragma: keep
62#include "notmuch/private.h" // IWYU pragma: keep
63#include "pop/adata.h" // IWYU pragma: keep
64#include "pop/private.h" // IWYU pragma: keep
65
66// #define GV_HIDE_MVIEW
67#define GV_HIDE_MVIEW_CONTENTS
68// #define GV_HIDE_MBOX
69// #define GV_HIDE_NEOMUTT
70// #define GV_HIDE_CONFIG
71// #define GV_HIDE_ADATA
72// #define GV_HIDE_MDATA
73// #define GV_HIDE_BODY_CONTENT
74// #define GV_HIDE_ENVELOPE
75
76void dot_email(FILE *fp, struct Email *e, struct ListHead *links);
77void dot_envelope(FILE *fp, struct Envelope *env, struct ListHead *links);
78void dot_patternlist(FILE *fp, struct PatternList *pl, struct ListHead *links);
79
80void dot_type_bool(FILE *fp, const char *name, bool val)
81{
82 static const char *values[] = { "false", "true" };
83 fprintf(fp, "\t\t<tr>\n");
84 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
85 fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
86 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", values[val]);
87 fprintf(fp, "\t\t</tr>\n");
88}
89
90#ifndef GV_HIDE_ADATA
91void dot_type_char(FILE *fp, const char *name, char ch)
92{
93 fprintf(fp, "\t\t<tr>\n");
94 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
95 fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
96 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%c</td>\n", ch);
97 fprintf(fp, "\t\t</tr>\n");
98}
99#endif
100
101void dot_type_date(char *buf, size_t buflen, time_t timestamp)
102{
103 mutt_date_localtime_format(buf, buflen, "%Y-%m-%d %H:%M:%S", timestamp);
104}
105
106void dot_type_file(FILE *fp, const char *name, FILE *struct_fp)
107{
108 fprintf(fp, "\t\t<tr>\n");
109 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
110 fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
111 if (struct_fp)
112 {
113 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%p (%d)</td>\n",
114 (void *) struct_fp, fileno(struct_fp));
115 }
116 else
117 {
118 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">NULL</td>\n");
119 }
120 fprintf(fp, "\t\t</tr>\n");
121}
122
123void dot_type_number(FILE *fp, const char *name, int num)
124{
125 fprintf(fp, "\t\t<tr>\n");
126 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
127 fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
128 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%d</td>\n", num);
129 fprintf(fp, "\t\t</tr>\n");
130}
131
132void dot_type_string_escape(char *buf, size_t buflen)
133{
134 for (; buf[0]; buf++)
135 {
136 if (buf[0] == '<')
137 mutt_str_inline_replace(buf, buflen, 1, "&lt;");
138 else if (buf[0] == '>')
139 mutt_str_inline_replace(buf, buflen, 1, "&gt;");
140 else if (buf[0] == '&')
141 mutt_str_inline_replace(buf, buflen, 1, "&amp;");
142 }
143}
144
145void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
146{
147 if ((!str || (str[0] == '\0')) && !force)
148 return;
149
150 char buf[1024] = "[NULL]";
151
152 if (str)
153 {
154 mutt_str_copy(buf, str, sizeof(buf));
155 dot_type_string_escape(buf, sizeof(buf));
156 }
157
158 bool quoted = ((buf[0] != '[') && (buf[0] != '*'));
159
160 fprintf(fp, "\t\t<tr>\n");
161 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
162 fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
163 if (quoted)
164 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">\"%s\"</td>\n", buf);
165 else
166 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", buf);
167 fprintf(fp, "\t\t</tr>\n");
168}
169
170#ifndef GV_HIDE_MDATA
171void dot_type_umask(char *buf, size_t buflen, int umask)
172{
173 snprintf(buf, buflen, "0%03o", umask);
174}
175#endif
176
177void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
178{
179 snprintf(buf, buflen, "obj_%p", ptr);
180}
181
182void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
183{
184 fprintf(fp, "\t\t<tr>\n");
185 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
186 fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
187 if (colour && ptr)
188 {
189 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\" bgcolor=\"%s\">%p</td>\n",
190 colour, ptr);
191 }
192 else
193 {
194 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%p</td>\n", ptr);
195 }
196 fprintf(fp, "\t\t</tr>\n");
197}
198
199void dot_add_link(struct ListHead *links, void *src, void *dst,
200 const char *label, bool back, const char *colour)
201{
202 if (!src || !dst)
203 return;
204 if (!colour)
205 colour = "#c0c0c0";
206
207 char obj1[64] = { 0 };
208 char obj2[64] = { 0 };
209 char text[256] = { 0 };
210 char lstr[128] = { 0 };
211
212 dot_ptr_name(obj1, sizeof(obj1), src);
213 dot_ptr_name(obj2, sizeof(obj2), dst);
214
215 if (label)
216 snprintf(lstr, sizeof(lstr), "edgetooltip=\"%s\"", label);
217
218 snprintf(text, sizeof(text), "%s -> %s [ %s %s color=\"%s\" ]", obj1, obj2,
219 back ? "dir=back" : "", lstr, colour);
221}
222
223void dot_graph_header(FILE *fp)
224{
225 fprintf(fp, "digraph neomutt\n");
226 fprintf(fp, "{\n\n");
227
228 fprintf(fp, "\tgraph [\n");
229 fprintf(fp, "\t\trankdir=\"TB\"\n");
230 fprintf(fp, "\t\tnodesep=\"0.5\"\n");
231 fprintf(fp, "\t\tranksep=\"0.5\"\n");
232 fprintf(fp, "\t];\n");
233 fprintf(fp, "\n");
234 fprintf(fp, "\tnode [\n");
235 fprintf(fp, "\t\tshape=\"plain\"\n");
236 fprintf(fp, "\t];\n");
237 fprintf(fp, "\n");
238 fprintf(fp, "\tedge [\n");
239 fprintf(fp, "\t\tpenwidth=\"4.5\"\n");
240 fprintf(fp, "\t\tarrowsize=\"1.0\"\n");
241 fprintf(fp, "\t\tcolor=\"#c0c0c0\"\n");
242 fprintf(fp, "\t];\n");
243 fprintf(fp, "\n");
244}
245
246void dot_graph_footer(FILE *fp, struct ListHead *links)
247{
248 fprintf(fp, "\n");
249 struct ListNode *np = NULL;
250 STAILQ_FOREACH(np, links, entries)
251 {
252 fprintf(fp, "\t%s;\n", np->data);
253 }
254 fprintf(fp, "\n}\n");
255}
256
257void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
258{
259 char obj[64] = { 0 };
260 dot_ptr_name(obj, sizeof(obj), ptr);
261
262 if (!colour)
263 colour = "#ffff80";
264
265 fprintf(fp, "\t%s [\n", obj);
266 fprintf(fp, "\t\tlabel=<<table cellspacing=\"0\" border=\"1\" rows=\"*\" "
267 "color=\"#d0d0d0\">\n");
268 fprintf(fp, "\t\t<tr>\n");
269 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\" bgcolor=\"%s\" port=\"top\" colspan=\"3\"><font color=\"#000000\" point-size=\"20\"><b>%s</b></font> <font point-size=\"12\">(%p)</font></td>\n",
270 colour, name, ptr);
271 fprintf(fp, "\t\t</tr>\n");
272}
273
274void dot_object_footer(FILE *fp)
275{
276 fprintf(fp, "\t\t</table>>\n");
277 fprintf(fp, "\t];\n");
278 fprintf(fp, "\n");
279}
280
281void dot_node(FILE *fp, void *ptr, const char *name, const char *colour)
282{
283 char obj[64] = { 0 };
284 dot_ptr_name(obj, sizeof(obj), ptr);
285
286 fprintf(fp, "\t%s [\n", obj);
287 fprintf(fp, "\t\tlabel=<<table cellspacing=\"0\" border=\"1\" rows=\"*\" "
288 "color=\"#d0d0d0\">\n");
289 fprintf(fp, "\t\t<tr>\n");
290 fprintf(fp, "\t\t\t<td border=\"0\" bgcolor=\"%s\" port=\"top\"><font color=\"#000000\" point-size=\"20\"><b>%s</b></font></td>\n",
291 colour, name);
292 fprintf(fp, "\t\t</tr>\n");
294}
295
296void dot_node_link(FILE *fp, void *ptr, const char *name, void *link, const char *colour)
297{
298 char obj[64] = { 0 };
299 dot_ptr_name(obj, sizeof(obj), ptr);
300
301 fprintf(fp, "\t%s [\n", obj);
302 fprintf(fp, "\t\tlabel=<<table cellspacing=\"0\" border=\"1\" rows=\"*\" "
303 "color=\"#d0d0d0\">\n");
304 fprintf(fp, "\t\t<tr>\n");
305 fprintf(fp, "\t\t\t<td border=\"0\" bgcolor=\"%s\" port=\"top\"><font color=\"#000000\" point-size=\"20\"><b>%s</b></font></td>\n",
306 colour, name);
307 fprintf(fp, "\t\t</tr>\n");
308
309 fprintf(fp, "\t\t<tr>\n");
310 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\" bgcolor=\"%s\">%p</td>\n", colour, link);
311 fprintf(fp, "\t\t</tr>\n");
312
314}
315
316void dot_path_fs(char *buf, size_t buflen, const char *path)
317{
318 if (!path)
319 {
320 buf[0] = '\0';
321 return;
322 }
323
324 const char *slash = strrchr(path, '/');
325 if (slash)
326 slash++;
327 else
328 slash = path;
329
330 mutt_str_copy(buf, slash, buflen);
331}
332
333void dot_path_imap(char *buf, size_t buflen, const char *path)
334{
335 char tmp[1024] = { 0 };
336 mutt_str_copy(tmp, path, sizeof(tmp));
337
338 struct Url *u = url_parse(tmp);
339
340 if (u->path && (u->path[0] != '\0'))
341 mutt_str_copy(buf, u->path, buflen);
342 else
343 snprintf(buf, buflen, "%s:%s", u->host, u->user);
344
345 url_free(&u);
346}
347
348#ifndef GV_HIDE_CONFIG
349void dot_config(FILE *fp, const char *name, int type, struct ConfigSubset *sub,
350 struct ListHead *links)
351{
352 if (!sub)
353 return;
354
355 struct Buffer *value = buf_pool_get();
356 dot_object_header(fp, (void *) name, "Config", "#ffff80");
357 dot_type_string(fp, "scope", sub->name, true);
358
359 if (sub->name)
360 {
361 char scope[256];
362 snprintf(scope, sizeof(scope), "%s:", sub->name);
363
364 struct HashElem **list = get_elem_list(sub->cs);
365 for (size_t i = 0; list[i]; i++)
366 {
367 struct HashElem *item = list[i];
368 if ((item->type & type) == 0)
369 continue;
370
371 const char *iname = item->key.strkey;
372 size_t slen = strlen(scope);
373 if (mutt_str_startswith(iname, scope) != 0)
374 {
375 if (strchr(iname + slen, ':'))
376 continue;
377 if ((DTYPE(item->type) == DT_STRING) && (item->type & DT_SENSITIVE))
378 {
379 dot_type_string(fp, iname + slen, "***", true);
380 }
381 else
382 {
383 buf_reset(value);
384 cs_subset_he_string_get(sub, item, value);
385 dot_type_string(fp, iname + slen, buf_string(value), true);
386 }
387 }
388 }
389 FREE(&list);
390 }
391 else
392 {
393 struct HashElem **list = get_elem_list(sub->cs);
394 int i = 0;
395 for (; list[i]; i++)
396 ; // do nothing
397
398 dot_type_number(fp, "count", i);
399 FREE(&list);
400 }
401
403 buf_pool_release(&value);
404}
405#endif
406
407void dot_comp(FILE *fp, struct CompressInfo *ci, struct ListHead *links)
408{
409 dot_object_header(fp, ci, "CompressInfo", "#c0c060");
410 dot_type_string(fp, "append", ci->cmd_append, true);
411 dot_type_string(fp, "close", ci->cmd_close, true);
412 dot_type_string(fp, "open", ci->cmd_open, true);
414}
415
416void dot_mailbox_type(FILE *fp, const char *name, enum MailboxType type)
417{
418 const char *typestr = NULL;
419
420 switch (type)
421 {
422 case MUTT_MBOX:
423 typestr = "MBOX";
424 break;
425 case MUTT_MMDF:
426 typestr = "MMDF";
427 break;
428 case MUTT_MH:
429 typestr = "MH";
430 break;
431 case MUTT_MAILDIR:
432 typestr = "MAILDIR";
433 break;
434 case MUTT_NNTP:
435 typestr = "NNTP";
436 break;
437 case MUTT_IMAP:
438 typestr = "IMAP";
439 break;
440 case MUTT_NOTMUCH:
441 typestr = "NOTMUCH";
442 break;
443 case MUTT_POP:
444 typestr = "POP";
445 break;
446 case MUTT_COMPRESSED:
447 typestr = "COMPRESSED";
448 break;
449 default:
450 typestr = "UNKNOWN";
451 }
452
453 fprintf(fp, "\t\t<tr>\n");
454 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", name);
455 fprintf(fp, "\t\t\t<td border=\"0\">=</td>\n");
456 fprintf(fp, "\t\t\t<td border=\"0\" align=\"left\">%s</td>\n", typestr);
457 fprintf(fp, "\t\t</tr>\n");
458}
459
460#ifndef GV_HIDE_MDATA
461void dot_mailbox_imap(FILE *fp, struct ImapMboxData *mdata, struct ListHead *links)
462{
463 dot_object_header(fp, mdata, "ImapMboxData", "#60c060");
464 dot_type_string(fp, "name", mdata->name, true);
465 dot_type_string(fp, "munge_name", mdata->munge_name, true);
466 dot_type_string(fp, "real_name", mdata->real_name, true);
468}
469
470void dot_mailbox_maildir(FILE *fp, struct MaildirMboxData *mdata, struct ListHead *links)
471{
472 char buf[64] = { 0 };
473
474 dot_object_header(fp, mdata, "MaildirMboxData", "#60c060");
475
476 dot_type_date(buf, sizeof(buf), mdata->mtime_cur.tv_sec);
477 dot_type_string(fp, "mtime_cur", buf, true);
478
479 dot_type_umask(buf, sizeof(buf), mdata->umask);
480 dot_type_string(fp, "umask", buf, true);
482}
483
484void dot_mailbox_mbox(FILE *fp, struct MboxAccountData *mdata, struct ListHead *links)
485{
486 char buf[64] = { 0 };
487
488 dot_object_header(fp, mdata, "MboxAccountData", "#60c060");
489 dot_ptr(fp, "fp", mdata->fp, NULL);
490
491 dot_type_date(buf, sizeof(buf), mdata->atime.tv_sec);
492 dot_type_string(fp, "atime", buf, true);
493
495}
496
497void dot_mailbox_nntp(FILE *fp, struct NntpMboxData *mdata, struct ListHead *links)
498{
499 dot_object_header(fp, mdata, "NntpMboxData", "#60c060");
500 dot_type_string(fp, "group", mdata->group, true);
501 dot_type_string(fp, "desc", mdata->desc, true);
502
503 dot_type_number(fp, "first_message", mdata->first_message);
504 dot_type_number(fp, "last_message", mdata->last_message);
505 dot_type_number(fp, "last_loaded", mdata->last_loaded);
506 dot_type_number(fp, "last_cached", mdata->last_cached);
507 dot_type_number(fp, "unread", mdata->unread);
508
509 dot_type_bool(fp, "subscribed", mdata->subscribed);
510 dot_type_bool(fp, "has_new_mail", mdata->has_new_mail);
511 dot_type_bool(fp, "allowed", mdata->allowed);
512 dot_type_bool(fp, "deleted", mdata->deleted);
513
515}
516
517void dot_mailbox_notmuch(FILE *fp, struct NmMboxData *mdata, struct ListHead *links)
518{
519 dot_object_header(fp, mdata, "NmMboxData", "#60c060");
520 dot_type_number(fp, "db_limit", mdata->db_limit);
522}
523
524void dot_mailbox_pop(FILE *fp, struct PopAccountData *adata, struct ListHead *links)
525{
526 dot_object_header(fp, adata, "PopAccountData", "#60c060");
527 dot_ptr(fp, "conn", adata->conn, "#ff8080");
529}
530#endif
531
532void dot_mailbox(FILE *fp, struct Mailbox *m, struct ListHead *links)
533{
534 char buf[64] = { 0 };
535
536 dot_object_header(fp, m, "Mailbox", "#80ff80");
537 dot_mailbox_type(fp, "type", m->type);
538 dot_type_string(fp, "name", m->name, false);
539
540 if ((m->type == MUTT_IMAP) || (m->type == MUTT_POP))
541 {
542 dot_path_imap(buf, sizeof(buf), buf_string(&m->pathbuf));
543 dot_type_string(fp, "pathbuf", buf, true);
544 dot_path_imap(buf, sizeof(buf), m->realpath);
545 dot_type_string(fp, "realpath", buf, true);
546 }
547 else
548 {
549 dot_path_fs(buf, sizeof(buf), buf_string(&m->pathbuf));
550 dot_type_string(fp, "pathbuf", buf, true);
551 dot_path_fs(buf, sizeof(buf), m->realpath);
552 dot_type_string(fp, "realpath", buf, true);
553 }
554
555#ifdef GV_HIDE_MDATA
556 dot_ptr(fp, "mdata", m->mdata, NULL);
557#endif
558 dot_ptr(fp, "account", m->account, "#80ffff");
559 dot_type_number(fp, "opened", m->opened);
560
561 dot_type_number(fp, "msg_count", m->msg_count);
562 // dot_type_number(fp, "msg_unread", m->msg_unread);
563 // dot_type_number(fp, "msg_flagged", m->msg_flagged);
564 // dot_type_number(fp, "msg_new", m->msg_new);
565 // dot_type_number(fp, "msg_deleted", m->msg_deleted);
566 // dot_type_number(fp, "msg_tagged", m->msg_tagged);
567
568 dot_ptr(fp, "emails", m->emails, NULL);
569 dot_type_number(fp, "email_max", m->email_max);
570 dot_ptr(fp, "v2r", m->v2r, NULL);
571 dot_type_number(fp, "vcount", m->vcount);
572
574
575 // dot_add_link(links, m, m->mdata, false, NULL);
576
577#ifndef GV_HIDE_MDATA
578 if (m->mdata)
579 {
580 if (m->type == MUTT_MAILDIR)
581 dot_mailbox_maildir(fp, m->mdata, links);
582 else if (m->type == MUTT_IMAP)
583 dot_mailbox_imap(fp, m->mdata, links);
584 else if (m->type == MUTT_POP)
585 dot_mailbox_pop(fp, m->mdata, links);
586 else if (m->type == MUTT_MBOX)
587 dot_mailbox_mbox(fp, m->mdata, links);
588 else if (m->type == MUTT_NNTP)
589 dot_mailbox_nntp(fp, m->mdata, links);
590 else if (m->type == MUTT_NOTMUCH)
591 dot_mailbox_notmuch(fp, m->mdata, links);
592
593 dot_add_link(links, m, m->mdata, "Mailbox->mdata", false, NULL);
594 }
595#endif
596
597 if (m->compress_info)
598 {
599 dot_comp(fp, m->compress_info, links);
600 dot_add_link(links, m, m->compress_info, "Mailbox->compress_info", false, NULL);
601 }
602
603#ifndef GV_HIDE_CONFIG
604 if (m->name)
605 {
606 dot_config(fp, m->name, DT_INHERIT_MBOX, m->sub, links);
607 dot_add_link(links, m, m->name, "Mailbox Config", false, NULL);
608 }
609#endif
610}
611
612void dot_mailbox_node(FILE *fp, struct MailboxNode *mn, struct ListHead *links)
613{
614 dot_node(fp, mn, "MN", "#80ff80");
615
616 dot_mailbox(fp, mn->mailbox, links);
617
618 dot_add_link(links, mn, mn->mailbox, "MailboxNode->mailbox", false, NULL);
619
620 struct Buffer *buf = buf_pool_get();
621
622 char name[256] = { 0 };
623 buf_addstr(buf, "{ rank=same ");
624
625 dot_ptr_name(name, sizeof(name), mn);
626 buf_add_printf(buf, "%s ", name);
627
628 dot_ptr_name(name, sizeof(name), mn->mailbox);
629 buf_add_printf(buf, "%s ", name);
630
631#ifndef GV_HIDE_MDATA
632 if (mn->mailbox->mdata)
633 {
634 dot_ptr_name(name, sizeof(name), mn->mailbox->mdata);
635 buf_add_printf(buf, "%s ", name);
636 }
637#endif
638
639#ifndef GV_HIDE_CONFIG
640 if (mn->mailbox->name)
641 {
642 dot_ptr_name(name, sizeof(name), mn->mailbox->name);
643 buf_add_printf(buf, "%s ", name);
644 }
645#endif
646
647 buf_addstr(buf, "}");
648
650 buf_pool_release(&buf);
651}
652
653void dot_mailbox_list(FILE *fp, struct MailboxList *ml, struct ListHead *links, bool abbr)
654{
655 struct MailboxNode *prev = NULL;
656 struct MailboxNode *np = NULL;
657 STAILQ_FOREACH(np, ml, entries)
658 {
659 if (abbr)
660 dot_node_link(fp, np, "MN", np->mailbox, "#80ff80");
661 else
662 dot_mailbox_node(fp, np, links);
663 if (prev)
664 dot_add_link(links, prev, np, "MailboxNode->next", false, NULL);
665 prev = np;
666 }
667}
668
669#ifndef GV_HIDE_ADATA
670void dot_connection(FILE *fp, struct Connection *c, struct ListHead *links)
671{
672 dot_object_header(fp, c, "Connection", "#ff8080");
673 // dot_ptr(fp, "sockdata", c->sockdata, "#60c0c0");
674 dot_type_number(fp, "fd", c->fd);
676
677 dot_object_header(fp, c->inbuf, "ConnAccount", "#ff8080");
678 dot_type_string(fp, "user", c->account.user, true);
679 dot_type_string(fp, "host", c->account.host, true);
680 dot_type_number(fp, "port", c->account.port);
682
683 dot_add_link(links, c, c->inbuf, "Connection.ConnAccount", false, NULL);
684}
685
686void dot_account_imap(FILE *fp, struct ImapAccountData *adata, struct ListHead *links)
687{
688 dot_object_header(fp, adata, "ImapAccountData", "#60c0c0");
689 // dot_type_string(fp, "mbox_name", adata->mbox_name, true);
690 // dot_type_string(fp, "login", adata->conn->account.login, true);
691 dot_type_string(fp, "user", adata->conn->account.user, true);
692 dot_type_string(fp, "pass", adata->conn->account.pass[0] ? "***" : "", true);
693 dot_type_number(fp, "port", adata->conn->account.port);
694 // dot_ptr(fp, "conn", adata->conn, "#ff8080");
695 dot_type_bool(fp, "unicode", adata->unicode);
696 dot_type_bool(fp, "qresync", adata->qresync);
697 dot_type_char(fp, "seqid", adata->seqid);
698 dot_ptr(fp, "mailbox", adata->mailbox, "#80ff80");
700
701 if (adata->conn)
702 {
703 dot_connection(fp, adata->conn, links);
704 dot_add_link(links, adata, adata->conn, "ImapAccountData->conn", false, NULL);
705 }
706}
707
708void dot_account_mbox(FILE *fp, struct MboxAccountData *adata, struct ListHead *links)
709{
710 char buf[64] = { 0 };
711
712 dot_object_header(fp, adata, "MboxAccountData", "#60c0c0");
713 dot_ptr(fp, "fp", adata->fp, NULL);
714
715 dot_type_date(buf, sizeof(buf), adata->atime.tv_sec);
716 dot_type_string(fp, "atime", buf, true);
717 dot_type_bool(fp, "locked", adata->locked);
718 dot_type_bool(fp, "append", adata->append);
719
721}
722
723void dot_account_nntp(FILE *fp, struct NntpAccountData *adata, struct ListHead *links)
724{
725 dot_object_header(fp, adata, "NntpAccountData", "#60c0c0");
726 dot_type_number(fp, "groups_num", adata->groups_num);
727
728 dot_type_bool(fp, "hasCAPABILITIES", adata->hasCAPABILITIES);
729 dot_type_bool(fp, "hasSTARTTLS", adata->hasSTARTTLS);
730 dot_type_bool(fp, "hasDATE", adata->hasDATE);
731 dot_type_bool(fp, "hasLIST_NEWSGROUPS", adata->hasLIST_NEWSGROUPS);
732 dot_type_bool(fp, "hasXGTITLE", adata->hasXGTITLE);
733 dot_type_bool(fp, "hasLISTGROUP", adata->hasLISTGROUP);
734 dot_type_bool(fp, "hasLISTGROUPrange", adata->hasLISTGROUPrange);
735 dot_type_bool(fp, "hasOVER", adata->hasOVER);
736 dot_type_bool(fp, "hasXOVER", adata->hasXOVER);
737 dot_type_bool(fp, "cacheable", adata->cacheable);
738 dot_type_bool(fp, "newsrc_modified", adata->newsrc_modified);
739
740 dot_type_string(fp, "authenticators", adata->authenticators, true);
741 dot_type_string(fp, "overview_fmt", adata->overview_fmt, true);
742 dot_type_string(fp, "newsrc_file", adata->newsrc_file, true);
743 dot_type_file(fp, "newsrc_fp", adata->fp_newsrc);
744
745 dot_type_number(fp, "groups_num", adata->groups_num);
746 dot_type_number(fp, "groups_max", adata->groups_max);
747
748 char buf[128];
749 dot_type_date(buf, sizeof(buf), adata->mtime);
750 dot_type_string(fp, "mtime", buf, true);
751 dot_type_date(buf, sizeof(buf), adata->newgroups_time);
752 dot_type_string(fp, "newgroups_time", buf, true);
753 dot_type_date(buf, sizeof(buf), adata->check_time);
754 dot_type_string(fp, "check_time", buf, true);
755
757
758 if (adata->conn)
759 {
760 dot_connection(fp, adata->conn, links);
761 dot_add_link(links, adata, adata->conn, "NntpAccountData->conn", false, NULL);
762 }
763}
764
765void dot_account_notmuch(FILE *fp, struct NmAccountData *adata, struct ListHead *links)
766{
767 dot_object_header(fp, adata, "NmAccountData", "#60c0c0");
768 dot_ptr(fp, "db", adata->db, NULL);
770}
771
772void dot_account_pop(FILE *fp, struct PopAccountData *adata, struct ListHead *links)
773{
774 char buf[64] = { 0 };
775
776 dot_object_header(fp, adata, "PopAccountData", "#60c0c0");
777
778 dot_type_date(buf, sizeof(buf), adata->check_time);
779 dot_type_string(fp, "check_time", buf, true);
780
781 dot_type_string(fp, "login", adata->conn->account.login, true);
782 dot_type_string(fp, "user", adata->conn->account.user, true);
783 dot_type_string(fp, "pass", adata->conn->account.pass[0] ? "***" : "", true);
784 dot_type_number(fp, "port", adata->conn->account.port);
785 // dot_ptr(fp, "conn", adata->conn, "#ff8080");
787
788 dot_connection(fp, adata->conn, links);
789 dot_add_link(links, adata, adata->conn, "PopAccountData->conn", false, NULL);
790}
791#endif
792
793void dot_account(FILE *fp, struct Account *a, struct ListHead *links)
794{
795 dot_object_header(fp, a, "Account", "#80ffff");
796 dot_mailbox_type(fp, "type", a->type);
797 dot_type_string(fp, "name", a->name, true);
798 // dot_ptr(fp, "adata", a->adata, "#60c0c0");
800
801#ifndef GV_HIDE_ADATA
802 if (a->adata)
803 {
804 if (a->type == MUTT_IMAP)
805 dot_account_imap(fp, a->adata, links);
806 else if (a->type == MUTT_POP)
807 dot_account_pop(fp, a->adata, links);
808 else if (a->type == MUTT_MBOX)
809 dot_account_mbox(fp, a->adata, links);
810 else if (a->type == MUTT_NNTP)
811 dot_account_nntp(fp, a->adata, links);
812 else if (a->type == MUTT_NOTMUCH)
813 dot_account_notmuch(fp, a->adata, links);
814
815 dot_add_link(links, a, a->adata, "Account->adata", false, NULL);
816 }
817#endif
818
819#ifndef GV_HIDE_CONFIG
820 if (a->name)
821 {
822 dot_config(fp, a->name, DT_INHERIT_ACC, a->sub, links);
823 dot_add_link(links, a, a->name, "Config", false, NULL);
824
825 char name[256] = { 0 };
826 struct Buffer *buf = buf_pool_get();
827
828 buf_addstr(buf, "{ rank=same ");
829
830 dot_ptr_name(name, sizeof(name), a);
831 buf_add_printf(buf, "%s ", name);
832
833 dot_ptr_name(name, sizeof(name), a->name);
834 buf_add_printf(buf, "%s ", name);
835
836 buf_addstr(buf, "}");
838 buf_pool_release(&buf);
839 }
840#endif
841
842 struct MailboxNode *first = STAILQ_FIRST(&a->mailboxes);
843 dot_add_link(links, a, first, "Account->mailboxes", false, NULL);
844 dot_mailbox_list(fp, &a->mailboxes, links, false);
845}
846
847void dot_account_list(FILE *fp, struct AccountList *al, struct ListHead *links)
848{
849 struct Account *prev = NULL;
850 struct Account *np = NULL;
851 TAILQ_FOREACH(np, al, entries)
852 {
853#ifdef GV_HIDE_MBOX
854 if (np->type == MUTT_MBOX)
855 continue;
856#endif
857 dot_account(fp, np, links);
858 if (prev)
859 dot_add_link(links, prev, np, "Account->next", false, NULL);
860
861 prev = np;
862 }
863}
864
865#ifndef GV_HIDE_MVIEW
866void dot_mview(FILE *fp, struct MailboxView *mv, struct ListHead *links)
867{
868 dot_object_header(fp, mv, "MailboxView", "#ff80ff");
869 dot_ptr(fp, "mailbox", mv->mailbox, "#80ff80");
870#ifdef GV_HIDE_MVIEW_CONTENTS
871 dot_type_number(fp, "vsize", mv->vsize);
872 dot_type_string(fp, "pattern", mv->pattern, true);
873 dot_type_bool(fp, "collapsed", mv->collapsed);
874#endif
876}
877#endif
878
879void dump_graphviz(const char *title, struct MailboxView *mv)
880{
881 char name[256] = { 0 };
882 struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
883
884 time_t now = time(NULL);
885 if (title)
886 {
887 char date[128];
888 mutt_date_localtime_format(date, sizeof(date), "%T", now);
889 snprintf(name, sizeof(name), "%s-%s.gv", date, title);
890 }
891 else
892 {
893 mutt_date_localtime_format(name, sizeof(name), "%T.gv", now);
894 }
895
896 umask(022);
897 FILE *fp = fopen(name, "w");
898 if (!fp)
899 return;
900
902
903#ifndef GV_HIDE_NEOMUTT
904 dot_node(fp, NeoMutt, "NeoMutt", "#ffa500");
906 "NeoMutt->accounts", false, NULL);
907#ifndef GV_HIDE_CONFIG
908 dot_config(fp, (const char *) NeoMutt->sub, 0, NeoMutt->sub, &links);
909 dot_add_link(&links, NeoMutt, NeoMutt->sub, "NeoMutt Config", false, NULL);
910 struct Buffer *buf = buf_pool_get();
911 char obj1[64] = { 0 };
912 char obj2[64] = { 0 };
913 dot_ptr_name(obj1, sizeof(obj1), NeoMutt);
914 dot_ptr_name(obj2, sizeof(obj2), NeoMutt->sub);
915 buf_printf(buf, "{ rank=same %s %s }", obj1, obj2);
916 mutt_list_insert_tail(&links, buf_strdup(buf));
917 buf_pool_release(&buf);
918#endif
919#endif
920
921 dot_account_list(fp, &NeoMutt->accounts, &links);
922
923#ifndef GV_HIDE_MVIEW
924 if (mv)
925 dot_mview(fp, mv, &links);
926
927#ifndef GV_HIDE_NEOMUTT
928 /* Globals */
929 fprintf(fp, "\t{ rank=same ");
930 if (mv)
931 {
932 dot_ptr_name(name, sizeof(name), mv);
933 fprintf(fp, "%s ", name);
934 }
935 dot_ptr_name(name, sizeof(name), NeoMutt);
936 fprintf(fp, "%s ", name);
937 fprintf(fp, "}\n");
938#endif
939#endif
940
941 fprintf(fp, "\t{ rank=same ");
942 struct Account *np = NULL;
943 TAILQ_FOREACH(np, &NeoMutt->accounts, entries)
944 {
945#ifdef GV_HIDE_MBOX
946 if (np->type == MUTT_MBOX)
947 continue;
948#endif
949 dot_ptr_name(name, sizeof(name), np);
950 fprintf(fp, "%s ", name);
951 }
952 fprintf(fp, "}\n");
953
954 dot_graph_footer(fp, &links);
955 fclose(fp);
956 mutt_list_free(&links);
957}
958
959#ifndef GV_HIDE_BODY_CONTENT
960void dot_parameter_list(FILE *fp, const char *name, const struct ParameterList *pl)
961{
962 if (!pl)
963 return;
964 if (TAILQ_EMPTY(pl))
965 return;
966
967 dot_object_header(fp, pl, "ParameterList", "#00ff00");
968
969 struct Parameter *np = NULL;
970 TAILQ_FOREACH(np, pl, entries)
971 {
972 dot_type_string(fp, np->attribute, np->value, false);
973 }
974
976}
977
978void dot_content(FILE *fp, struct Content *cont, struct ListHead *links)
979{
980 struct Buffer *buf = buf_pool_get();
981
982 dot_object_header(fp, cont, "Content", "#800080");
983
984 dot_type_number(fp, "hibin", cont->hibin);
985 dot_type_number(fp, "lobin", cont->lobin);
986 dot_type_number(fp, "nulbin", cont->nulbin);
987 dot_type_number(fp, "crlf", cont->crlf);
988 dot_type_number(fp, "ascii", cont->ascii);
989 dot_type_number(fp, "linemax", cont->linemax);
990
991#define ADD_BOOL(F) add_flag(buf, cont->F, #F)
992 ADD_BOOL(space);
993 ADD_BOOL(binary);
994 ADD_BOOL(from);
995 ADD_BOOL(dot);
996 ADD_BOOL(cr);
997#undef ADD_BOOL
998
1000
1001 buf_pool_release(&buf);
1002}
1003#endif
1004
1005void dot_attach_ptr(FILE *fp, struct AttachPtr *aptr, struct ListHead *links)
1006{
1007 if (!aptr)
1008 return;
1009
1010 dot_object_header(fp, aptr, "AttachPtr", "#ff0000");
1011
1012 dot_type_file(fp, "fp", aptr->fp);
1013
1014 dot_type_string(fp, "parent_type", name_content_type(aptr->parent_type), false);
1015
1016 dot_type_number(fp, "level", aptr->level);
1017 dot_type_number(fp, "num", aptr->num);
1018
1019 dot_type_bool(fp, "unowned", aptr->unowned);
1020 dot_type_bool(fp, "collapsed", aptr->collapsed);
1021 dot_type_bool(fp, "decrypted", aptr->decrypted);
1022
1024
1025 dot_add_link(links, aptr->body, aptr, "AttachPtr->body", true, NULL);
1026}
1027
1028void dot_body(FILE *fp, struct Body *b, struct ListHead *links, bool link_next)
1029{
1030 struct Buffer *buf = buf_pool_get();
1031
1032 dot_object_header(fp, b, "Body", "#2020ff");
1033
1034 char file[256];
1035 dot_path_fs(file, sizeof(file), b->filename);
1036 dot_type_string(fp, "file", file, false);
1037
1038 dot_type_string(fp, "charset", b->charset, false);
1039 dot_type_string(fp, "description", b->description, false);
1040 dot_type_string(fp, "d_filename", b->d_filename, false);
1041 dot_type_string(fp, "form_name", b->form_name, false);
1042 dot_type_string(fp, "language", b->language, false);
1043 dot_type_string(fp, "subtype", b->subtype, false);
1044 dot_type_string(fp, "xtype", b->xtype, false);
1045
1046 dot_type_string(fp, "type", name_content_type(b->type), true);
1047 dot_type_string(fp, "encoding", name_content_encoding(b->encoding), true);
1048 dot_type_string(fp, "disposition", name_content_disposition(b->disposition), true);
1049
1050 if (b->stamp != 0)
1051 {
1052 char arr[64];
1053 dot_type_date(arr, sizeof(arr), b->stamp);
1054 dot_type_string(fp, "stamp", arr, true);
1055 }
1056
1057#define ADD_BOOL(F) add_flag(buf, b->F, #F)
1058 ADD_BOOL(attach_qualifies);
1059 ADD_BOOL(badsig);
1060 ADD_BOOL(deleted);
1061 ADD_BOOL(force_charset);
1062 ADD_BOOL(goodsig);
1063#ifdef USE_AUTOCRYPT
1064 ADD_BOOL(is_autocrypt);
1065#endif
1066 ADD_BOOL(noconv);
1067 ADD_BOOL(tagged);
1068 ADD_BOOL(unlink);
1069 ADD_BOOL(use_disp);
1070 ADD_BOOL(warnsig);
1071#undef ADD_BOOL
1072 dot_type_string(fp, "bools", buf_is_empty(buf) ? "[NONE]" : buf_string(buf), true);
1073
1074 dot_type_number(fp, "attach_count", b->attach_count);
1075 dot_type_number(fp, "hdr_offset", b->hdr_offset);
1076 dot_type_number(fp, "length", b->length);
1077 dot_type_number(fp, "offset", b->offset);
1078
1079 dot_ptr(fp, "aptr", b->aptr, "#3bcbc4");
1080
1081#ifdef GV_HIDE_BODY_CONTENT
1082 if (!TAILQ_EMPTY(&b->parameter))
1083 {
1084 struct Parameter *param = TAILQ_FIRST(&b->parameter);
1085 if (mutt_str_equal(param->attribute, "boundary"))
1086 {
1087 dot_type_string(fp, "boundary", param->value, false);
1088 }
1089 }
1090#endif
1091
1093
1094#ifndef GV_HIDE_BODY_CONTENT
1095 if (!TAILQ_EMPTY(&b->parameter))
1096 {
1097 dot_parameter_list(fp, "parameter", &b->parameter);
1098 dot_add_link(links, b, &b->parameter, "Body->mime_headers", false, NULL);
1099 }
1100#endif
1101
1102#ifndef GV_HIDE_ENVELOPE
1103 if (b->mime_headers)
1104 {
1105 dot_envelope(fp, b->mime_headers, links);
1106 dot_add_link(links, b, b->mime_headers, "Body->mime_headers", false, NULL);
1107 }
1108#endif
1109
1110 if (b->email)
1111 {
1112 dot_email(fp, b->email, links);
1113 dot_add_link(links, b, b->email, "Body->email", false, NULL);
1114 }
1115
1116 if (b->parts)
1117 {
1118 if (!b->email)
1119 dot_body(fp, b->parts, links, true);
1120 dot_add_link(links, b, b->parts, "Body->parts", false, "#ff0000");
1121 }
1122
1123 if (b->next && link_next)
1124 {
1125 char name[256] = { 0 };
1126 buf_reset(buf);
1127
1128 buf_addstr(buf, "{ rank=same ");
1129
1130 dot_ptr_name(name, sizeof(name), b);
1131 buf_add_printf(buf, "%s ", name);
1132
1133 for (; b->next; b = b->next)
1134 {
1135 dot_body(fp, b->next, links, false);
1136 dot_add_link(links, b, b->next, "Body->next", false, "#008000");
1137
1138 dot_ptr_name(name, sizeof(name), b->next);
1139 buf_add_printf(buf, "%s ", name);
1140 }
1141
1142 buf_addstr(buf, "}");
1143 mutt_list_insert_tail(links, buf_strdup(buf));
1144 }
1145 else
1146 {
1147#ifndef GV_HIDE_BODY_CONTENT
1148 if (b->content)
1149 {
1150 dot_content(fp, b->content, links);
1151 dot_add_link(links, b, b->content, "Body->content", false, NULL);
1152 }
1153#endif
1154
1155 // if (b->aptr)
1156 // {
1157 // dot_attach_ptr(fp, b->aptr, links);
1158 // dot_add_link(links, b, b->aptr, "Body->aptr", false, NULL);
1159 // }
1160 }
1161
1162 buf_pool_release(&buf);
1163}
1164
1165#ifndef GV_HIDE_ENVELOPE
1166void dot_list_head(FILE *fp, const char *name, const struct ListHead *list)
1167{
1168 if (!list || !name)
1169 return;
1170 if (STAILQ_EMPTY(list))
1171 return;
1172
1173 struct Buffer *buf = buf_pool_get();
1174
1175 struct ListNode *np = NULL;
1176 STAILQ_FOREACH(np, list, entries)
1177 {
1178 if (!buf_is_empty(buf))
1179 buf_addch(buf, ',');
1180 buf_addstr(buf, np->data);
1181 }
1182
1183 dot_type_string(fp, name, buf_string(buf), false);
1184 buf_pool_release(&buf);
1185}
1186
1187void dot_addr_list(FILE *fp, const char *name, const struct AddressList *al,
1188 struct ListHead *links)
1189{
1190 if (!al)
1191 return;
1192 if (TAILQ_EMPTY(al))
1193 return;
1194
1195 struct Buffer *buf = buf_pool_get();
1196 mutt_addrlist_write(al, buf, true);
1197 dot_type_string(fp, name, buf_string(buf), false);
1198 buf_pool_release(&buf);
1199}
1200
1201void dot_envelope(FILE *fp, struct Envelope *env, struct ListHead *links)
1202{
1203 struct Buffer *buf = buf_pool_get();
1204
1205 dot_object_header(fp, env, "Envelope", "#ffff00");
1206
1207#define ADD_FLAG(F) add_flag(buf, (env->changed & F), #F)
1212#undef ADD_BOOL
1213 dot_type_string(fp, "changed", buf_is_empty(buf) ? "[NONE]" : buf_string(buf), true);
1214
1215#define ADDR_LIST(AL) dot_addr_list(fp, #AL, &env->AL, links)
1216 ADDR_LIST(return_path);
1217 ADDR_LIST(from);
1218 ADDR_LIST(to);
1219 ADDR_LIST(cc);
1220 ADDR_LIST(bcc);
1221 ADDR_LIST(sender);
1222 ADDR_LIST(reply_to);
1223 ADDR_LIST(mail_followup_to);
1224 ADDR_LIST(x_original_to);
1225#undef ADDR_LIST
1226
1227 dot_type_string(fp, "date", env->date, false);
1228 dot_type_string(fp, "disp_subj", env->disp_subj, false);
1229 dot_type_string(fp, "followup_to", env->followup_to, false);
1230 dot_type_string(fp, "list_post", env->list_post, false);
1231 dot_type_string(fp, "list_subscribe", env->list_subscribe, false);
1232 dot_type_string(fp, "list_unsubscribe", env->list_unsubscribe, false);
1233 dot_type_string(fp, "message_id", env->message_id, false);
1234 dot_type_string(fp, "newsgroups", env->newsgroups, false);
1235 dot_type_string(fp, "organization", env->organization, false);
1236 dot_type_string(fp, "real_subj", env->real_subj, false);
1237 dot_type_string(fp, "spam", buf_string(&env->spam), false);
1238 dot_type_string(fp, "subject", env->subject, false);
1239 dot_type_string(fp, "supersedes", env->supersedes, false);
1240 dot_type_string(fp, "xref", env->xref, false);
1241 dot_type_string(fp, "x_comment_to", env->x_comment_to, false);
1242 dot_type_string(fp, "x_label", env->x_label, false);
1243
1244 if (0)
1245 {
1246 dot_list_head(fp, "references", &env->references);
1247 dot_list_head(fp, "in_reply_to", &env->in_reply_to);
1248 dot_list_head(fp, "userhdrs", &env->userhdrs);
1249 }
1250
1251#ifdef USE_AUTOCRYPT
1252 dot_ptr(fp, "autocrypt", env->autocrypt, NULL);
1253 dot_ptr(fp, "autocrypt_gossip", env->autocrypt_gossip, NULL);
1254#endif
1255
1257
1258 buf_pool_release(&buf);
1259}
1260#endif
1261
1262void dot_email(FILE *fp, struct Email *e, struct ListHead *links)
1263{
1264 struct Buffer *buf = buf_pool_get();
1265 char arr[256];
1266
1267 dot_object_header(fp, e, "Email", "#ff80ff");
1268
1269 dot_type_string(fp, "path", e->path, true);
1270
1271#define ADD_BOOL(F) add_flag(buf, e->F, #F)
1272 ADD_BOOL(active);
1273 ADD_BOOL(attach_del);
1274 ADD_BOOL(attach_valid);
1275 ADD_BOOL(changed);
1276 ADD_BOOL(collapsed);
1277 ADD_BOOL(deleted);
1278 ADD_BOOL(display_subject);
1279 ADD_BOOL(expired);
1280 ADD_BOOL(flagged);
1281 ADD_BOOL(matched);
1282 ADD_BOOL(mime);
1283 ADD_BOOL(old);
1284 ADD_BOOL(purge);
1285 ADD_BOOL(quasi_deleted);
1286 ADD_BOOL(read);
1287 ADD_BOOL(recip_valid);
1288 ADD_BOOL(replied);
1289 ADD_BOOL(searched);
1290 ADD_BOOL(subject_changed);
1291 ADD_BOOL(superseded);
1292 ADD_BOOL(tagged);
1293 ADD_BOOL(threaded);
1294 ADD_BOOL(trash);
1295 ADD_BOOL(visible);
1296#undef ADD_BOOL
1297 dot_type_string(fp, "bools", buf_is_empty(buf) ? "[NONE]" : buf_string(buf), true);
1298
1299 buf_reset(buf);
1300#define ADD_BOOL(F) add_flag(buf, (e->security & F), #F)
1315#undef ADD_BOOL
1316 dot_type_string(fp, "security", buf_is_empty(buf) ? "[NONE]" : buf_string(buf), true);
1317
1318 dot_type_number(fp, "num_hidden", e->num_hidden);
1319 dot_type_number(fp, "offset", e->offset);
1320 dot_type_number(fp, "lines", e->lines);
1321 dot_type_number(fp, "index", e->index);
1322 dot_type_number(fp, "msgno", e->msgno);
1323 dot_type_number(fp, "vnum", e->vnum);
1324 dot_type_number(fp, "score", e->score);
1325 dot_type_number(fp, "attach_total", e->attach_total);
1326
1327 // struct MaildirEmailData *edata = maildir_edata_get(e);
1328 // if (edata)
1329 // dot_type_string(fp, "maildir_flags", edata->maildir_flags, false);
1330
1331 if (e->date_sent != 0)
1332 {
1333 char zone[32];
1334 dot_type_date(arr, sizeof(arr), e->date_sent);
1335 snprintf(zone, sizeof(zone), " (%c%02u%02u)", e->zoccident ? '-' : '+',
1336 e->zhours, e->zminutes);
1337 mutt_str_cat(arr, sizeof(arr), zone);
1338 dot_type_string(fp, "date_sent", arr, false);
1339 }
1340
1341 if (e->received != 0)
1342 {
1343 dot_type_date(arr, sizeof(arr), e->received);
1344 dot_type_string(fp, "received", arr, false);
1345 }
1346
1348
1349 if (e->body)
1350 {
1351 dot_body(fp, e->body, links, true);
1352 dot_add_link(links, e, e->body, "Email->body", false, NULL);
1353 }
1354
1355#ifndef GV_HIDE_ENVELOPE
1356 if (e->env)
1357 {
1358 dot_envelope(fp, e->env, links);
1359 dot_add_link(links, e, e->env, "Email->env", false, NULL);
1360
1361 buf_reset(buf);
1362 buf_addstr(buf, "{ rank=same ");
1363
1364 dot_ptr_name(arr, sizeof(arr), e);
1365 buf_add_printf(buf, "%s ", arr);
1366
1367 dot_ptr_name(arr, sizeof(arr), e->env);
1368 buf_add_printf(buf, "%s ", arr);
1369
1370 buf_addstr(buf, "}");
1371
1372 mutt_list_insert_tail(links, buf_strdup(buf));
1373 }
1374#endif
1375
1376 // struct TagList tags;
1377
1378 buf_pool_release(&buf);
1379}
1380
1382{
1383 char name[256] = { 0 };
1384 struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
1385
1386 time_t now = time(NULL);
1387 mutt_date_localtime_format(name, sizeof(name), "%T-email.gv", now);
1388
1389 umask(022);
1390 FILE *fp = fopen(name, "w");
1391 if (!fp)
1392 return;
1393
1394 dot_graph_header(fp);
1395
1396 dot_body(fp, b, &links, true);
1397
1398 dot_graph_footer(fp, &links);
1399 fclose(fp);
1400 mutt_list_free(&links);
1401}
1402
1403void dump_graphviz_email(struct Email *e, const char *title)
1404{
1405 char name[256] = { 0 };
1406 struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
1407
1408 if (!title)
1409 title = "email";
1410
1411 char format[64];
1412 snprintf(format, sizeof(format), "%%T-%s.gv", title);
1413
1414 time_t now = time(NULL);
1415 mutt_date_localtime_format(name, sizeof(name), format, now);
1416
1417 umask(022);
1418 FILE *fp = fopen(name, "w");
1419 if (!fp)
1420 return;
1421
1422 dot_graph_header(fp);
1423
1424 dot_email(fp, e, &links);
1425
1426 dot_graph_footer(fp, &links);
1427 fclose(fp);
1428 mutt_list_free(&links);
1429}
1430
1431void dot_attach_ptr2(FILE *fp, struct AttachPtr *aptr, struct ListHead *links)
1432{
1433 if (!aptr)
1434 return;
1435
1436 dot_object_header(fp, aptr, "AttachPtr", "#3bcbc4");
1437
1438 dot_ptr(fp, "body", aptr->body, "#2020ff");
1439 dot_type_file(fp, "fp", aptr->fp);
1440
1441 dot_type_string(fp, "parent_type", name_content_type(aptr->parent_type), false);
1442 dot_type_number(fp, "level", aptr->level);
1443 dot_type_number(fp, "num", aptr->num);
1444 dot_type_bool(fp, "unowned", aptr->unowned);
1445 dot_type_bool(fp, "collapsed", aptr->collapsed);
1446 dot_type_bool(fp, "decrypted", aptr->decrypted);
1447
1448 // dot_type_string(fp, "tree", aptr->tree, false);
1449
1451}
1452
1453void dot_array_actx_idx(FILE *fp, struct AttachPtr **idx, short idxlen,
1454 short idxmax, struct ListHead *links)
1455{
1456 dot_object_header(fp, idx, "AttachCtx-&gt;idx", "#9347de");
1457
1458 dot_type_number(fp, "idxlen", idxlen);
1459 dot_type_number(fp, "idxmax", idxmax);
1460
1461 char arr[32];
1462 for (size_t i = 0; i < idxmax; i++)
1463 {
1464 snprintf(arr, sizeof(arr), "idx[%zu]", i);
1465 dot_ptr(fp, arr, idx[i], "#3bcbc4");
1466 }
1467
1469
1470 for (size_t i = 0; i < idxlen; i++)
1471 {
1472 dot_attach_ptr2(fp, idx[i], links);
1473 dot_add_link(links, idx, idx[i], "AttachCtx-&gt;idx", false, NULL);
1474 }
1475}
1476
1477void dot_array_actx_v2r(FILE *fp, short *v2r, short vcount, struct ListHead *links)
1478{
1479 dot_object_header(fp, v2r, "AttachCtx-&gt;v2r", "#9347de");
1480
1481 dot_type_number(fp, "vcount", vcount);
1482
1483 char arr[32];
1484 for (size_t i = 0; i < vcount; i++)
1485 {
1486 snprintf(arr, sizeof(arr), "v2r[%zu]", i);
1487 dot_type_number(fp, arr, v2r[i]);
1488 }
1489
1491}
1492
1493void dot_array_actx_fp_idx(FILE *fp, FILE **fp_idx, short fp_len, short fp_max,
1494 struct ListHead *links)
1495{
1496 dot_object_header(fp, fp_idx, "AttachCtx-&gt;fp_idx", "#f86e28");
1497
1498 dot_type_number(fp, "fp_len", fp_len);
1499 dot_type_number(fp, "fp_max", fp_max);
1500
1501 char arr[32];
1502 for (size_t i = 0; i < fp_max; i++)
1503 {
1504 snprintf(arr, sizeof(arr), "fp_idx[%zu]", i);
1505 dot_type_file(fp, arr, fp_idx[i]);
1506 }
1507
1509}
1510
1511void dot_array_actx_body_idx(FILE *fp, struct Body **body_idx, short body_len,
1512 short body_max, struct ListHead *links)
1513{
1514 dot_object_header(fp, body_idx, "AttachCtx-&gt;body_idx", "#4ff270");
1515
1516 dot_type_number(fp, "body_len", body_len);
1517 dot_type_number(fp, "body_max", body_max);
1518
1519 char arr[32];
1520 for (size_t i = 0; i < body_max; i++)
1521 {
1522 snprintf(arr, sizeof(arr), "body_idx[%zu]", i);
1523 dot_ptr(fp, arr, body_idx[i], "#2020ff");
1524 }
1525
1527
1528 for (size_t i = 0; i < body_max; i++)
1529 {
1530 if (!body_idx[i])
1531 continue;
1532 dot_body(fp, body_idx[i], links, true);
1533 dot_add_link(links, body_idx, body_idx[i], "AttachCtx->Body", false, "#008000");
1534 }
1535}
1536
1537void dot_attach_ctx(FILE *fp, struct AttachCtx *actx, struct ListHead *links)
1538{
1539 dot_object_header(fp, actx, "AttachCtx", "#9347de");
1540
1541 dot_ptr(fp, "email", actx->email, "#ff80ff");
1542 dot_type_file(fp, "fp_root", actx->fp_root);
1543
1545
1546 if (actx->idx)
1547 {
1548 dot_array_actx_idx(fp, actx->idx, actx->idxlen, actx->idxmax, links);
1549 dot_add_link(links, actx, actx->idx, "AttachCtx-&gt;idx", false, NULL);
1550 }
1551
1552 if (actx->v2r)
1553 {
1554 dot_array_actx_v2r(fp, actx->v2r, actx->vcount, links);
1555 dot_add_link(links, actx, actx->v2r, "AttachCtx-&gt;v2r", false, NULL);
1556 }
1557
1558 if (actx->fp_idx)
1559 {
1560 dot_array_actx_fp_idx(fp, actx->fp_idx, actx->fp_len, actx->fp_max, links);
1561 dot_add_link(links, actx, actx->fp_idx, "AttachCtx-&gt;fp_idx", false, NULL);
1562 }
1563
1564 if (actx->body_idx)
1565 {
1566 dot_array_actx_body_idx(fp, actx->body_idx, actx->body_len, actx->body_max, links);
1567 dot_add_link(links, actx, actx->body_idx, "AttachCtx-&gt;body_idx", false, NULL);
1568 }
1569}
1570
1572{
1573 char name[256] = { 0 };
1574 struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
1575
1576 time_t now = time(NULL);
1577 mutt_date_localtime_format(name, sizeof(name), "%T-actx.gv", now);
1578
1579 umask(022);
1580 FILE *fp = fopen(name, "w");
1581 if (!fp)
1582 return;
1583
1584 dot_graph_header(fp);
1585
1586 dot_attach_ctx(fp, actx, &links);
1587
1588 dot_graph_footer(fp, &links);
1589 fclose(fp);
1590 mutt_list_free(&links);
1591}
1592
1593const char *pattern_type_name(int type)
1594{
1595 static struct Mapping PatternNames[] = {
1596 // clang-format off
1597 { "address", MUTT_PAT_ADDRESS },
1598 { "AND", MUTT_PAT_AND },
1599 { "bcc", MUTT_PAT_BCC },
1600 { "body", MUTT_PAT_BODY },
1601 { "broken", MUTT_PAT_BROKEN },
1602 { "cc", MUTT_PAT_CC },
1603 { "children", MUTT_PAT_CHILDREN },
1604 { "collapsed", MUTT_PAT_COLLAPSED },
1605 { "crypt_encrypt", MUTT_PAT_CRYPT_ENCRYPT },
1606 { "crypt_sign", MUTT_PAT_CRYPT_SIGN },
1607 { "crypt_verified", MUTT_PAT_CRYPT_VERIFIED },
1608 { "date", MUTT_PAT_DATE },
1609 { "date_received", MUTT_PAT_DATE_RECEIVED },
1610 { "driver_tags", MUTT_PAT_DRIVER_TAGS },
1611 { "duplicated", MUTT_PAT_DUPLICATED },
1612 { "from", MUTT_PAT_FROM },
1613 { "header", MUTT_PAT_HEADER },
1614 { "hormel", MUTT_PAT_HORMEL },
1615 { "id", MUTT_PAT_ID },
1616 { "id_external", MUTT_PAT_ID_EXTERNAL },
1617 { "list", MUTT_PAT_LIST },
1618 { "message", MUTT_PAT_MESSAGE },
1619 { "mimeattach", MUTT_PAT_MIMEATTACH },
1620 { "mimetype", MUTT_PAT_MIMETYPE },
1621 { "newsgroups", MUTT_PAT_NEWSGROUPS },
1622 { "OR", MUTT_PAT_OR },
1623 { "parent", MUTT_PAT_PARENT },
1624 { "personal_from", MUTT_PAT_PERSONAL_FROM },
1625 { "personal_recip", MUTT_PAT_PERSONAL_RECIP },
1626 { "pgp_key", MUTT_PAT_PGP_KEY },
1627 { "recipient", MUTT_PAT_RECIPIENT },
1628 { "reference", MUTT_PAT_REFERENCE },
1629 { "score", MUTT_PAT_SCORE },
1630 { "sender", MUTT_PAT_SENDER },
1631 { "serversearch", MUTT_PAT_SERVERSEARCH },
1632 { "size", MUTT_PAT_SIZE },
1633 { "subject", MUTT_PAT_SUBJECT },
1634 { "subscribed_list", MUTT_PAT_SUBSCRIBED_LIST },
1635 { "thread", MUTT_PAT_THREAD },
1636 { "to", MUTT_PAT_TO },
1637 { "unreferenced", MUTT_PAT_UNREFERENCED },
1638 { "whole_msg", MUTT_PAT_WHOLE_MSG },
1639 { "xlabel", MUTT_PAT_XLABEL },
1640 { NULL, 0 },
1641 // clang-format on
1642 };
1643
1644 return mutt_map_get_name(type, PatternNames);
1645}
1646
1647void dot_pattern(FILE *fp, struct Pattern *pat, struct ListHead *links)
1648{
1649 struct Buffer *buf = buf_pool_get();
1650 dot_object_header(fp, pat, "Pattern", "#c040c0");
1651
1652 dot_type_string(fp, "op", pattern_type_name(pat->op), true);
1653 if ((pat->min != 0) || (pat->max != 0))
1654 {
1655 dot_type_number(fp, "min", pat->min);
1656 dot_type_number(fp, "max", pat->max);
1657 }
1658
1659#define ADD_BOOL(F) add_flag(buf, pat->F, #F)
1660 ADD_BOOL(pat_not);
1661 ADD_BOOL(all_addr);
1662 ADD_BOOL(string_match);
1663 ADD_BOOL(group_match);
1664 ADD_BOOL(ign_case);
1665 ADD_BOOL(is_alias);
1666 ADD_BOOL(dynamic);
1667 ADD_BOOL(sendmode);
1668 ADD_BOOL(is_multi);
1669#undef ADD_BOOL
1670 dot_type_string(fp, "flags", buf_is_empty(buf) ? "[NONE]" : buf_string(buf), true);
1671
1672 if (pat->group_match)
1673 {
1674 // struct Group *group; ///< Address group if group_match is set
1675 }
1676 else if (pat->string_match)
1677 {
1678 dot_type_string(fp, "str", pat->p.str, true);
1679 }
1680 else if (pat->is_multi)
1681 {
1682 // struct ListHead multi_cases; ///< Multiple strings for ~I pattern
1683 }
1684 else
1685 {
1686 if (pat->p.regex)
1687 {
1688 dot_ptr(fp, "regex", pat->p.regex, NULL);
1689 dot_type_string(fp, "pattern", pat->raw_pattern, true);
1690 }
1691 }
1692
1694
1695 if (pat->child)
1696 {
1697 dot_patternlist(fp, pat->child, links);
1698 struct Pattern *first = SLIST_FIRST(pat->child);
1699 dot_add_link(links, pat, first, "Patern->child", false, "#00ff00");
1700 }
1701 buf_pool_release(&buf);
1702}
1703
1704void dot_patternlist(FILE *fp, struct PatternList *pl, struct ListHead *links)
1705{
1706 struct Buffer *buf = buf_pool_get();
1707
1708 char name[256] = { 0 };
1709 buf_addstr(buf, "{ rank=same ");
1710
1711 struct Pattern *prev = NULL;
1712 struct Pattern *np = NULL;
1713 SLIST_FOREACH(np, pl, entries)
1714 {
1715 dot_pattern(fp, np, links);
1716 if (prev)
1717 dot_add_link(links, prev, np, "PatternList->next", false, "#ff0000");
1718 prev = np;
1719
1720 dot_ptr_name(name, sizeof(name), np);
1721 buf_add_printf(buf, "%s ", name);
1722 }
1723
1724 buf_addstr(buf, "}");
1725
1726 mutt_list_insert_tail(links, buf_strdup(buf));
1727 buf_pool_release(&buf);
1728}
1729
1730void dump_graphviz_patternlist(struct PatternList *pl)
1731{
1732 char name[256] = { 0 };
1733 struct ListHead links = STAILQ_HEAD_INITIALIZER(links);
1734
1735 time_t now = time(NULL);
1736 mutt_date_localtime_format(name, sizeof(name), "%T-pattern.gv", now);
1737
1738 umask(022);
1739 FILE *fp = fopen(name, "w");
1740 if (!fp)
1741 return;
1742
1743 dot_graph_header(fp);
1744
1745 dot_patternlist(fp, pl, &links);
1746
1747 dot_graph_footer(fp, &links);
1748 fclose(fp);
1749 mutt_list_free(&links);
1750}
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
Definition: address.c:1207
Email Address Handling.
GUI display the mailboxes in a side panel.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition: buffer.c:173
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
Definition: buffer.c:216
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:88
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:303
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:253
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:238
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition: buffer.c:542
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
Compressed mbox local mailbox type.
Convenience wrapper for the config headers.
Connection Library.
Convenience wrapper for the core headers.
const char * name_content_encoding(enum ContentEncoding enc)
Definition: names.c:65
const char * name_content_type(enum ContentType type)
Definition: names.c:47
const char * name_content_disposition(enum ContentDisposition disp)
Definition: names.c:80
Structs that make up an email.
#define MUTT_ENV_CHANGED_SUBJECT
Protected header update.
Definition: envelope.h:37
#define MUTT_ENV_CHANGED_XLABEL
X-Label edited.
Definition: envelope.h:36
#define MUTT_ENV_CHANGED_IRT
In-Reply-To changed to link/break threads.
Definition: envelope.h:34
#define MUTT_ENV_CHANGED_REFS
References changed to break thread.
Definition: envelope.h:35
void dot_array_actx_idx(FILE *fp, struct AttachPtr **idx, short idxlen, short idxmax, struct ListHead *links)
Definition: graphviz.c:1453
void dot_mailbox_pop(FILE *fp, struct PopAccountData *adata, struct ListHead *links)
Definition: graphviz.c:524
void dot_ptr_name(char *buf, size_t buflen, const void *ptr)
Definition: graphviz.c:177
void dot_parameter_list(FILE *fp, const char *name, const struct ParameterList *pl)
Definition: graphviz.c:960
void dot_graph_header(FILE *fp)
Definition: graphviz.c:223
void dot_account_pop(FILE *fp, struct PopAccountData *adata, struct ListHead *links)
Definition: graphviz.c:772
void dot_object_footer(FILE *fp)
Definition: graphviz.c:274
void dot_path_fs(char *buf, size_t buflen, const char *path)
Definition: graphviz.c:316
void dump_graphviz_body(struct Body *b)
Definition: graphviz.c:1381
void dot_addr_list(FILE *fp, const char *name, const struct AddressList *al, struct ListHead *links)
Definition: graphviz.c:1187
void dot_mailbox_imap(FILE *fp, struct ImapMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:461
void dot_comp(FILE *fp, struct CompressInfo *ci, struct ListHead *links)
Definition: graphviz.c:407
void dot_mailbox_type(FILE *fp, const char *name, enum MailboxType type)
Definition: graphviz.c:416
void dot_attach_ptr2(FILE *fp, struct AttachPtr *aptr, struct ListHead *links)
Definition: graphviz.c:1431
void dot_type_date(char *buf, size_t buflen, time_t timestamp)
Definition: graphviz.c:101
void dot_array_actx_v2r(FILE *fp, short *v2r, short vcount, struct ListHead *links)
Definition: graphviz.c:1477
void dot_type_number(FILE *fp, const char *name, int num)
Definition: graphviz.c:123
#define ADDR_LIST(AL)
void dot_email(FILE *fp, struct Email *e, struct ListHead *links)
Definition: graphviz.c:1262
void dot_type_char(FILE *fp, const char *name, char ch)
Definition: graphviz.c:91
void dot_account_list(FILE *fp, struct AccountList *al, struct ListHead *links)
Definition: graphviz.c:847
void dot_account_mbox(FILE *fp, struct MboxAccountData *adata, struct ListHead *links)
Definition: graphviz.c:708
void dot_type_file(FILE *fp, const char *name, FILE *struct_fp)
Definition: graphviz.c:106
void dump_graphviz(const char *title, struct MailboxView *mv)
Definition: graphviz.c:879
void dot_type_bool(FILE *fp, const char *name, bool val)
Definition: graphviz.c:80
void dot_list_head(FILE *fp, const char *name, const struct ListHead *list)
Definition: graphviz.c:1166
void dot_config(FILE *fp, const char *name, int type, struct ConfigSubset *sub, struct ListHead *links)
Definition: graphviz.c:349
void dot_array_actx_body_idx(FILE *fp, struct Body **body_idx, short body_len, short body_max, struct ListHead *links)
Definition: graphviz.c:1511
void dot_account_imap(FILE *fp, struct ImapAccountData *adata, struct ListHead *links)
Definition: graphviz.c:686
void dot_patternlist(FILE *fp, struct PatternList *pl, struct ListHead *links)
Definition: graphviz.c:1704
void dot_type_umask(char *buf, size_t buflen, int umask)
Definition: graphviz.c:171
void dot_graph_footer(FILE *fp, struct ListHead *links)
Definition: graphviz.c:246
void dot_mailbox_node(FILE *fp, struct MailboxNode *mn, struct ListHead *links)
Definition: graphviz.c:612
void dot_mview(FILE *fp, struct MailboxView *mv, struct ListHead *links)
Definition: graphviz.c:866
void dot_account(FILE *fp, struct Account *a, struct ListHead *links)
Definition: graphviz.c:793
void dot_connection(FILE *fp, struct Connection *c, struct ListHead *links)
Definition: graphviz.c:670
void dot_mailbox_mbox(FILE *fp, struct MboxAccountData *mdata, struct ListHead *links)
Definition: graphviz.c:484
void dot_node_link(FILE *fp, void *ptr, const char *name, void *link, const char *colour)
Definition: graphviz.c:296
void dot_type_string(FILE *fp, const char *name, const char *str, bool force)
Definition: graphviz.c:145
void dot_account_notmuch(FILE *fp, struct NmAccountData *adata, struct ListHead *links)
Definition: graphviz.c:765
void dot_type_string_escape(char *buf, size_t buflen)
Definition: graphviz.c:132
void dot_array_actx_fp_idx(FILE *fp, FILE **fp_idx, short fp_len, short fp_max, struct ListHead *links)
Definition: graphviz.c:1493
void dot_attach_ctx(FILE *fp, struct AttachCtx *actx, struct ListHead *links)
Definition: graphviz.c:1537
void dot_path_imap(char *buf, size_t buflen, const char *path)
Definition: graphviz.c:333
void dot_node(FILE *fp, void *ptr, const char *name, const char *colour)
Definition: graphviz.c:281
void dot_mailbox_notmuch(FILE *fp, struct NmMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:517
void dot_pattern(FILE *fp, struct Pattern *pat, struct ListHead *links)
Definition: graphviz.c:1647
void dot_content(FILE *fp, struct Content *cont, struct ListHead *links)
Definition: graphviz.c:978
#define ADD_FLAG(F)
void dot_account_nntp(FILE *fp, struct NntpAccountData *adata, struct ListHead *links)
Definition: graphviz.c:723
void dot_attach_ptr(FILE *fp, struct AttachPtr *aptr, struct ListHead *links)
Definition: graphviz.c:1005
void dot_mailbox_list(FILE *fp, struct MailboxList *ml, struct ListHead *links, bool abbr)
Definition: graphviz.c:653
void dot_ptr(FILE *fp, const char *name, void *ptr, const char *colour)
Definition: graphviz.c:182
#define ADD_BOOL(F)
const char * pattern_type_name(int type)
Definition: graphviz.c:1593
void dot_object_header(FILE *fp, const void *ptr, const char *name, const char *colour)
Definition: graphviz.c:257
void dump_graphviz_patternlist(struct PatternList *pl)
Definition: graphviz.c:1730
void dot_envelope(FILE *fp, struct Envelope *env, struct ListHead *links)
Definition: graphviz.c:1201
void dump_graphviz_attach_ctx(struct AttachCtx *actx)
Definition: graphviz.c:1571
void dot_mailbox(FILE *fp, struct Mailbox *m, struct ListHead *links)
Definition: graphviz.c:532
void dot_mailbox_maildir(FILE *fp, struct MaildirMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:470
void dot_mailbox_nntp(FILE *fp, struct NntpMboxData *mdata, struct ListHead *links)
Definition: graphviz.c:497
void dump_graphviz_email(struct Email *e, const char *title)
Definition: graphviz.c:1403
void dot_add_link(struct ListHead *links, void *src, void *dst, const char *label, bool back, const char *colour)
Definition: graphviz.c:199
void dot_body(FILE *fp, struct Body *b, struct ListHead *links, bool link_next)
Definition: graphviz.c:1028
Imap-specific Account data.
IMAP network mailbox.
Imap-specific Mailbox data.
Shared constants/structs that are private to IMAP.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
Definition: list.c:64
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
MailboxType
Supported mailbox formats.
Definition: mailbox.h:41
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
Definition: mailbox.h:51
@ MUTT_MMDF
'mmdf' Mailbox type
Definition: mailbox.h:46
@ MUTT_POP
'POP3' Mailbox type
Definition: mailbox.h:52
@ MUTT_MH
'MH' Mailbox type
Definition: mailbox.h:47
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:50
@ MUTT_MBOX
'mbox' Mailbox type
Definition: mailbox.h:45
@ MUTT_COMPRESSED
Compressed file Mailbox type.
Definition: mailbox.h:53
@ MUTT_MAILDIR
'Maildir' Mailbox type
Definition: mailbox.h:48
Maildir-specific Email data.
Maildir local mailbox type.
Maildir-specific Mailbox data.
const char * mutt_map_get_name(int val, const struct Mapping *map)
Lookup a string for a constant.
Definition: mapping.c:42
#define FREE(x)
Definition: memory.h:45
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:924
Convenience wrapper for the library headers.
static const char * timestamp(time_t stamp)
Create a YYYY-MM-DD HH:MM:SS timestamp.
Definition: logging.c:77
bool mutt_str_inline_replace(char *buf, size_t buflen, size_t xlen, const char *rstr)
Replace the beginning of a string.
Definition: string.c:884
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:251
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:763
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:228
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:653
char * mutt_str_cat(char *buf, size_t buflen, const char *s)
Concatenate two strings.
Definition: string.c:266
View of a Mailbox.
API for encryption/signing of emails.
#define SEC_INLINE
Email has an inline signature.
Definition: lib.h:86
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:88
#define SEC_OPPENCRYPT
Opportunistic encrypt mode.
Definition: lib.h:87
#define PGP_TRADITIONAL_CHECKED
Email has a traditional (inline) signature.
Definition: lib.h:93
#define SEC_GOODSIGN
Email has a valid signature.
Definition: lib.h:81
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:91
#define SEC_SIGNOPAQUE
Email has an opaque signature (encrypted)
Definition: lib.h:84
#define SEC_BADSIGN
Email has a bad signature.
Definition: lib.h:82
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:92
#define SEC_PARTSIGN
Not all parts of the email is signed.
Definition: lib.h:83
#define SEC_ENCRYPT
Email is encrypted.
Definition: lib.h:79
#define SEC_AUTOCRYPT_OVERRIDE
(Autocrypt) Indicates manual set/unset of encryption
Definition: lib.h:89
#define SEC_SIGN
Email is signed.
Definition: lib.h:80
#define SEC_KEYBLOCK
Email has a key attached.
Definition: lib.h:85
Nntp-specific Account data.
Usenet network mailbox type; talk to an NNTP server.
Nntp-specific Mailbox data.
Notmuch-specific Account data.
Notmuch virtual mailbox type.
Notmuch-specific Mailbox data.
Notmuch private types.
Match patterns to emails.
@ MUTT_PAT_HEADER
Pattern matches email's header.
Definition: lib.h:156
@ MUTT_PAT_WHOLE_MSG
Pattern matches raw email text.
Definition: lib.h:158
@ MUTT_PAT_BROKEN
Message is part of a broken thread.
Definition: lib.h:152
@ MUTT_PAT_ID_EXTERNAL
Message-Id is among results from an external query.
Definition: lib.h:154
@ MUTT_PAT_OR
Either pattern can match.
Definition: lib.h:138
@ MUTT_PAT_CHILDREN
Pattern matches a child email.
Definition: lib.h:141
@ MUTT_PAT_PARENT
Pattern matches parent.
Definition: lib.h:140
@ MUTT_PAT_REFERENCE
Pattern matches 'References:' or 'In-Reply-To:' field.
Definition: lib.h:163
@ MUTT_PAT_FROM
Pattern matches 'From:' field.
Definition: lib.h:147
@ MUTT_PAT_DRIVER_TAGS
Pattern matches message tags.
Definition: lib.h:176
@ MUTT_PAT_COLLAPSED
Thread is collapsed.
Definition: lib.h:145
@ MUTT_PAT_CRYPT_VERIFIED
Message is crypographically verified.
Definition: lib.h:171
@ MUTT_PAT_HORMEL
Pattern matches email's spam score.
Definition: lib.h:157
@ MUTT_PAT_SUBJECT
Pattern matches 'Subject:' field.
Definition: lib.h:146
@ MUTT_PAT_LIST
Email is on mailing list.
Definition: lib.h:165
@ MUTT_PAT_NEWSGROUPS
Pattern matches newsgroup.
Definition: lib.h:179
@ MUTT_PAT_PERSONAL_RECIP
Email is addressed to the user.
Definition: lib.h:167
@ MUTT_PAT_CC
Pattern matches 'Cc:' field.
Definition: lib.h:143
@ MUTT_PAT_SUBSCRIBED_LIST
Email is on subscribed mailing list.
Definition: lib.h:166
@ MUTT_PAT_SERVERSEARCH
Server-side pattern matches.
Definition: lib.h:175
@ MUTT_PAT_RECIPIENT
User is a recipient of the email.
Definition: lib.h:164
@ MUTT_PAT_CRYPT_ENCRYPT
Message is encrypted.
Definition: lib.h:172
@ MUTT_PAT_UNREFERENCED
Message is unreferenced in the thread.
Definition: lib.h:151
@ MUTT_PAT_CRYPT_SIGN
Message is signed.
Definition: lib.h:170
@ MUTT_PAT_MESSAGE
Pattern matches message number.
Definition: lib.h:160
@ MUTT_PAT_AND
Both patterns must match.
Definition: lib.h:137
@ MUTT_PAT_DATE
Pattern matches 'Date:' field.
Definition: lib.h:148
@ MUTT_PAT_XLABEL
Pattern matches keyword/label.
Definition: lib.h:174
@ MUTT_PAT_SCORE
Pattern matches email's score.
Definition: lib.h:161
@ MUTT_PAT_MIMEATTACH
Pattern matches number of attachments.
Definition: lib.h:177
@ MUTT_PAT_DUPLICATED
Duplicate message.
Definition: lib.h:150
@ MUTT_PAT_PERSONAL_FROM
Email is from the user.
Definition: lib.h:168
@ MUTT_PAT_TO
Pattern matches 'To:' field.
Definition: lib.h:142
@ MUTT_PAT_BCC
Pattern matches 'Bcc:' field.
Definition: lib.h:144
@ MUTT_PAT_SENDER
Pattern matches sender.
Definition: lib.h:159
@ MUTT_PAT_DATE_RECEIVED
Pattern matches date received.
Definition: lib.h:149
@ MUTT_PAT_ADDRESS
Pattern matches any address field.
Definition: lib.h:169
@ MUTT_PAT_MIMETYPE
Pattern matches MIME type.
Definition: lib.h:178
@ MUTT_PAT_PGP_KEY
Message has PGP key.
Definition: lib.h:173
@ MUTT_PAT_ID
Pattern matches email's Message-Id.
Definition: lib.h:153
@ MUTT_PAT_THREAD
Pattern matches email thread.
Definition: lib.h:139
@ MUTT_PAT_SIZE
Pattern matches email's size.
Definition: lib.h:162
@ MUTT_PAT_BODY
Pattern matches email's body.
Definition: lib.h:155
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
Pop-specific Account data.
POP network mailbox.
POP network mailbox.
#define SLIST_FOREACH(var, head, field)
Definition: queue.h:231
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:324
#define STAILQ_FIRST(head)
Definition: queue.h:350
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define STAILQ_EMPTY(head)
Definition: queue.h:348
#define SLIST_FIRST(head)
Definition: queue.h:229
#define TAILQ_EMPTY(head)
Definition: queue.h:721
Key value store.
A group of associated Mailboxes.
Definition: account.h:37
enum MailboxType type
Type of Mailboxes this Account contains.
Definition: account.h:38
char * name
Name of Account.
Definition: account.h:39
struct ConfigSubset * sub
Inherited config items.
Definition: account.h:40
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
struct MailboxList mailboxes
List of Mailboxes.
Definition: account.h:41
A set of attachments.
Definition: attach.h:51
short vcount
The number of virtual attachments.
Definition: attach.h:60
short body_len
Number of Body parts.
Definition: attach.h:67
FILE * fp_root
Used by recvattach for updating.
Definition: attach.h:53
short fp_max
Size of FILE array.
Definition: attach.h:64
struct Email * email
Used by recvattach for updating.
Definition: attach.h:52
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:55
struct Body ** body_idx
Extra struct Body* used for decryption.
Definition: attach.h:66
short fp_len
Number of FILE handles.
Definition: attach.h:63
short body_max
Size of Body array.
Definition: attach.h:68
FILE ** fp_idx
Extra FILE* used for decryption.
Definition: attach.h:62
short idxmax
Size of attachment array.
Definition: attach.h:57
short idxlen
Number of attachmentes.
Definition: attach.h:56
short * v2r
Mapping from virtual to real attachment.
Definition: attach.h:59
An email to which things will be attached.
Definition: attach.h:35
struct Body * body
Attachment.
Definition: attach.h:36
bool collapsed
Group is collapsed.
Definition: attach.h:44
int num
Attachment index number.
Definition: attach.h:41
int level
Nesting depth of attachment.
Definition: attach.h:40
FILE * fp
Used in the recvattach menu.
Definition: attach.h:37
bool unowned
Don't unlink on detach.
Definition: attach.h:42
bool decrypted
Not part of message as stored in the email->body.
Definition: attach.h:43
int parent_type
Type of parent attachment, e.g. TYPE_MULTIPART.
Definition: attach.h:38
The body of an email.
Definition: body.h:36
char * language
content-language (RFC8255)
Definition: body.h:77
char * d_filename
filename to be used for the content-disposition header If NULL, filename is used instead.
Definition: body.h:56
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:72
LOFF_T offset
offset where the actual data begins
Definition: body.h:52
signed short attach_count
Number of attachments.
Definition: body.h:90
char * xtype
content-type if x-unknown
Definition: body.h:61
time_t stamp
Time stamp of last encoding update.
Definition: body.h:76
struct Envelope * mime_headers
Memory hole protected headers.
Definition: body.h:75
LOFF_T length
length (in bytes) of attachment
Definition: body.h:53
char * charset
Send mode: charset of attached file as stored on disk.
Definition: body.h:78
struct ParameterList parameter
Parameters of the content-type.
Definition: body.h:62
struct AttachPtr * aptr
Menu information, used in recvattach.c.
Definition: body.h:74
struct Email * email
header information for message/rfc822
Definition: body.h:73
char * description
content-description
Definition: body.h:55
unsigned int disposition
content-disposition, ContentDisposition
Definition: body.h:42
struct Content * content
Detailed info about the content of the attachment.
Definition: body.h:69
struct Body * next
next attachment in the list
Definition: body.h:71
char * subtype
content-type subtype
Definition: body.h:60
unsigned int encoding
content-transfer-encoding, ContentEncoding
Definition: body.h:41
long hdr_offset
Offset in stream where the headers begin.
Definition: body.h:80
char * form_name
Content-Disposition form-data name param.
Definition: body.h:59
unsigned int type
content-type primary type, ContentType
Definition: body.h:40
char * filename
When sending a message, this is the file to which this structure refers.
Definition: body.h:58
String manipulation buffer.
Definition: buffer.h:34
Private data for compress.
Definition: lib.h:47
const char * cmd_append
append-hook command
Definition: lib.h:48
const char * cmd_open
open-hook command
Definition: lib.h:50
const char * cmd_close
close-hook command
Definition: lib.h:49
A set of inherited config items.
Definition: subset.h:47
const char * name
Scope name of Subset.
Definition: subset.h:48
struct ConfigSet * cs
Parent ConfigSet.
Definition: subset.h:51
char login[128]
Login name.
Definition: connaccount.h:55
char user[128]
Username.
Definition: connaccount.h:56
char pass[256]
Password.
Definition: connaccount.h:57
char host[128]
Server to login to.
Definition: connaccount.h:54
unsigned short port
Port to connect to.
Definition: connaccount.h:58
char inbuf[1024]
Buffer for incoming traffic.
Definition: connection.h:52
struct ConnAccount account
Account details: username, password, etc.
Definition: connection.h:50
int fd
Socket file descriptor.
Definition: connection.h:54
Info about an attachment.
Definition: content.h:35
long crlf
\r and \n characters
Definition: content.h:39
long hibin
8-bit characters
Definition: content.h:36
long ascii
Number of ascii chars.
Definition: content.h:40
long nulbin
Null characters (0x0)
Definition: content.h:38
long linemax
Length of the longest line in the file.
Definition: content.h:41
long lobin
Unprintable 7-bit chars (eg., control chars)
Definition: content.h:37
The envelope/body of an email.
Definition: email.h:37
unsigned int zminutes
Minutes away from UTC.
Definition: email.h:55
struct Envelope * env
Envelope information.
Definition: email.h:66
int lines
How many lines in the body of this message?
Definition: email.h:60
struct Body * body
List of MIME parts.
Definition: email.h:67
size_t num_hidden
Number of hidden messages in this view (only valid when collapsed is set)
Definition: email.h:124
bool zoccident
True, if west of UTC, False if east.
Definition: email.h:56
LOFF_T offset
Where in the stream does this message begin?
Definition: email.h:69
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition: email.h:116
unsigned int zhours
Hours away from UTC.
Definition: email.h:54
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:58
int vnum
Virtual message number.
Definition: email.h:115
int score
Message score.
Definition: email.h:114
int msgno
Number displayed to the user.
Definition: email.h:112
char * path
Path of Email (for local Mailboxes)
Definition: email.h:68
int index
The absolute (unsorted) message number.
Definition: email.h:111
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:59
The header of an Email.
Definition: envelope.h:57
struct ListHead userhdrs
user defined headers
Definition: envelope.h:85
char * supersedes
Supersedes header.
Definition: envelope.h:74
char * list_subscribe
This stores a mailto URL, or nothing.
Definition: envelope.h:68
char * followup_to
List of 'followup-to' fields.
Definition: envelope.h:80
char * message_id
Message ID.
Definition: envelope.h:73
char * x_comment_to
List of 'X-comment-to' fields.
Definition: envelope.h:81
struct AutocryptHeader * autocrypt_gossip
Autocrypt Gossip header.
Definition: envelope.h:88
char * newsgroups
List of newsgroups.
Definition: envelope.h:78
struct ListHead references
message references (in reverse order)
Definition: envelope.h:83
struct AutocryptHeader * autocrypt
Autocrypt header.
Definition: envelope.h:87
struct Buffer spam
Spam header.
Definition: envelope.h:82
struct ListHead in_reply_to
in-reply-to header content
Definition: envelope.h:84
char * subject
Email's subject.
Definition: envelope.h:70
char * xref
List of cross-references.
Definition: envelope.h:79
char * organization
Organisation header.
Definition: envelope.h:77
char * x_label
X-Label.
Definition: envelope.h:76
char * list_post
This stores a mailto URL, or nothing.
Definition: envelope.h:67
char * date
Sent date.
Definition: envelope.h:75
char * real_subj
Offset of the real subject.
Definition: envelope.h:71
char * disp_subj
Display subject (modified copy of subject)
Definition: envelope.h:72
char * list_unsubscribe
This stores a mailto URL, or nothing.
Definition: envelope.h:69
The item stored in a Hash Table.
Definition: hash.h:44
union HashKey key
Key representing the data.
Definition: hash.h:46
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition: hash.h:45
IMAP-specific Account data -.
Definition: adata.h:40
bool qresync
true, if QRESYNC is successfully ENABLE'd
Definition: adata.h:63
unsigned char seqid
tag sequence prefix
Definition: adata.h:56
bool unicode
If true, we can send UTF-8, and the server will use UTF8 rather than mUTF7.
Definition: adata.h:62
struct Mailbox * mailbox
Current selected mailbox.
Definition: adata.h:76
struct Connection * conn
Connection to IMAP server.
Definition: adata.h:41
IMAP-specific Mailbox data -.
Definition: mdata.h:40
char * real_name
Original Mailbox name, e.g.: INBOX can be just \0.
Definition: mdata.h:43
char * munge_name
Munged version of the mailbox name.
Definition: mdata.h:42
char * name
Mailbox name.
Definition: mdata.h:41
A List node for strings.
Definition: list.h:35
char * data
String.
Definition: list.h:36
List of Mailboxes.
Definition: mailbox.h:153
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:154
View of a Mailbox.
Definition: mview.h:39
bool collapsed
Are all threads collapsed?
Definition: mview.h:48
off_t vsize
Size (in bytes) of the messages shown.
Definition: mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:50
char * pattern
Limit pattern string.
Definition: mview.h:41
A mailbox.
Definition: mailbox.h:79
int vcount
The number of virtual messages.
Definition: mailbox.h:99
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:81
int * v2r
Mapping from virtual to real msgno.
Definition: mailbox.h:98
int msg_count
Total number of messages.
Definition: mailbox.h:88
int email_max
Size of emails array.
Definition: mailbox.h:97
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
void * mdata
Driver specific data.
Definition: mailbox.h:131
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
char * name
A short name for the Mailbox.
Definition: mailbox.h:82
struct Buffer pathbuf
Path of the Mailbox.
Definition: mailbox.h:80
struct Account * account
Account that owns this Mailbox.
Definition: mailbox.h:126
int opened
Number of times mailbox is opened.
Definition: mailbox.h:127
void * compress_info
Compressed mbox module private data.
Definition: mailbox.h:120
struct ConfigSubset * sub
Inherited config items.
Definition: mailbox.h:83
Maildir-specific Mailbox data -.
Definition: mdata.h:35
struct timespec mtime_cur
Timestamp of the 'cur' dir.
Definition: mdata.h:37
mode_t umask
umask to use when creating files
Definition: mdata.h:38
Mapping between user-readable string and a constant.
Definition: mapping.h:32
Mbox-specific Account data -.
Definition: lib.h:49
FILE * fp
Mailbox file.
Definition: lib.h:50
bool append
mailbox is opened in append mode
Definition: lib.h:56
bool locked
is the mailbox locked?
Definition: lib.h:55
struct timespec atime
File's last-access time.
Definition: lib.h:52
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct AccountList accounts
List of all Accounts.
Definition: neomutt.h:46
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
Notmuch-specific Account data -.
Definition: adata.h:35
notmuch_database_t * db
Connection to Notmuch database.
Definition: adata.h:36
Notmuch-specific Mailbox data -.
Definition: mdata.h:35
int db_limit
Maximum number of results to return.
Definition: mdata.h:38
NNTP-specific Account data -.
Definition: adata.h:36
time_t newgroups_time
Definition: adata.h:56
bool newsrc_modified
Definition: adata.h:49
bool hasXOVER
Server supports XOVER command.
Definition: adata.h:45
struct Connection * conn
Connection to NNTP Server.
Definition: adata.h:62
char * authenticators
Definition: adata.h:52
char * overview_fmt
Definition: adata.h:53
bool hasXGTITLE
Server supports XGTITLE command.
Definition: adata.h:41
unsigned int groups_num
Definition: adata.h:58
bool hasCAPABILITIES
Server supports CAPABILITIES command.
Definition: adata.h:37
bool hasSTARTTLS
Server supports STARTTLS command.
Definition: adata.h:38
bool hasLISTGROUPrange
Server supports LISTGROUPrange command.
Definition: adata.h:43
time_t check_time
Definition: adata.h:57
time_t mtime
Definition: adata.h:55
unsigned int groups_max
Definition: adata.h:59
bool hasLISTGROUP
Server supports LISTGROUP command.
Definition: adata.h:42
FILE * fp_newsrc
Definition: adata.h:50
bool cacheable
Definition: adata.h:48
bool hasOVER
Server supports OVER command.
Definition: adata.h:44
char * newsrc_file
Definition: adata.h:51
bool hasDATE
Server supports DATE command.
Definition: adata.h:39
bool hasLIST_NEWSGROUPS
Server supports LIST_NEWSGROUPS command.
Definition: adata.h:40
NNTP-specific Mailbox data -.
Definition: mdata.h:34
anum_t last_cached
Definition: mdata.h:40
bool deleted
Definition: mdata.h:45
bool allowed
Definition: mdata.h:44
anum_t last_message
Definition: mdata.h:38
char * group
Name of newsgroup.
Definition: mdata.h:35
char * desc
Description of newsgroup.
Definition: mdata.h:36
anum_t unread
Definition: mdata.h:41
anum_t last_loaded
Definition: mdata.h:39
bool has_new_mail
Definition: mdata.h:43
anum_t first_message
Definition: mdata.h:37
bool subscribed
Definition: mdata.h:42
Attribute associated with a MIME part.
Definition: parameter.h:33
char * attribute
Parameter name.
Definition: parameter.h:34
char * value
Parameter value.
Definition: parameter.h:35
A simple (non-regex) pattern.
Definition: lib.h:77
bool group_match
Check a group of Addresses.
Definition: lib.h:82
union Pattern::@1 p
struct PatternList * child
Arguments to logical operation.
Definition: lib.h:90
long min
Minimum for range checks.
Definition: lib.h:88
bool string_match
Check a string for a match.
Definition: lib.h:81
regex_t * regex
Compiled regex, for non-pattern matching.
Definition: lib.h:92
char * str
String, if string_match is set.
Definition: lib.h:94
long max
Maximum for range checks.
Definition: lib.h:89
short op
Operation, e.g. MUTT_PAT_SCORE.
Definition: lib.h:78
bool is_multi
Multiple case (only for ~I pattern now)
Definition: lib.h:87
POP-specific Account data -.
Definition: adata.h:37
time_t check_time
Definition: adata.h:51
struct Connection * conn
Connection to POP server.
Definition: adata.h:38
A parsed URL proto://user:password@host:port/path?a=1&b=2
Definition: url.h:69
char * user
Username.
Definition: url.h:71
char * host
Host.
Definition: url.h:73
char * path
Path.
Definition: url.h:75
time_t tv_sec
Number of seconds since the epoch.
Definition: file.h:51
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
Definition: subset.c:353
struct HashElem ** get_elem_list(struct ConfigSet *cs)
Create a sorted list of all config items.
Definition: subset.c:70
#define DT_INHERIT_MBOX
Config item can be Mailbox-specific.
Definition: types.h:56
#define DTYPE(x)
Mask for the Data Type.
Definition: types.h:45
#define DT_INHERIT_ACC
Config item can be Account-specific.
Definition: types.h:55
#define DT_STRING
a string
Definition: types.h:41
#define DT_SENSITIVE
Contains sensitive value, e.g. password.
Definition: types.h:53
const char * strkey
String key.
Definition: hash.h:36
struct Url * url_parse(const char *src)
Fill in Url.
Definition: url.c:238
void url_free(struct Url **ptr)
Free the contents of a URL.
Definition: url.c:123