46 const char *table = (
char *) 0;
51 if (!
seed)
return (
char *) 0;
53 strnum[fmt_ulong(strnum,
num)] =
'\0';
55 switch (openreadclose(
"key",&key,32)) {
62 if (byte_diff(hash,
COOKIE,newcookie))
return "";
63 else return (
char *) 0;
72 if (!stralloc_copys(&line,
"SELECT listno FROM "))
return ERR_NOMEM;
73 if (!stralloc_cats(&line,table))
return ERR_NOMEM;
74 if (!stralloc_cats(&line,
"_mlog WHERE listno="))
return ERR_NOMEM;
75 if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,
listno)))
return ERR_NOMEM;
76 if (!stralloc_cats(&line,
" AND msgnum="))
return ERR_NOMEM;
77 if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,
num)))
return ERR_NOMEM;
78 if (!stralloc_cats(&line,
" AND done > 3"))
return ERR_NOMEM;
81 result = PQexec(
pgsql,line.s);
83 return (PQerrorMessage(
pgsql));
84 if (PQresultStatus(result) != PGRES_TUPLES_OK)
85 return (
char *) (PQresultErrorMessage(result));
86 if (PQntuples(result) > 0) {
93 if (!stralloc_copys(&line,
"SELECT msgnum FROM "))
return ERR_NOMEM;
94 if (!stralloc_cats(&line,table))
return ERR_NOMEM;
95 if (!stralloc_cats(&line,
"_cookie WHERE msgnum="))
return ERR_NOMEM;
96 if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,
num)))
return ERR_NOMEM;
97 if (!stralloc_cats(&line,
" and cookie='"))
return ERR_NOMEM;
98 if (!stralloc_catb(&line,strnum,fmt_str(strnum,hash)))
return ERR_NOMEM;
99 if (!stralloc_cats(&line,
"'"))
return ERR_NOMEM;
100 if (!stralloc_0(&line))
return ERR_NOMEM;
102 result = PQexec(
pgsql,line.s);
104 return (PQerrorMessage(
pgsql));
105 if (PQresultStatus(result) != PGRES_TUPLES_OK)
106 return (
char *) (PQresultErrorMessage(result));
107 if(PQntuples(result) < 0) {
const char * loginfo(const char *dir, unsigned long msgnum, unsigned long, unsigned long subs, int done)
void cookie(char *hash, const char *key, unsigned int keylen, const char *date, const char *addr, const char *action)
const char * checktag(const char *dir, unsigned long num, unsigned long listno, const char *action, const char *seed, const char *hash)