44 const char *
action,
const char *
seed,
const char *hash)
48 const char *table = (
char *) 0;
53 if (!
seed)
return (
char *) 0;
55 strnum[fmt_ulong(strnum,
num)] =
'\0';
57 switch(
slurp(
"key",&key,32)) {
63 if (byte_diff(hash,
COOKIE,newcookie))
return "";
64 else return (
char *) 0;
73 if (!stralloc_copys(&line,
"SELECT listno FROM "))
return ERR_NOMEM;
74 if (!stralloc_cats(&line,table))
return ERR_NOMEM;
75 if (!stralloc_cats(&line,
"_mlog WHERE listno="))
return ERR_NOMEM;
76 if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,
listno)))
return ERR_NOMEM;
77 if (!stralloc_cats(&line,
" AND msgnum="))
return ERR_NOMEM;
78 if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,
num)))
return ERR_NOMEM;
79 if (!stralloc_cats(&line,
" AND done > 3"))
return ERR_NOMEM;
80 if (mysql_real_query(
mysql,line.s,line.len) != 0)
81 return mysql_error(
mysql);
83 if (!(result = mysql_use_result(
mysql)))
84 return mysql_error(
mysql);
86 return mysql_error(
mysql);
88 if ((row = mysql_fetch_row(result)))
91 if (!mysql_eof(result))
92 return mysql_error(
mysql);
94 mysql_free_result(result);
97 if (!stralloc_copys(&line,
"SELECT msgnum FROM "))
return ERR_NOMEM;
98 if (!stralloc_cats(&line,table))
return ERR_NOMEM;
99 if (!stralloc_cats(&line,
"_cookie WHERE msgnum="))
return ERR_NOMEM;
100 if (!stralloc_catb(&line,strnum,fmt_ulong(strnum,
num)))
return ERR_NOMEM;
101 if (!stralloc_cats(&line,
" and cookie='"))
return ERR_NOMEM;
105 if (!stralloc_cats(&line,
"'"))
return ERR_NOMEM;
107 if (mysql_real_query(
mysql,line.s,line.len) != 0)
108 return mysql_error(
mysql);
110 if (!(result = mysql_use_result(
mysql)))
111 return mysql_error(
mysql);
113 if (!mysql_fetch_row(result)) {
114 if (!mysql_eof(result))
115 return mysql_error(
mysql);
116 mysql_free_result(result);
119 mysql_free_result(result);
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)