From aed384169af5204b8002d06e7a22f89197963d2d Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Fri, 23 Mar 2012 15:01:34 +0100 Subject: [PATCH] forw,repl: Replaced internal annotate() call with invokation of anno(1). --- uip/Makefile.in | 8 ++++---- uip/forw.c | 20 ++++++++++++++------ uip/repl.c | 10 +++++++--- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/uip/Makefile.in b/uip/Makefile.in index a2500cc..2eabf62 100644 --- a/uip/Makefile.in +++ b/uip/Makefile.in @@ -120,8 +120,8 @@ fmtdump: fmtdump.o $(LOCALLIBS) folder: folder.o $(LOCALLIBS) $(LINK) folder.o $(LINKLIBS) -forw: forw.o whatnowproc.o annosbr.o $(LOCALLIBS) - $(LINK) forw.o whatnowproc.o annosbr.o $(LINKLIBS) +forw: forw.o whatnowproc.o $(LOCALLIBS) + $(LINK) forw.o whatnowproc.o $(LINKLIBS) inc: inc.o scansbr.o termsbr.o $(LOCALLIBS) $(LINK) inc.o scansbr.o termsbr.o $(LINKLIBS) $(TERMLIB) @@ -191,8 +191,8 @@ rcvstore: rcvstore.o $(LOCALLIBS) refile: refile.o $(LOCALLIBS) $(LINK) refile.o $(LINKLIBS) -repl: repl.o whatnowproc.o annosbr.o $(LOCALLIBS) - $(LINK) repl.o whatnowproc.o annosbr.o $(LINKLIBS) +repl: repl.o whatnowproc.o $(LOCALLIBS) + $(LINK) repl.o whatnowproc.o $(LINKLIBS) rmf: rmf.o $(LOCALLIBS) $(LINK) rmf.o $(LINKLIBS) diff --git a/uip/forw.c b/uip/forw.c index 8992b33..e79e395 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -278,17 +278,25 @@ add_forw_hdr(char *draft) int msgnum; char buffer[BUFSIZ]; - snprintf(buffer, sizeof(buffer), "+%s", mp->foldpath); + snprintf(buffer, sizeof buffer, "anno -append -nodate '%s' " + "-comp '%s' -text '+%s", + draft, attach_hdr, mp->foldpath); for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { if (!is_selected(mp, msgnum)) { continue; } - /* TODO: improve the code */ - strncat(buffer, " ", sizeof(buffer)-strlen(buffer)-1); - strncat(buffer, m_name(msgnum), - sizeof(buffer)-strlen(buffer)-1); + /* TODO: Check for buffer length! */ + strcat(buffer, " "); + strcat(buffer, m_name(msgnum)); + } + strcat(buffer, "'"); + /* TODO: This check is bad, but better than nothing */ + if (strlen(buffer) > BUFSIZ) { + adios(NULL, "Too long attachment header line. Forward less messages."); + } + if (system(buffer) != 0) { + advise(NULL, "unable to add attachment header"); } - annotate(draft, attach_hdr, buffer, 0, -2, 1, 0); } diff --git a/uip/repl.c b/uip/repl.c index 3cba512..be4eb40 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -594,9 +594,13 @@ finished: /* add an attachment header */ char buffer[BUFSIZ]; - snprintf(buffer, sizeof buffer, "+%s %s", - mp->foldpath, m_name(mp->lowsel)); - annotate(drft, attach_hdr, buffer, 0, -2, 1, 0); + snprintf(buffer, sizeof buffer, "anno -append -nodate '%s' " + "-comp '%s' -text '+%s %s'", + drft, + attach_hdr, mp->foldpath, m_name(mp->lowsel)); + if (system(buffer) != 0) { + advise(NULL, "unable to add attachment header"); + } } /* return dynamically allocated buffers */ -- 1.7.10.4