ezmlmx 0.68
ezmlmx
Loading...
Searching...
No Matches
subreceipt.c
Go to the documentation of this file.
1#include "subscribe.h"
2#include "str.h"
3#include "logmsg.h"
4#include "fmt.h"
5#include "errtxt.h"
6#include "stralloc.h"
7
8#define WHO "subreceipt"
9
16
17char strnum[FMT_ULONG];
18
19static stralloc line = {0};
20
39
40int subreceipt(char *dir,unsigned long msgnum,stralloc *cookie,char *listaddr,int done,char *info,char *fatal)
41{
42 char *ret = (char *) 0;
43 char *table = (char *) 0;
44 char *sublist = (char *) 0;
45
46 if ((ret = opensql(dir,&table,&sublist))) { /* open sql */
47 if (*ret) logmsg(WHO,111,FATAL,ret); /* no SQL, log to mail log */
48 strnum[fmt_ulong(strnum,msgnum)] = '\0';
49
50 if (cookie->len) { /* there was a tag */
51 if (!stralloc_copy(&line,cookie)) logmsg(WHO,1x(111,ERR_NOMEM);
52 if (!stralloc_0(&line)) logmsg(WHO,111,FATAL,"ERR_NOMEM");
53 if (done == 2)
54 logmsg(WHO,0,INFO,B(listaddr,": receipt: ",strnum,": ",line.s));
55 else
56 logmsg(WHO,0,INFO,B(listaddr,": bounce: ",strnum,": ",line.s));
57 } else {
58 if (done == 2)
59 logmsg(WHO,0,INFO,B(listaddr,": receipt: ",strnum));
60 else
61 logmsg(WHO,0,INFO,B(listaddr,": bounce: ",strnum));
62 }
63
64 return 0;
65} else {
66 if ((ret = checktag(dir,msgnum,cookie))) { /* check tag */
67 if (*ret) logmsg(WHO,111,fatal,ret);
68 return -1; /* no/bad cookie */
69 }
70 if ((ret = getlistno(dir,msgnum,listaddr))) {/* get list no */
71 if (*ret) logmsg(WHO,111,fatal,ret);
72 return -2; /* list not active */
73 }
74 if ((ret = logmsg(dir,msgnum,done))) /* log it */
75 if (*ret) logmsg(WHO,111,fatal,ret);
76 }
77
78 return 0;
79}
80
Error messages. If you translate these, I would urge you to keep the English version as well....
#define ERR_NOMEM
Definition errtxt.h:14
const char * opensql(const char *dir, const char **table)
Definition opensql.c:13
#define WHO
Definition author.c:1
char * dir
void cookie(char *hash, const char *key, unsigned int keylen, const char *date, const char *addr, const char *action)
Definition cookie.c:14
char * getlistno(char *dir, unsigned long msgnum, char *listname)
Definition getlistno.c:13
const char * checktag(const char *dir, unsigned long num, unsigned long listno, const char *action, const char *seed, const char *hash)
Definition checktag.c:27
stralloc listaddr
Definition ezmlm-cron.c:49
stralloc sublist
Definition ezmlm-send.c:113
unsigned long msgnum
const char * logmsg(const char *dir, unsigned long num, unsigned long listno, unsigned long subs, int done)
Definition loginfo.c:32
int subreceipt(char *dir, unsigned long msgnum, stralloc *cookie, char *listaddr, int done, char *info, char *fatal)
Definition subreceipt.c:40