From: Chris Porter Date: Tue, 11 Mar 2008 01:58:53 +0000 (+0000) Subject: Attempt to import clean unloading wrt. pqsql into Q9. X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/b3565978650ac8b1ccbc8aa0f6419837b4d8f6d4 Attempt to import clean unloading wrt. pqsql into Q9. --- diff --git a/chanserv/authcmds/Makefile b/chanserv/authcmds/Makefile index acedb2ad..ea4863a8 100644 --- a/chanserv/authcmds/Makefile +++ b/chanserv/authcmds/Makefile @@ -6,5 +6,5 @@ all: Makefile chanserv_authcmds.so Makefile: ../mkcommandlist.pl chanserv_authcmds.so -chanserv_authcmds.so: auth.o authhistory.o challenge.o challengeauth.o checkhashpass.o email.o getpassword.o hello.o login.o newpass.o requestpassword.o reset.o sendpassword.o setemail.o setpassword.o commandlist.o +chanserv_authcmds.so: auth.o authhistory.o challenge.o challengeauth.o checkhashpass.o email.o getpassword.o hello.o login.o newpass.o requestpassword.o reset.o sendpassword.o setemail.o setpassword.o commandlist.o init.o ld -shared -Bdynamic -o $@ $^ diff --git a/chanserv/authcmds/authhistory.c b/chanserv/authcmds/authhistory.c index e8c09d5e..13e14983 100644 --- a/chanserv/authcmds/authhistory.c +++ b/chanserv/authcmds/authhistory.c @@ -37,6 +37,11 @@ void csdb_doauthhistory_real(PGconn *dbconn, void *arg) { struct tm *tmp; char tbuf1[15], tbuf2[15], uhbuf[51]; + if(!dbconn) { + free(ahi); + return; + } + pgres=PQgetResult(dbconn); if (PQresultStatus(pgres) != PGRES_TUPLES_OK) { @@ -98,7 +103,7 @@ void csdb_retreiveauthhistory(nick *np, reguser *rup, int limit) { ahi=(struct authhistoryinfo *)malloc(sizeof(struct authhistoryinfo)); ahi->numeric=np->numeric; ahi->userID=rup->ID; - pqasyncquery(csdb_doauthhistory_real, (void *)ahi, + q9a_asyncquery(csdb_doauthhistory_real, (void *)ahi, "SELECT userID, nick, username, host, authtime, disconnecttime, quitreason from authhistory where " "userID=%u order by authtime desc limit %d", rup->ID, limit); } diff --git a/chanserv/authcmds/commandlist.c b/chanserv/authcmds/commandlist.c index 259c848b..6b105b08 100644 --- a/chanserv/authcmds/commandlist.c +++ b/chanserv/authcmds/commandlist.c @@ -18,8 +18,12 @@ int csa_doreset(void *source, int cargc, char **cargv); int csa_dosendpw(void *source, int cargc, char **cargv); int csa_dosetmail(void *source, int cargc, char **cargv); int csa_dosetpw(void *source, int cargc, char **cargv); +void authcmds_init(void); +void authcmds_fini(void); + void _init() { + authcmds_init(); chanservaddcommand("auth", QCMD_SECURE | QCMD_NOTAUTHED, 2, csa_doauth, "Authenticates you on the bot.", "Usage: AUTH \nAuthenticates you on the bot, where:\nusername - your username\npassword - your password\nIf you do not have a username and password, see HELLO.\nNote: due to the sensitive nature of this command, you must send the message\nto Q@CServe.quakenet.org when using it.\nNote: the preferred way to authenticate is to use the /AUTH command.\n"); chanservaddcommand("authhistory", QCMD_AUTHED, 1, csa_doauthhistory, "View auth history for an account.", "Usage: AUTHHISTORY\nDisplays details of the last 10 logins with your account. Details include\nhostmask, login time, disconnect time and reason.\n"); chanservaddcommand("challenge", QCMD_SECURE | QCMD_NOTAUTHED, 0, csa_dochallenge, "Returns a challenge for use in challengeauth.", "Usage: challenge\nSupplies you with a challenge and a list of algorithms accepted\nfor challenge response authentication, see CHALLENGEAUTH help\nfor more details.\n"); @@ -38,6 +42,7 @@ void _init() { } void _fini() { + authcmds_fini(); chanservremovecommand("auth", csa_doauth); chanservremovecommand("authhistory", csa_doauthhistory); chanservremovecommand("challenge", csa_dochallenge); diff --git a/chanserv/authcmds/init.c b/chanserv/authcmds/init.c new file mode 100644 index 00000000..a98de09d --- /dev/null +++ b/chanserv/authcmds/init.c @@ -0,0 +1,11 @@ +#include "../../pqsql/pqsql.h" + +PQModuleIdentifier q9apqid; + +void authcmds_init(void) { + q9apqid = pqgetid(); +} + +void authcmds_fini(void) { + pqfreeid(q9apqid); +} diff --git a/chanserv/authtracker/authtracker.c b/chanserv/authtracker/authtracker.c index 574e7c8f..a8d1f378 100644 --- a/chanserv/authtracker/authtracker.c +++ b/chanserv/authtracker/authtracker.c @@ -6,14 +6,19 @@ #include "../../core/error.h" void at_newnick(int, void *); +PQModuleIdentifier authtrackerpq; void _init() { + authtrackerpq = pqgetid(); + at_finddanglingsessions(); } void _fini() { at_hookfini(); nsfreeall(POOL_AUTHTRACKER); + + pqfreeid(authtrackerpq); } void at_dbloaded(int hooknum, void *arg) { diff --git a/chanserv/authtracker/authtracker.h b/chanserv/authtracker/authtracker.h index 2d466595..9f2b2c1f 100644 --- a/chanserv/authtracker/authtracker.h +++ b/chanserv/authtracker/authtracker.h @@ -2,9 +2,12 @@ #define AUTHTRACKER_H #include "../../nick/nick.h" +#include "../../pqsql/pqsql.h" #include +extern PQModuleIdentifier authtrackerpq; + #define AT_NETSPLIT 0 /* User lost in netsplit */ #define AT_RESTART 1 /* Dangling session found at restart */ diff --git a/chanserv/authtracker/authtracker_query.c b/chanserv/authtracker/authtracker_query.c index e4234417..cc492cd4 100644 --- a/chanserv/authtracker/authtracker_query.c +++ b/chanserv/authtracker/authtracker_query.c @@ -39,7 +39,10 @@ void at_lognewsession(unsigned int userid, nick *np) { static void real_at_finddanglingsessions(PGconn *dbconn, void *arg) { PGresult *pgres; unsigned int i,num; - + + if(!dbconn) + return; + pgres=PQgetResult(dbconn); if (PQresultStatus(pgres) != PGRES_TUPLES_OK) { @@ -49,6 +52,7 @@ static void real_at_finddanglingsessions(PGconn *dbconn, void *arg) { if (PQnfields(pgres)!=3) { Error("authtracker",ERR_ERROR,"Dangling sessions format error"); + PQclear(pgres); return; } @@ -70,7 +74,7 @@ static void real_at_finddanglingsessions(PGconn *dbconn, void *arg) { } void at_finddanglingsessions() { - pqasyncquery(real_at_finddanglingsessions, NULL, + pqasyncqueryi(authtrackerpq, real_at_finddanglingsessions, NULL, "SELECT numeric,userID,authtime FROM authhistory WHERE disconnecttime=0"); } diff --git a/chanserv/chancmds/Makefile b/chanserv/chancmds/Makefile index 868eec7d..9fcfa60f 100644 --- a/chanserv/chancmds/Makefile +++ b/chanserv/chancmds/Makefile @@ -6,5 +6,5 @@ all: Makefile chanserv_chancmds.so Makefile: ../mkcommandlist.pl chanserv_chancmds.so -chanserv_chancmds.so: addchan.o adduser.o autolimit.o ban.o banclear.o bandel.o banlist.o bantimer.o chanflags.o chanlev.o chanlevhistory.o chanmode.o channelcomment.o chanophistory.o chanstat.o chantype.o clearchan.o delchan.o deopall.o devoiceall.o giveowner.o invite.o op.o permban.o recover.o rejoin.o removeuser.o renchan.o requestowner.o rollbackchan.o settopic.o suspendchan.o suspendchanlist.o tempban.o unban.o unbanall.o unbanmask.o unbanme.o unsuspendchan.o voice.o welcome.o commandlist.o +chanserv_chancmds.so: addchan.o adduser.o autolimit.o ban.o banclear.o bandel.o banlist.o bantimer.o chanflags.o chanlev.o chanlevhistory.o chanmode.o channelcomment.o chanophistory.o chanstat.o chantype.o clearchan.o delchan.o deopall.o devoiceall.o giveowner.o invite.o op.o permban.o recover.o rejoin.o removeuser.o renchan.o requestowner.o rollbackchan.o settopic.o suspendchan.o suspendchanlist.o tempban.o unban.o unbanall.o unbanmask.o unbanme.o unsuspendchan.o voice.o welcome.o commandlist.o init.o ld -shared -Bdynamic -o $@ $^ diff --git a/chanserv/chancmds/chanlevhistory.c b/chanserv/chancmds/chanlevhistory.c index 1f28ab3d..0694c41d 100644 --- a/chanserv/chancmds/chanlevhistory.c +++ b/chanserv/chancmds/chanlevhistory.c @@ -34,6 +34,11 @@ void csdb_dochanlevhistory_real(PGconn *dbconn, void *arg) { struct tm *tmp; char tbuf[15], fbuf[18]; + if(!dbconn) { + PQclear(pgres); + return; + } + pgres=PQgetResult(dbconn); if (PQresultStatus(pgres) != PGRES_TUPLES_OK) { @@ -81,7 +86,7 @@ void csdb_dochanlevhistory_real(PGconn *dbconn, void *arg) { } void csdb_retreivechanlevhistory(nick *np, regchan *rcp, time_t starttime) { - pqasyncquery(csdb_dochanlevhistory_real, (void *)np->numeric, + q9c_asyncquery(csdb_dochanlevhistory_real, (void *)np->numeric, "SELECT userID, channelID, targetID, changetime, authtime, oldflags, newflags from chanlevhistory where " "channelID=%u and changetime>%lu order by changetime desc limit 1000", rcp->ID, starttime); } diff --git a/chanserv/chancmds/commandlist.c b/chanserv/chancmds/commandlist.c index 1db43b55..6329e641 100644 --- a/chanserv/chancmds/commandlist.c +++ b/chanserv/chancmds/commandlist.c @@ -44,8 +44,12 @@ int csc_dounbanme(void *source, int cargc, char **cargv); int csc_dounsuspendchan(void *source, int cargc, char **cargv); int csc_dovoice(void *source, int cargc, char **cargv); int csc_dowelcome(void *source, int cargc, char **cargv); +void chancmds_init(void); +void chancmds_fini(void); + void _init() { + chancmds_init(); chanservaddcommand("addchan", QCMD_OPER, 4, csc_doaddchan, "Adds a new channel to the bot.", "Usage: addchan [ [ []]]\nAdds the given channel to the bot, where:\nowner - can be either nickname on the network or #authname. If not supplied,\n the channel will belong to the user issuing the ADDCHAN command.\nflags - can be any valid chanflags (see CHANFLAGS). If not specified this \n defaults to +j.\ntype - is a channel type as per old Q and is now obsolete.\n"); chanservaddcommand("adduser", QCMD_AUTHED, 20, csc_doadduser, "Adds one or more users to a channel as +aot.", "Usage: ADDUSER [] [ [ [...]]]\nAdds the named user(s) to the channel, where:\nchannel - the channel to use\nflags - the list of flags to add for each user, introduced by + (for example\n +gv). See CHANLEV for valid flags. If no flags are specified, \n +aot is used. This command cannot be used to add masters (+m) or\n owners (+n).\nuser - either a user's current nickname on the network or #accountname. Up to\n 18 users can be specified.\nADDUSER requires master (+m) access on the named channel.\n"); chanservaddcommand("autolimit", QCMD_AUTHED, 2, csc_doautolimit, "Shows or changes the autolimit threshold on a channel.", "Usage: AUTOLIMIT []\nThe autolimit feature maintains a user limit (+l) on the channel which is\nregularly updated to keep a fixed number of spaces free on the channel for\npeople to join. This is useful since it prevents a large number of \"clones\"\njoining at the same time. However, if the number of free spaces is too small\nit's possible that legitimate users won't be able to join. This command allows\nyou to adjust the number of free spaces to maintain when autolimit is enabled. \nTo actually turn the autolimit feature on or off, see CHANFLAGS. Where:\nchannel - the channel to use.\nthreshold - specifies the new threshold. If not specified, the current threshold \n is displayed.\nViewing the current threshold requires operator (+o) access on the named channel.\nUpdating the threshold requires master (+m) access on the named channel.\n"); @@ -90,6 +94,7 @@ void _init() { } void _fini() { + chancmds_fini(); chanservremovecommand("addchan", csc_doaddchan); chanservremovecommand("adduser", csc_doadduser); chanservremovecommand("autolimit", csc_doautolimit); diff --git a/chanserv/chancmds/init.c b/chanserv/chancmds/init.c new file mode 100644 index 00000000..c5d4d56a --- /dev/null +++ b/chanserv/chancmds/init.c @@ -0,0 +1,12 @@ +#include "../../pqsql/pqsql.h" + +PQModuleIdentifier q9cpqid; + +void chancmds_init(void) { + q9cpqid = pqgetid(); +} + +void chancmds_fini(void) { + pqfreeid(q9cpqid); +} + diff --git a/chanserv/chancmds/rollbackchan.c b/chanserv/chancmds/rollbackchan.c index 3452cbd7..21428994 100644 --- a/chanserv/chancmds/rollbackchan.c +++ b/chanserv/chancmds/rollbackchan.c @@ -36,6 +36,9 @@ void csc_dorollbackchan_real(PGconn *dbconn, void *arg) { int i, j, num, newuser; char fbuf[18]; + if(!dbconn) + return; + pgres=PQgetResult(dbconn); if (PQresultStatus(pgres) != PGRES_TUPLES_OK) { @@ -155,11 +158,11 @@ void csc_dorollbackchan_real(PGconn *dbconn, void *arg) { void csdb_rollbackchanlevhistory(nick *np, regchan *rcp, reguser* rup, time_t starttime) { if (rup) - pqasyncquery(csc_dorollbackchan_real, (void *)np->numeric, + q9c_asyncquery(csc_dorollbackchan_real, (void *)np->numeric, "SELECT userID, channelID, targetID, changetime, authtime, oldflags, newflags from chanlevhistory where " "userID=%u and channelID=%u and changetime>%lu order by changetime desc limit 1000", rup->ID, rcp->ID, starttime); else - pqasyncquery(csc_dorollbackchan_real, (void *)np->numeric, + q9c_asyncquery(csc_dorollbackchan_real, (void *)np->numeric, "SELECT userID, channelID, targetID, changetime, authtime, oldflags, newflags from chanlevhistory where " "channelID=%u and changetime>%lu order by changetime desc limit 1000", rcp->ID, starttime); } diff --git a/chanserv/chanserv.c b/chanserv/chanserv.c index 1a56dbdf..4d8b0971 100644 --- a/chanserv/chanserv.c +++ b/chanserv/chanserv.c @@ -78,6 +78,8 @@ const flag mdflags[] = { void chanservfreestuff(); void chanservfinishinit(int hooknum, void *arg); +PQModuleIdentifier q9pqid; + void chanservdumpstuff(void *arg) { dumplastjoindata("lastjoin.dump"); } @@ -89,6 +91,8 @@ void _init() { chanservcryptoinit(); csa_initregex(); + q9pqid = pqgetid(); + if (chanservext!=-1 && chanservnext!=-1 && chanservaext!=-1) { /* Set up the chantypes */ chantypes=(sstring **)malloc(CHANTYPES*sizeof(sstring *)); @@ -171,6 +175,8 @@ void chanserv_finalinit() { } void _fini() { + pqfreeid(q9pqid); + deleteallschedules(cs_timerfunc); deleteallschedules(chanservreguser); deleteallschedules(chanservdumpstuff); diff --git a/chanserv/chanserv.h b/chanserv/chanserv.h index 388143dc..936a3766 100644 --- a/chanserv/chanserv.h +++ b/chanserv/chanserv.h @@ -17,6 +17,7 @@ #include "../channel/channel.h" #include "../parser/parser.h" #include "../localuser/localuserchannel.h" +#include "../pqsql/pqsql.h" #define CS_PARANOID @@ -808,6 +809,7 @@ extern unsigned int lastmaillockID; extern int chanserv_init_status; extern int chanservdb_ready; +extern PQModuleIdentifier q9pqid, q9apqid, q9cpqid, q9upqid; extern maildomain *maildomainnametable[MAILDOMAINHASHSIZE]; extern maildomain *maildomainIDtable[MAILDOMAINHASHSIZE]; @@ -911,6 +913,11 @@ char *csdb_gethelpstr(char *command, int language); void csdb_createmail(reguser *rup, int type); void csdb_dohelp(nick *np, Command *cmd); +#define q9asyncquery(handler, tag, format, ...) pqasyncqueryi(q9pqid, handler, tag, format , ##__VA_ARGS__) +#define q9a_asyncquery(handler, tag, format, ...) pqasyncqueryi(q9apqid, handler, tag, format , ##__VA_ARGS__) +#define q9u_asyncquery(handler, tag, format, ...) pqasyncqueryi(q9upqid, handler, tag, format , ##__VA_ARGS__) +#define q9c_asyncquery(handler, tag, format, ...) pqasyncqueryi(q9cpqid, handler, tag, format , ##__VA_ARGS__) + /* chanservcrypto.c */ typedef int (*CRAlgorithm)(char *, const char *, const char *, const char *); void chanservcryptoinit(void); diff --git a/chanserv/chanservstdcmds.c b/chanserv/chanservstdcmds.c index b09f302c..58fdcd99 100644 --- a/chanserv/chanservstdcmds.c +++ b/chanserv/chanservstdcmds.c @@ -227,7 +227,7 @@ void csdb_dohelp(nick *np, Command *cmd) { hip->commandname=getsstring(cmd->command->content, cmd->command->length); hip->cmd=cmd; - pqasyncquery(csdb_dohelp_real, (void *)hip, + q9asyncquery(csdb_dohelp_real, (void *)hip, "SELECT languageID, fullinfo from help where lower(command)=lower('%s')",cmd->command->content); } @@ -239,6 +239,12 @@ void csdb_dohelp_real(PGconn *dbconn, void *arg) { PGresult *pgres; int i,j,num,lang=0; + if(!dbconn) { + freesstring(hip->commandname); + free(hip); + return; + } + pgres=PQgetResult(dbconn); if (PQresultStatus(pgres) != PGRES_TUPLES_OK) { diff --git a/chanserv/mkcommandlist.pl b/chanserv/mkcommandlist.pl index 224ded30..c57d19e8 100755 --- a/chanserv/mkcommandlist.pl +++ b/chanserv/mkcommandlist.pl @@ -22,8 +22,14 @@ unless (@ARGV) { $modname=$ARGV[0]; } +my $smallname; +$smallname=$modname; +$smallname=~s/^chanserv_//; +$smallname=~s/\.so$//; + for (@filelist) { next if (/commandlist.c/); + next if (/init.c/); my $fname = $_; my ($cn, $cl, $ca, $cd, $cf, $cp, $ch); @@ -99,7 +105,11 @@ foreach (@protos) { my @names2 = @cmdnames; my @func2 = @cmdfunc; +print CL "void ".$smallname."_init(void);\n"; +print CL "void ".$smallname."_fini(void);\n\n"; + print CL "\nvoid _init() {\n"; +print CL " ".$smallname."_init();\n"; while (my $cn = shift @cmdnames) { print CL " chanservaddcommand(\"".$cn."\", ".(shift @cmdlevels).", ".(shift @cmdargs).", "; @@ -107,6 +117,7 @@ while (my $cn = shift @cmdnames) { } print CL "}\n\nvoid _fini() {\n"; +print CL " ".$smallname."_fini();\n"; while (my $cn = shift @names2) { print CL " chanservremovecommand(\"".$cn."\", ".(shift @func2).");\n"; @@ -130,6 +141,7 @@ print MF "\t../mkcommandlist.pl $modname\n"; print MF "\n$modname: "; push @files,"commandlist.c"; +push @files,"init.c"; foreach (@files) { s/.c$/.o/; diff --git a/chanserv/usercmds/Makefile b/chanserv/usercmds/Makefile index c524172d..26d8ab38 100644 --- a/chanserv/usercmds/Makefile +++ b/chanserv/usercmds/Makefile @@ -6,5 +6,5 @@ all: Makefile chanserv_usercmds.so Makefile: ../mkcommandlist.pl chanserv_usercmds.so -chanserv_usercmds.so: accounthistory.o cleanupdb.o deluser.o domainmode.o info.o language.o listflags.o maillock.o rollbackaccount.o spewdb.o spewdomain.o spewemail.o spewpass.o suspenduser.o suspenduserlist.o unsuspenduser.o usercomment.o userflags.o whoami.o whois.o commandlist.o +chanserv_usercmds.so: accounthistory.o cleanupdb.o deluser.o domainmode.o info.o language.o listflags.o maillock.o rollbackaccount.o spewdb.o spewdomain.o spewemail.o spewpass.o suspenduser.o suspenduserlist.o unsuspenduser.o usercomment.o userflags.o whoami.o whois.o commandlist.o init.o ld -shared -Bdynamic -o $@ $^ diff --git a/chanserv/usercmds/accounthistory.c b/chanserv/usercmds/accounthistory.c index e20ee8ca..7ad54181 100644 --- a/chanserv/usercmds/accounthistory.c +++ b/chanserv/usercmds/accounthistory.c @@ -30,6 +30,9 @@ void csdb_doaccounthistory_real(PGconn *dbconn, void *arg) { struct tm *tmp; char tbuf[15]; + if(!dbconn) + return; + pgres=PQgetResult(dbconn); if (PQresultStatus(pgres) != PGRES_TUPLES_OK) { @@ -75,7 +78,7 @@ void csdb_doaccounthistory_real(PGconn *dbconn, void *arg) { } void csdb_retreiveaccounthistory(nick *np, reguser *rup, int limit) { - pqasyncquery(csdb_doaccounthistory_real, (void *)np->numeric, + q9u_asyncquery(csdb_doaccounthistory_real, (void *)np->numeric, "SELECT userID, changetime, authtime, oldpassword, newpassword, oldemail, newemail from accounthistory where " "userID=%u order by changetime desc limit %d", rup->ID, limit); } diff --git a/chanserv/usercmds/commandlist.c b/chanserv/usercmds/commandlist.c index 0bd1147c..b1fc1f49 100644 --- a/chanserv/usercmds/commandlist.c +++ b/chanserv/usercmds/commandlist.c @@ -23,8 +23,12 @@ int csu_dousercomment(void *source, int cargc, char **cargv); int csu_douserflags(void *source, int cargc, char **cargv); int csu_dowhoami(void *source, int cargc, char **cargv); int csu_dowhois(void *source, int cargc, char **cargv); +void usercmds_init(void); +void usercmds_fini(void); + void _init() { + usercmds_init(); chanservaddcommand("accounthistory", QCMD_OPER, 1, csa_doaccounthistory, "View password/email history for an account.", "Usage: accounthistory \nShows password/email history for the specified account.\n"); chanservaddcommand("cleanupdb", QCMD_DEV, 0, csu_docleanupdb, "Clean up database.", "Usage: cleanupdb\nRemoves unused and never used accounts that exceed the idleness\nthresholds.\n"); chanservaddcommand("deluser", QCMD_OPER, 2, csu_dodeluser, "Removes a user from the bot.", "Usage: deluser \nRemoves the specified username from the bot.\n"); @@ -48,6 +52,7 @@ void _init() { } void _fini() { + usercmds_fini(); chanservremovecommand("accounthistory", csa_doaccounthistory); chanservremovecommand("cleanupdb", csu_docleanupdb); chanservremovecommand("deluser", csu_dodeluser); diff --git a/chanserv/usercmds/init.c b/chanserv/usercmds/init.c new file mode 100644 index 00000000..f53c9fd1 --- /dev/null +++ b/chanserv/usercmds/init.c @@ -0,0 +1,12 @@ +#include "../../pqsql/pqsql.h" + +PQModuleIdentifier q9upqid; + +void usercmds_init(void) { + q9upqid = pqgetid(); +} + +void usercmds_fini(void) { + pqfreeid(q9upqid); +} + diff --git a/chanserv/usercmds/rollbackaccount.c b/chanserv/usercmds/rollbackaccount.c index 3cf44c23..b903f9da 100644 --- a/chanserv/usercmds/rollbackaccount.c +++ b/chanserv/usercmds/rollbackaccount.c @@ -26,6 +26,9 @@ void csdb_dorollbackaccount_real(PGconn *dbconn, void *arg) { PGresult *pgres; int i, num; + if(!dbconn) + return; + pgres=PQgetResult(dbconn); if (PQresultStatus(pgres) != PGRES_TUPLES_OK) { @@ -80,7 +83,7 @@ void csdb_dorollbackaccount_real(PGconn *dbconn, void *arg) { } void csdb_rollbackaccounthistory(nick *np, reguser* rup, time_t starttime) { - pqasyncquery(csdb_dorollbackaccount_real, (void *)np->numeric, + q9u_asyncquery(csdb_dorollbackaccount_real, (void *)np->numeric, "SELECT userID, changetime, authtime, oldpassword, newpassword, oldemail, newemail from accounthistory where " "userID=%u and changetime>%lu order by changetime desc limit 10", rup->ID, starttime); }