]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Readd lockuntil, add missing paramater to insert query.
authorChris Porter <redacted>
Mon, 10 Mar 2008 01:23:41 +0000 (01:23 +0000)
committerChris Porter <redacted>
Mon, 10 Mar 2008 01:23:41 +0000 (01:23 +0000)
chanserv/authcmds/hello.c
chanserv/chanserv.h
chanserv/chanservdb_updates.c
chanserv/database/chanservdb.c

index 5f3ac386ee7c7fcf352ed83eba54022e32205688..8bea9a2e02fcf72af4cc0837f95b928a15217e7c 100644 (file)
@@ -119,6 +119,7 @@ int csa_dohello(void *source, int cargc, char **cargv) {
   rup->suspendby=0;
   rup->suspendexp=0;
   rup->suspendtime=0;
+  rup->lockuntil=0;
   rup->password[0]='\0';
   rup->email=getsstring(cargv[0],EMAILLEN);
 
index 6964a95bfa30cd3d8a3222c43ff159a647b62909..b1d6f0f70be50a380f1c711df3b7feb492f16695 100644 (file)
@@ -611,6 +611,7 @@ typedef struct regchan {
   time_t              lastcountersync; /* When the counters were last synced.. */
   time_t              lastpart;        /* When the last user left the channel */
   time_t              suspendtime;     /* When the channel was suspended */
+  time_t              lockuntil;       /* Time until users account is unlocked (pass change, email, etc) */
   
   unsigned int        founder;         /* founder */
   unsigned int        addedby;         /* oper adding chan */
index f16bd55b97e0b8e75192100938267cce60f26d9d..b4fcc8ed9703cfd98b55824742448275d66fa5aa 100644 (file)
@@ -210,10 +210,10 @@ void csdb_updateuser(reguser *rup) {
     escinfo[0]='\0';
 
   pqquery("UPDATE users SET lastauth=%lu, lastemailchng=%lu, flags=%u,"
-                 "language=%u, suspendby=%u, suspendexp=%lu, suspendtime=%lu, password='%s', email='%s',"
+                 "language=%u, suspendby=%u, suspendexp=%lu, suspendtime=%lu, lockuntil=%lu, password='%s', email='%s',"
                  "lastuserhost='%s', suspendreason='%s', comment='%s', info='%s' WHERE ID=%u",
                  rup->lastauth, rup->lastemailchange, rup->flags, rup->languageid, rup->suspendby, rup->suspendexp,
-                 rup->suspendtime, escpassword, escemail, esclastuserhost, escreason, esccomment, escinfo,
+                 rup->suspendtime, rup->lockuntil, escpassword, escemail, esclastuserhost, escreason, esccomment, escinfo,
                  rup->ID);
 }  
 
@@ -255,11 +255,11 @@ void csdb_createuser(reguser *rup) {
     escinfo[0]='\0';
 
   pqquery("INSERT INTO users (ID, username, created, lastauth, lastemailchng, "
-                 "flags, language, suspendby, suspendexp, suspendtime, password, email, lastuserhost, "
-                 "suspendreason, comment, info) VALUES (%u,'%s',%lu,%lu,%lu,%u,%u,%u,%lu,%lu,'%s','%s',"
+                 "flags, language, suspendby, suspendexp, suspendtime, lockuntil, password, email, lastuserhost, "
+                 "suspendreason, comment, info) VALUES (%u,'%s',%lu,%lu,%lu,%u,%u,%u,%lu,%lu,%lu,'%s','%s',"
                  "'%s','%s','%s','%s')",
                  rup->ID, escusername, rup->created, rup->lastauth, rup->lastemailchange, rup->flags, 
-                 rup->languageid, rup->suspendby, rup->suspendexp,
+                 rup->languageid, rup->suspendby, rup->suspendexp, rup->suspendtime, rup->lockuntil,
                  escpassword, escemail, esclastuserhost, escreason, esccomment, escinfo);
 }  
 
index ac6658c42a0e359d508af54c703f3940f0e06f4a..7923da0e1ac8832ccec79daa11dd6945b28acf8a 100644 (file)
@@ -84,6 +84,7 @@ static void setuptables() {
                "suspendby     INT               NOT NULL,"
                "suspendexp    INT               NOT NULL,"
                "suspendtime   INT               NOT NULL,"
+               "lockuntil     INT               NOT NULL,"
                "password      VARCHAR(11)          NOT NULL,"
                "email         VARCHAR(100),"
                "lastuserhost  VARCHAR(75),"
@@ -351,7 +352,7 @@ void loadsomeusers(PGconn *dbconn, void *arg) {
     return;
   }
 
-  if (PQnfields(pgres)!=16) {
+  if (PQnfields(pgres)!=17) {
     Error("chanserv",ERR_ERROR,"User DB format error");
     return;
   }
@@ -371,8 +372,9 @@ void loadsomeusers(PGconn *dbconn, void *arg) {
     rup->suspendby=strtoul(PQgetvalue(pgres,i,7),NULL,10);
     rup->suspendexp=strtoul(PQgetvalue(pgres,i,8),NULL,10);
     rup->suspendtime=strtoul(PQgetvalue(pgres,i,9),NULL,10);
-    strncpy(rup->password,PQgetvalue(pgres,i,10),PASSLEN); rup->password[PASSLEN]='\0';
-    rup->email=getsstring(PQgetvalue(pgres,i,11),100);
+    rup->lockuntil=strtoul(PQgetvalue(pgres,i,10),NULL,10);
+    strncpy(rup->password,PQgetvalue(pgres,i,11),PASSLEN); rup->password[PASSLEN]='\0';
+    rup->email=getsstring(PQgetvalue(pgres,i,12),100);
     if (rup->email) {
       rup->domain=findorcreatemaildomain(rup->email->content);
       addregusertomaildomain(rup, rup->domain);
@@ -389,10 +391,10 @@ void loadsomeusers(PGconn *dbconn, void *arg) {
       rup->domain=NULL;
       rup->localpart=NULL;
     }
-    rup->lastuserhost=getsstring(PQgetvalue(pgres,i,12),75);
-    rup->suspendreason=getsstring(PQgetvalue(pgres,i,13),250);
-    rup->comment=getsstring(PQgetvalue(pgres,i,14),250);
-    rup->info=getsstring(PQgetvalue(pgres,i,15),100);
+    rup->lastuserhost=getsstring(PQgetvalue(pgres,i,13),75);
+    rup->suspendreason=getsstring(PQgetvalue(pgres,i,14),250);
+    rup->comment=getsstring(PQgetvalue(pgres,i,15),250);
+    rup->info=getsstring(PQgetvalue(pgres,i,16),100);
     rup->knownon=NULL;
     rup->checkshd=NULL;
     rup->stealcount=0;