hook_user_login(CC->cs_pid, CC->curr_user);
lgetuser(&CC->usersupp,CC->curr_user);
++(CC->usersupp.timescalled);
- /* <bc> */
CC->fake_username[0] = '\0';
CC->fake_postname[0] = '\0';
CC->fake_hostname[0] = '\0';
CC->fake_roomname[0] = '\0';
CC->last_pager[0] = '\0';
- /* <bc> */
time(&CC->usersupp.lastcall);
/* If this user's name is the name of the system administrator
char filename[64];
struct usersupp usbuf;
int a;
+ struct cdbdata *cdbmb;
+ long *mailbox;
+ int num_mails;
if (getuser(&usbuf, pname) != 0) {
lprintf(5, "Cannot purge user <%s> - not found\n", pname);
}
/* delete any messages in the user's mailbox */
- for (a=0; a<MAILSLOTS; ++a) {
- if (usbuf.mailnum[a] > 0L) {
- cdb_delete(CDB_MSGMAIN, &usbuf.mailnum[a],
- sizeof(long));
+ cdbmb = cdb_fetch(CDB_MAILBOXES, &usbuf.usernum, sizeof(long));
+ if (cdbmb != NULL) {
+ num_mails = cdbmb->len / sizeof(long);
+ mailbox = (long *) cdbmb->ptr;
+ if (num_mails > 0) for (a=0; a<num_mails; ++a) {
+ cdb_delete(CDB_MSGMAIN, &mailbox[a], sizeof(long));
}
+ cdb_free(cdbmb);
+ /* now delete the mailbox itself */
+ cdb_delete(CDB_MAILBOXES, &usbuf.usernum, sizeof(long));
}
+
+ /* delete the userlog entry */
+ cdb_delete(CDB_USERSUPP, pname, strlen(pname));
+
/* remove the user's bio file */
sprintf(filename, "./bio/%ld", usbuf.usernum);
unlink(filename);
int create_user(char *newusername)
{
struct usersupp usbuf;
- int a,file;
- long aa;
+ int a;
struct passwd *p = NULL;
char username[64];
CC->usersupp.generation[a]=(-1);
CC->usersupp.forget[a]=(-1);
}
- for (a=0; a<MAILSLOTS; ++a) {
- CC->usersupp.mailnum[a]=0L;
- }
strcpy(CC->usersupp.password,"");
/* These are the default flags on new accounts */
void cmd_gnur(void) {
struct cdbdata *cdbus;
struct usersupp usbuf;
- FILE *fp;
if (!(CC->logged_in)) {
cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
userbuf.flags = (userbuf.flags & ~US_NEEDVALID);
lputuser(&userbuf,user);
+
+ /* If the access level was set to zero, delete the user */
+ if (newax == 0) {
+ purge_user(user);
+ cprintf("%d %s Deleted.\n", OK, userbuf.fullname);
+ return;
+ }
+
cprintf("%d ok\n",OK);
}
*/
void cmd_regi(void) {
int a,b,c;
- FILE *fp;
char buf[256];
char tmpname[256];
int mail = 0;
int regis = 0;
int vali = 0;
- int a,file;
+ int a;
+ struct cdbdata *cdbmb;
+ long *mailbox;
+ int num_mails;
+
if (!(CC->logged_in)) {
cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
if (CitControl.MMflags&MM_VALID) vali = 1;
}
- mail=0; /* check for mail */
- for (a=0; a<MAILSLOTS; ++a)
- if ((CC->usersupp.mailnum[a])>(CC->usersupp.lastseen[1]))
- ++mail;
+
+ /* check for mail */
+ mail = 0;
+ cdbmb = cdb_fetch(CDB_MAILBOXES, &CC->usersupp.usernum, sizeof(long));
+ if (cdbmb != NULL) {
+ num_mails = cdbmb->len / sizeof(long);
+ mailbox = (long *) cdbmb->ptr;
+ if (num_mails > 0) for (a=0; a<num_mails; ++a) {
+ if (mailbox[a] > (CC->usersupp.lastseen[1])) ++mail;
+ }
+ cdb_free(cdbmb);
+ }
+
cprintf("%d %d|%d|%d\n",OK,mail,regis,vali);
}