Skip to content

Commit

Permalink
graphviz: add dump_graphviz_body()
Browse files Browse the repository at this point in the history
  • Loading branch information
flatcap committed Jan 3, 2022
1 parent 1cabdee commit 29043c3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions debug/graphviz.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,28 @@ static void dot_email(FILE *fp, struct Email *e, struct ListHead *links)
mutt_buffer_dealloc(&buf);
}

void dump_graphviz_body(struct Body *b)
{
char name[256] = { 0 };
struct ListHead links = STAILQ_HEAD_INITIALIZER(links);

time_t now = time(NULL);
mutt_date_localtime_format(name, sizeof(name), "%R-email.gv", now);

umask(022);
FILE *fp = fopen(name, "w");
if (!fp)
return;

dot_graph_header(fp);

dot_body(fp, b, &links, true);

dot_graph_footer(fp, &links);
fclose(fp);
mutt_list_free(&links);
}

void dump_graphviz_email(struct Email *e)
{
char name[256] = { 0 };
Expand Down
1 change: 1 addition & 0 deletions debug/lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const char *get_content_type (enum ContentType type);
void add_flag (struct Buffer *buf, bool is_set, const char *name);
void dump_graphviz (const char *title, struct Context *ctx);
void dump_graphviz_attach_ctx(struct AttachCtx *actx);
void dump_graphviz_body (struct Body *b);
void dump_graphviz_email (struct Email *e);
const char *get_content_disposition(enum ContentDisposition disp);
const char *get_content_encoding (enum ContentEncoding enc);
Expand Down

0 comments on commit 29043c3

Please sign in to comment.