Blame view

mail/delete.c 1.36 KB
1
/* GNU Mailutils -- a suite of utilities for electronic mail
2 3
   Copyright (C) 1999, 2001, 2002, 2003, 2005, 
   2007 Free Software Foundation, Inc.
4

5
   GNU Mailutils is free software; you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 3, or (at your option)
8 9
   any later version.

10
   GNU Mailutils is distributed in the hope that it will be useful,
11 12 13 14 15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
16
   along with GNU Mailutils; if not, write to the Free Software
17 18
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
   MA 02110-1301 USA */
19 20 21 22 23 24 25

#include "mail.h"

/*
 * d[elete] [msglist]
 */

26
static int
27
mail_delete_msg (msgset_t *mspec, mu_message_t msg, void *data)
28
{
29
  mu_attribute_t attr;
30

31
  mu_message_get_attribute (msg, &attr);
32
  mu_attribute_set_deleted (attr);
33
  cond_page_invalidate (mspec->msg_part[0]);
34 35
  return 0;
}
36 37 38 39

int
mail_delete (int argc, char **argv)
{
40
  int rc = util_foreach_msg (argc, argv, MSG_NODELETED|MSG_SILENT,
41
			     mail_delete_msg, NULL);
42

Sergey Poznyakoff authored
43
  if (util_getenv (NULL, "autoprint", Mail_env_boolean, 0) == 0)
44
    util_do_command("print");
45

46
  return rc;
47
}
48