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 d4ac42e7501be1c72f7136ad42f74f05b71328c9
parent 5c6b6847a6138bbf2c8f814313998f41a5bf19a0
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed,  7 Mar 2012 15:42:21 +0100

Fixing HTML display, rpcomp and the return values.

Diffstat:
bin/rpcomp | 6+++---
bin/rpverify | 4+++-
part.c | 22++++++++++++++--------
view.c | 10++++++----
4 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/bin/rpcomp b/bin/rpcomp @@ -7,16 +7,16 @@ then exit 1 fi -tmpfile=`mktemp` +tmpfile=$(mktemp) signalh() { rm -f $tmpfile } trap 'signalh' 3 6 9 15 -dfolder=`rpcfg -v fold_drafts` +dfolder=$(rpcfg -v fold_drafts) $HOME/.rohrpost/tmpl/compose.sh > $tmpfile -mid=`rpadd -m $dfolder -f seen $tmpfile` +mid=$(rpadd -m $dfolder -f seen $tmpfile) signalh if [ $? -eq 0 ]; diff --git a/bin/rpverify b/bin/rpverify @@ -1,4 +1,6 @@ #!/bin/sh -gpg --verify +msgids="$*" + +rppart -sc text/plain -- "$msgids" | gpg --verify diff --git a/part.c b/part.c @@ -47,7 +47,7 @@ part_print(char *id, mime_t *mime) part_printpart(id, mime); } -void +int part_write(char *id, mime_t *mime, llist_t *partl, char *type, char *filename, int bequiet, int tostdout) { @@ -104,10 +104,13 @@ part_write(char *id, mime_t *mime, llist_t *partl, char *type, if (mime->parts->len > 0) { forllist(mime->parts, part) { - part_write(id, (mime_t *)part->data, partl, type, - filename, bequiet, tostdout); + if (!part_write(id, (mime_t *)part->data, partl, + type, filename, bequiet, tostdout)) + dowrite = 1; } } + + return dowrite; } void @@ -123,7 +126,7 @@ partmain(int argc, char *argv[]) { config_t *cfg; imap_t *imap; - int status, filelen; + int status, filelen, retc; char *user, *pass, *netspec, *selected, *filename, *type, *parts, *filec; llist_t *ids, *msgs, *partl; @@ -140,6 +143,7 @@ partmain(int argc, char *argv[]) NOARGS = 0x20, }; + retc = 1; status = 0; filename = NULL; parts = NULL; @@ -215,15 +219,16 @@ partmain(int argc, char *argv[]) if (status & LISTPARTS) { part_print(NULL, mime); + retc = 0; } else { - part_write(NULL, mime, partl, type, + retc = part_write(NULL, mime, partl, type, filename, status & BEQUIET, status & TOSTDOUT); } mime_free(mime); - return 0; + return retc; } cfg = config_init(); @@ -270,8 +275,9 @@ partmain(int argc, char *argv[]) if (status & LISTPARTS) { part_print((char *)ide->data, mime); + retc = 0; } else { - part_write((char *)ide->data, mime, partl, type, + retc = part_write((char *)ide->data, mime, partl, type, filename, status & BEQUIET, status & TOSTDOUT); } @@ -283,6 +289,6 @@ partmain(int argc, char *argv[]) free(selected); imap_close(imap); imap_free(imap); - return 0; + return retc; } diff --git a/view.c b/view.c @@ -58,16 +58,18 @@ void view_printtexthtml(mime_t *mime) { int infd, outfd, pid, plen; - char *hvalue, *decbuf; + char *hvalue, *decbuf, *lstr; plen = 0; hvalue = mime_decodepartencoding(mime, &plen); if (hvalue == NULL) return; - pid = runcmd("lynx -dump -stdin -nomargins " - "-display_charset=\"utf-8\"", &infd, &outfd, - NULL, 0); + lstr = smprintf("lynx -dump -stdin -nomargins " + "-display_charset=\"utf-8\" " + "-assume_charset=\"%s\"", mime->charset); + pid = runcmd(lstr, &infd, &outfd, NULL, 0); + free(lstr); if (pid < 0) { printf("Could not run lynx.\n"); printf("%s\n", hvalue);