]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/database/chanservdb.c
TRUSTS: require sqlite
[irc/quakenet/newserv.git] / chanserv / database / chanservdb.c
index 9aebdbc4cd49d52e509959d521118704b7e0e65f..d977b0deccd13e1af17299151fdd0b1c8e44c69b 100644 (file)
 #include "../../core/nsmalloc.h"
 #include "../../lib/strlfunc.h"
 #include "../../dbapi/dbapi.h"
+#include "../../lib/version.h"
 
 #include <string.h>
 #include <stdio.h>
 #include <sys/poll.h>
 #include <stdarg.h>
 
+MODULE_VERSION(QVERSION);
+
 int chanservdb_ready;
 
 regchan **allchans;
@@ -88,6 +91,7 @@ static void setuptables() {
                "suspendreason VARCHAR(250),"
                "comment       VARCHAR(250),"
                "info          VARCHAR(100),"
+               "lastpasschng  INT               NOT NULL,"
                "PRIMARY KEY (ID))");
 
   dbcreatequery("CREATE INDEX user_username_index ON chanserv.users (username)");
@@ -232,8 +236,7 @@ void _init() {
   chanservext=registerchanext("chanserv");
   chanservaext=registerauthnameext("chanserv",1);
 
-  /* Set up the allocators and hashes */
-  chanservallocinit();
+  /* Set up the hashes */
   chanservhashinit();
 
   /* And the messages */
@@ -302,7 +305,7 @@ void loadsomeusers(DBConn *dbconn, void *arg) {
     return;
   }
 
-  if (dbnumfields(pgres)!=18) {
+  if (dbnumfields(pgres)!=19) {
     Error("chanserv",ERR_ERROR,"User DB format error");
     return;
   }
@@ -343,6 +346,7 @@ void loadsomeusers(DBConn *dbconn, void *arg) {
     rup->suspendreason=getsstring(dbgetvalue(pgres,15),250);
     rup->comment=getsstring(dbgetvalue(pgres,16),250);
     rup->info=getsstring(dbgetvalue(pgres,17),100);
+    rup->lastpasschange=strtoul(dbgetvalue(pgres,18),NULL,10);
     rup->knownon=NULL;
     rup->checkshd=NULL;
     rup->stealcount=0;
@@ -529,7 +533,7 @@ void loadsomechanbans(DBConn *dbconn, void *arg) {
   regban  *rbp;
   regchan *rcp;
   int uid,cid,bid;
-  time_t expiry,now;
+  time_t expiry;
   int total=0;
 
   pgres=dbgetresult(dbconn);
@@ -544,8 +548,6 @@ void loadsomechanbans(DBConn *dbconn, void *arg) {
     return;
   }
 
-  now=time(NULL);
-
   while(dbfetchrow(pgres)) {
     bid=strtoul(dbgetvalue(pgres,0),NULL,10);
     cid=strtoul(dbgetvalue(pgres,1),NULL,10);