Re: qconfirm: manual confirmation-only mode?
[email protected] (C. Fischer)
| Newsgroups | gmane.comp.misc.pape.general |
|---|---|
| Message-ID | <[email protected]> |
* C. Fischer:
> * 2005-02-19 Gerrit Pape:
>> Look for 'inject_qconfirm_msg' in src/qconfirm-check.c.
>
> thanks for the hint!
dear gerrit,
although i much appreciate the apparent workings of your code, i fail to
understand it. this said, would you kindly have a look at the following,
especially the "invariants" at the top:
%%%
--- qconfirm-check.c Tue Feb 22 16:48:20 2005
+++ src/qconfirm-check.c Tue Feb 22 17:46:33 2005
@@ -27,7 +27,8 @@
#include "getline.h"
#include "seek.h"
-#define USAGE " [-mnbD] [-d dir ] [-i bytes ] [-t sec ] [prog]"
+// -ino: 20050222-1651
+#define USAGE " [-MmnbD] [-d dir ] [-i bytes ] [-t sec ] [prog]"
#define VERSION "$Id: qconfirm-check.c,v 1.55 2004/12/12 16:52:22 pape Exp $"
#define FATAL "qconfirm-check: fatal: "
#define WARNING "qconfirm-check: warning: "
@@ -36,6 +37,7 @@
#define MODE_SENDER 0
#define MODE_INODE 1
+#define MODE_MANUAL 2
const char *progname;
@@ -84,6 +86,11 @@
struct stat msg_st;
int fdmsg;
+// -ino: 20050222-1651
+// invariant: extension==0 && mid==0 && fd==fd: ack,
+// extension==0 && mid==0 && fd==-1: manual ack,
+// extension!=0 && mid==0 && fd==0: remind,
+// extension!=0 && mid!=0 && fd==0: req
int inject_qconfirm_msg (int fd_msg, char *extension, char *mid, int fd) {
buffer b;
buffer m;
@@ -93,6 +100,10 @@
int r;
int c;
+ if (mode == MODE_MANUAL && !fd) {
+ return(1);
+ }
+
if (open_qmail_inject(&fd_inj, sender) == -1) {close(fd_msg); return(-1); }
buffer_init(&b, buffer_unixwrite, fd_inj, b_space, sizeof b_space);
buffer_init(&m, buffer_unixread, fd_msg, m_space, sizeof m_space);
@@ -263,8 +274,10 @@
qconfirm_dir =env_get("QCONFIRM_DIR");
- while ((opt =getopt(argc, argv, "Vmnbd:Di:t:")) != opteof) {
+ // -ino: 20050222-1651
+ while ((opt =getopt(argc, argv, "MVmnbd:Di:t:")) != opteof) {
switch(opt) {
+ case 'M': mode =MODE_MANUAL; break;
case 'm': mode =MODE_INODE; break;
case 'n': ack =0; break;
case 'b': badmailfrom =1; break;
%%%
since "qconfirm" is vital to my email experience, i don't dare to put it into
production yet, much less test it before your advice arrived :) but maybe
there's a way to test all this without disturbing my peace? if this turns out
to be working, i'll also add to the documentation, of course.
clemens