commit 2beb3256b2d087e23519b78cd87b3fb405705d98
parent 24b5d99fda7e3603ae9136e13e241f3f76d48692
Author: Christoph Lohmann <20h@r-36.net>
Date: Tue, 25 Dec 2012 09:49:57 +0100
If dispose is set, do dispose. Simple and easy.
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/remove.c b/remove.c
@@ -30,7 +30,7 @@ removemain(int argc, char *argv[])
config_t *cfg;
imap_t *imap;
int status;
- char *user, *pass, *netspec, *selected, *dispose, *dodispose, *cfgn;
+ char *user, *pass, *netspec, *selected, *dispose, *cfgn;
llist_t *ids;
enum {
@@ -78,7 +78,8 @@ removemain(int argc, char *argv[])
selected = memdup(selected, strlen(selected)+1);
}
dispose = config_getstr(cfg, "dispose");
- dodispose = config_getstr(cfg, "disposedefault");
+ if (dispose != NULL && strlen(dispose) > 0)
+ status |= DODISPOSE;
config_free(cfg);
imap = imap_new(netspec, user, pass);
@@ -99,8 +100,8 @@ removemain(int argc, char *argv[])
} else {
ids = imap_argv2ids(cfgn, selected, argc, argv);
user = imap_ids2str(ids);
- if (status & DODISPOSE || (dodispose && dodispose[0] == '1')) {
- if (dispose == NULL) {
+ if (status & DODISPOSE) {
+ if (dispose == NULL || strlen(dispose) < 1) {
fprintf(stderr, "Could not dispose, because "
"no 'dispose' configuration was "
"given.\n");
@@ -126,8 +127,6 @@ removemain(int argc, char *argv[])
if (dispose != NULL)
free(dispose);
- if (dodispose != NULL)
- free(dodispose);
free(selected);
imap_close(imap);
imap_free(imap);