2018-04-03
___V_C_a_l_e_n_d_a_r__h_a_n_d_l_i_n_g__i_n__m_u_t_t__________________
My coworkers use outlook a lot to handle meeting dates. This is
particular annoying for me as I use mutt at work and need to make
sense of the gibberish that a VCALENDAR attachment is.
Today I got so annoyed that I wrote a little awk script:
'''awk
#!/usr/bin/awk -f
/^SUMMARY/ { FS=":"; summ = $NF }
/^LOCATION/ { FS=":"; meet = $NF }
/^DTSTART/ { FS=":";
n = split($NF, date, "T");
date_st = sprintf("%s-%s-%s", substr(date[1], 0,4),
substr(date[1],5,2), substr(date[1],7,2));
time_st = sprintf("%s:%s",
substr(date[n],0,2), substr(date[n],3,2)); }
/^DTEND/ { FS=":";
n = split($NF, date, "T");
time_nd = sprintf("%s:%s",
substr(date[n],0,2), substr(date[n],3,2)); }
END { print date_st" - "summ,"\n",time_st, "-", time_nd,meet"\n" }
'''
This works nicely. I have this in my .muttrc:
'''
auto_view text/calendar text/html
alternative_order text/calendar text/plain text/html
'''
Ignore that html part, that's getting piped through lynx.
And in my mailcap I added:
'''mailcap
text/calendar; vcalendar2txt %s; copiousoutput
'''
The copiousoutput part tells mutt that it is non-interactive (amongst
potential flooding it with output), so without that the auto_view
will not work.
The awk script is a bit ugly, I guess one could move the redundant
parts into its own function.
How do you deal with the enterprise IT horrors?