21 |
* u[ndelete] [msglist] |
* u[ndelete] [msglist] |
22 |
*/ |
*/ |
23 |
|
|
24 |
|
static int |
25 |
|
undelete0 (msgset_t *mspec, message_t msg, void *data) |
26 |
|
{ |
27 |
|
attribute_t attr; |
28 |
|
|
29 |
|
message_get_attribute (msg, &attr); |
30 |
|
attribute_unset_deleted (attr); |
31 |
|
return 0; |
32 |
|
} |
33 |
|
|
34 |
int |
int |
35 |
mail_undelete (int argc, char **argv) |
mail_undelete (int argc, char **argv) |
36 |
{ |
{ |
37 |
if (argc > 1) |
return util_foreach_msg (argc, argv, MSG_ALL, undelete0, NULL); |
|
return util_msglist_command (mail_undelete, argc, argv, 1); |
|
|
else |
|
|
{ |
|
|
message_t msg; |
|
|
attribute_t attr; |
|
|
if (util_get_message (mbox, cursor, &msg, MSG_ALL)) |
|
|
return 1; |
|
|
|
|
|
message_get_attribute (msg, &attr); |
|
|
if (attribute_is_deleted (attr)) |
|
|
attribute_unset_deleted (attr); |
|
|
return 0; |
|
|
} |
|
|
return 1; |
|
38 |
} |
} |
39 |
|
|