21 |
* v[isual] [msglist] |
* v[isual] [msglist] |
22 |
*/ |
*/ |
23 |
|
|
24 |
|
static int |
25 |
|
visual0 (msgset_t *mspec, message_t msg, void *data) |
26 |
|
{ |
27 |
|
attribute_t attr = NULL; |
28 |
|
char *file = mu_tempname (NULL); |
29 |
|
|
30 |
|
util_do_command ("copy %s", file); |
31 |
|
util_do_command ("shell %s %s", getenv("VISUAL"), file); |
32 |
|
|
33 |
|
remove (file); |
34 |
|
free (file); |
35 |
|
|
36 |
|
/* Mark as read */ |
37 |
|
message_get_attribute (msg, &attr); |
38 |
|
attribute_set_read (attr); |
39 |
|
|
40 |
|
cursor = mspec->msg_part[0]; |
41 |
|
|
42 |
|
return 0; |
43 |
|
} |
44 |
|
|
45 |
int |
int |
46 |
mail_visual (int argc, char **argv) |
mail_visual (int argc, char **argv) |
47 |
{ |
{ |
48 |
if (argc > 1) |
return util_foreach_msg (argc, argv, MSG_NODELETED, visual0, NULL); |
|
return util_msglist_command (mail_visual, argc, argv, 1); |
|
|
else |
|
|
{ |
|
|
message_t msg = NULL; |
|
|
attribute_t attr = NULL; |
|
|
char *file = mu_tempname (NULL); |
|
|
|
|
|
util_do_command ("copy %s", file); |
|
|
util_do_command ("shell %s %s", getenv("VISUAL"), file); |
|
|
|
|
|
remove (file); |
|
|
free (file); |
|
|
|
|
|
/* Mark as read */ |
|
|
mailbox_get_message (mbox, cursor, &msg); |
|
|
message_get_attribute (msg, &attr); |
|
|
attribute_set_read (attr); |
|
|
|
|
|
return 0; |
|
|
} |
|
|
return 1; |
|
49 |
} |
} |
50 |
|
|