rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | LICENSE

commit 8720991b7363937ae203386176547a56d18c0151
parent 27d1f714e3a9c562d8fa3fcbb8f27543345f7780
Author: Christoph Lohmann <20h@r-36.net>
Date:   Tue, 27 Nov 2012 14:50:31 +0100

Adding a default dispose option.

Diffstat:
remove.c | 8++++++--
1 file changed, 6 insertions(+), 2 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; + char *user, *pass, *netspec, *selected, *dispose, *dodispose; llist_t *ids; enum { @@ -75,6 +75,7 @@ removemain(int argc, char *argv[]) selected = memdup(selected, strlen(selected)+1); } dispose = config_getstr(cfg, "dispose"); + dodispose = config_getstr(cfg, "disposedefault"); config_free(cfg); imap = imap_new(netspec, user, pass); @@ -95,7 +96,7 @@ removemain(int argc, char *argv[]) } else { ids = imap_argv2ids(selected, argc, argv); user = imap_ids2str(ids); - if (status & DODISPOSE) { + if (status & DODISPOSE || (dodispose && dodispose[0] == '1')) { if (dispose == NULL) { fprintf(stderr, "Could not dispose, because " "no 'dispose' configuration was " @@ -122,9 +123,12 @@ removemain(int argc, char *argv[]) if (dispose != NULL) free(dispose); + if (dodispose != NULL) + free(dodispose); free(selected); imap_close(imap); imap_free(imap); + return 0; }