Skip to content

Instantly share code, notes, and snippets.

@flatcap
Last active March 26, 2021 00:18
Show Gist options
  • Select an option

  • Save flatcap/04d2ca9a7993eaedd26650986049b8de to your computer and use it in GitHub Desktop.

Select an option

Save flatcap/04d2ca9a7993eaedd26650986049b8de to your computer and use it in GitHub Desktop.
view attachment
digraph windows
{
graph [
rankdir="LR"
nodesep="0.2"
ranksep="0.5"
compound="true"
]
node [
shape="Mrecord"
fontsize="12"
fillcolor="#ffffff"
style="filled"
height="0.2"
penwidth="1.5"
color="black"
]
edge [
penwidth="2.0"
arrowsize="0.5"
color="#00ff00"
]
alternative_handler -> is_autoview
alternative_handler -> mutt_body_handler
autoview_handler -> mailcap_lookup
is_autoview -> mailcap_lookup
mailcap_lookup -> rfc1524_mailcap_parse
mutt_body_handler -> is_autoview
mutt_body_handler -> run_decode_and_handler
mutt_copy_message -> mutt_copy_message_fp
mutt_copy_message_fp -> mutt_body_handler
mutt_display_message -> mutt_copy_message
mutt_display_message -> mutt_pager
mutt_index_menu -> mutt_display_message
run_decode_and_handler -> alternative_handler
run_decode_and_handler -> autoview_handler
edge [ color="#ff0000" ]
dlg_select_attachment -> mutt_attach_display_loop
mailcap_lookup -> rfc1524_mailcap_parse
mutt_attach_display_loop -> mutt_view_attachment
mutt_do_pager -> mutt_pager
mutt_index_menu -> dlg_select_attachment
mutt_view_attachment -> mailcap_lookup
mutt_view_attachment -> mutt_do_pager
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Backtraces for view-attachment
index/index.c:4018: mutt_index_menu (dlg=0x7cbaa0)
recvattach.c:1629: dlg_select_attachment (e=0x79a710)
recvattach.c:1314: mutt_attach_display_loop (menu=0x7cc600, op=227, e=0x79a710, actx=0x7a5c30, recv=true)
mutt_attach.c:454: mutt_view_attachment (fp=0x62b7c0, a=0x798f30, mode=MUTT_VA_REGULAR, e=0x79a710, actx=0x7a5c30, win=0x7abc30)
mailcap.c:513: mailcap_lookup (a=0x798f30, type=0x7fffffffb4f0 "text/html", typelen=256, entry=0x7a7b10, opt=MUTT_MC_NO_FLAGS)
mailcap.c:380: rfc1524_mailcap_parse (a=0x798f30, filename=0x62aef0 "/home/mutt/.mutt/mailcap-dev", type=0x7fffffffb4f0 "text/html", entry=0x7a7b10, opt=MUTT_MC_NO_FLAGS)
index/index.c:4018: mutt_index_menu (dlg=0x7cbaa0)
recvattach.c:1629: dlg_select_attachment (e=0x79a710)
recvattach.c:1314: mutt_attach_display_loop (menu=0x7cc600, op=227, e=0x79a710, actx=0x7a5c30, recv=true)
mutt_attach.c:663: mutt_view_attachment (fp=0x62b7c0, a=0x798f30, mode=MUTT_VA_REGULAR, e=0x79a710, actx=0x7a5c30, win=0x7abc30)
gui/curs_lib.c:736: mutt_do_pager (banner=0x7fffffffb3f0 "---Command: rev", ' ' <repeats 28 times>, "Attachment: text/html", tempfile=0x62aae0 "/tmp/mutt/neomutt-laptop-1001-1857105-1511995341976267949", do_color=768, info=0x7fffffffb360)
pager/pager.c:2350: mutt_pager (banner=0x7fffffffb3f0 "---Command: rev", ' ' <repeats 28 times>, "Attachment: text/html", fname=0x62aae0 "/tmp/mutt/neomutt-laptop-1001-1857105-1511995341976267949", flags=768, extra=0x7fffffffb360)
Backtraces for Pager auto-view
index/index.c:2658: mutt_index_menu (dlg=0x7cbaa0)
commands.c:311: mutt_display_message (win_index=0x7c7160, win_ibar=0x7c1b30, win_pager=0x7c0340, win_pbar=0x7be6a0, m=0x734100, e=0x79a710)
copy.c:854: mutt_copy_message (fp_out=0x62b7c0, m=0x734100, e=0x79a710, cmflags=76, chflags=262294, wraplen=60)
copy.c:756: mutt_copy_message_fp (fp_out=0x62b7c0, fp_in=0x684b00, e=0x79a710, cmflags=76, chflags=262294, wraplen=60)
handler.c:1739: mutt_body_handler (b=0x7a39b0, s=0x7fffffffb0a0)
handler.c:1411: run_decode_and_handler (b=0x7a39b0, s=0x7fffffffb0a0, handler=0x425b6f <alternative_handler>, plaintext=false)
handler.c:1002: alternative_handler (a=0x7a39b0, s=0x7fffffffb0a0)
handler.c:514: is_autoview (b=0x798f30)
mailcap.c:513: mailcap_lookup (a=0x798f30, type=0x7fffffffacd0 "text/html", typelen=256, entry=0x0, opt=MUTT_MC_AUTOVIEW)
mailcap.c:380: rfc1524_mailcap_parse (a=0x798f30, filename=0x62aae0 "/home/mutt/.mutt/mailcap-dev", type=0x7fffffffacd0 "text/html", entry=0x0, opt=MUTT_MC_AUTOVIEW)
index/index.c:2658: mutt_index_menu (dlg=0x7cbaa0)
commands.c:311: mutt_display_message (win_index=0x7c7160, win_ibar=0x7c1b30, win_pager=0x7c0340, win_pbar=0x7be6a0, m=0x734100, e=0x79a710)
copy.c:854: mutt_copy_message (fp_out=0x62b7c0, m=0x734100, e=0x79a710, cmflags=76, chflags=262294, wraplen=60)
copy.c:756: mutt_copy_message_fp (fp_out=0x62b7c0, fp_in=0x684b00, e=0x79a710, cmflags=76, chflags=262294, wraplen=60)
handler.c:1739: mutt_body_handler (b=0x7a39b0, s=0x7fffffffb0a0)
handler.c:1411: run_decode_and_handler (b=0x7a39b0, s=0x7fffffffb0a0, handler=0x425b6f <alternative_handler>, plaintext=false)
handler.c:1070: alternative_handler (a=0x7a39b0, s=0x7fffffffb0a0)
handler.c:1621: mutt_body_handler (b=0x798f30, s=0x7fffffffb0a0)
handler.c:514: is_autoview (b=0x798f30)
mailcap.c:513: mailcap_lookup (a=0x798f30, type=0x7fffffffabe0 "text/html", typelen=256, entry=0x0, opt=MUTT_MC_AUTOVIEW)
mailcap.c:380: rfc1524_mailcap_parse (a=0x798f30, filename=0x62aae0 "/home/mutt/.mutt/mailcap-dev", type=0x7fffffffabe0 "text/html", entry=0x0, opt=MUTT_MC_AUTOVIEW)
index/index.c:2658: mutt_index_menu (dlg=0x7cbaa0)
commands.c:311: mutt_display_message (win_index=0x7c7160, win_ibar=0x7c1b30, win_pager=0x7c0340, win_pbar=0x7be6a0, m=0x734100, e=0x79a710)
copy.c:854: mutt_copy_message (fp_out=0x62b7c0, m=0x734100, e=0x79a710, cmflags=76, chflags=262294, wraplen=60)
copy.c:756: mutt_copy_message_fp (fp_out=0x62b7c0, fp_in=0x684b00, e=0x79a710, cmflags=76, chflags=262294, wraplen=60)
handler.c:1739: mutt_body_handler (b=0x7a39b0, s=0x7fffffffb0a0)
handler.c:1411: run_decode_and_handler (b=0x7a39b0, s=0x7fffffffb0a0, handler=0x425b6f <alternative_handler>, plaintext=false)
handler.c:1070: alternative_handler (a=0x7a39b0, s=0x7fffffffb0a0)
handler.c:1739: mutt_body_handler (b=0x798f30, s=0x7fffffffb0a0)
handler.c:1411: run_decode_and_handler (b=0x798f30, s=0x7fffffffb0a0, handler=0x4249e2 <autoview_handler>, plaintext=false)
handler.c:537: autoview_handler (a=0x798f30, s=0x7fffffffb0a0)
mailcap.c:513: mailcap_lookup (a=0x798f30, type=0x7fffffffa760 "text/html", typelen=256, entry=0x7bb970, opt=MUTT_MC_AUTOVIEW)
mailcap.c:380: rfc1524_mailcap_parse (a=0x798f30, filename=0x62aef0 "/home/mutt/.mutt/mailcap-dev", type=0x7fffffffa760 "text/html", entry=0x7bb970, opt=MUTT_MC_AUTOVIEW)
index/index.c:2658: mutt_index_menu (dlg=0x7cbaa0)
commands.c:379: mutt_display_message (win_index=0x7c7160, win_ibar=0x7c1b30, win_pager=0x7c0340, win_pbar=0x7be6a0, m=0x734100, e=0x79a710)
pager/pager.c:2350: mutt_pager (banner=0x0, fname=0x629eb0 "/tmp/mutt/neomutt-laptop-1001-1844708-5507613851532005307", flags=66, extra=0x7fffffffb250)

Key

Call stack for viewing an attachment:

  • Green lines: Using auto_view in Pager
  • Red lines: Using <view-attachments>, <view-attach>
int alternative_handler (Body *a, State *s);
int autoview_handler (Body *a, State *s);
void dlg_select_attachment (Email *e);
bool is_autoview (Body *b);
bool mailcap_lookup (Body *a, char *type, size_t typelen, MailcapEntry *entry, MailcapLookup opt);
int mutt_attach_display_loop(Menu *menu, int op, Email *e, AttachCtx *actx, bool recv);
int mutt_body_handler (Body *b, State *s);
int mutt_copy_message (FILE *fp_out, Mailbox *m, Email *e, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen);
int mutt_copy_message_fp (FILE *fp_out, FILE *fp_in, Email *e, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen);
int mutt_display_message (MuttWindow *win_index, MuttWindow *win_ibar, MuttWindow *win_pager, MuttWindow *win_pbar, Mailbox *m, Email *e);
int mutt_do_pager (char *banner, char *tempfile, PagerFlags do_color, Pager *info);
int mutt_index_menu (MuttWindow *dlg);
int mutt_pager (char *banner, char *fname, PagerFlags flags, Pager *extra);
int mutt_view_attachment (FILE *fp, Body *a, ViewAttachMode mode, Email *e, AttachCtx *actx, MuttWindow *win);
bool rfc1524_mailcap_parse (Body *a, char *filename, char *type, MailcapEntry *entry, MailcapLookup opt);
int run_decode_and_handler (Body *b, State *s, handler_t handler, bool plaintext);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment