From af165cf4f73ef4107e55d9f4a4905eb558b58867 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 16 Jun 2023 06:54:41 -0900 Subject: [PATCH] Removed 'timescalled' and 'posted' from the user record. These are artifacts from the old days of dialup BBS and they aren't really used anymore. Removing them to save a bunch of extra database writes. --- citadel/docs/databaselayout.md | 2 - citadel/server/modules/bio/serv_bio.c | 5 +- citadel/server/modules/ctdlproto/serv_user.c | 16 +--- citadel/server/modules/expire/serv_expire.c | 3 - citadel/server/modules/migrate/serv_migrate.c | 4 - citadel/server/modules/newuser/serv_newuser.c | 92 ------------------- citadel/server/modules_init.c | 1 - citadel/server/msgbase.c | 6 -- citadel/server/server.h | 4 +- citadel/server/user_ops.c | 7 +- citadel/utils/ctdl3264.c | 2 - 11 files changed, 9 insertions(+), 133 deletions(-) delete mode 100644 citadel/server/modules/newuser/serv_newuser.c diff --git a/citadel/docs/databaselayout.md b/citadel/docs/databaselayout.md index 4dca3718a..c31988331 100644 --- a/citadel/docs/databaselayout.md +++ b/citadel/docs/databaselayout.md @@ -26,8 +26,6 @@ this file look something like this: uid_t uid; // Associate with a unix account? char password[32]; // Account password (unless using external authentication) unsigned flags; // See US_ flags below - long timescalled; // Total number of logins - long posted; // Number of messages posted (ever) CIT_UBYTE axlevel; // Access level long usernum; // User number (never recycled) time_t lastcall; // Last time the user called diff --git a/citadel/server/modules/bio/serv_bio.c b/citadel/server/modules/bio/serv_bio.c index 738180893..8be817ae6 100644 --- a/citadel/server/modules/bio/serv_bio.c +++ b/citadel/server/modules/bio/serv_bio.c @@ -65,9 +65,8 @@ void cmd_rbio(char *cmdbuf) { return; } - cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS, - ruser.fullname, ruser.usernum, ruser.axlevel, - (long)ruser.lastcall, ruser.timescalled, ruser.posted); + cprintf("%d OK|%s|%ld|%d|%ld|0|0\n", LISTING_FOLLOWS, + ruser.fullname, ruser.usernum, ruser.axlevel, (long)ruser.lastcall); struct CtdlMessage *msg = CtdlFetchMessage(ruser.msgnum_bio, 1); if (msg != NULL) { diff --git a/citadel/server/modules/ctdlproto/serv_user.c b/citadel/server/modules/ctdlproto/serv_user.c index b1b5f8fa0..f5f4ef525 100644 --- a/citadel/server/modules/ctdlproto/serv_user.c +++ b/citadel/server/modules/ctdlproto/serv_user.c @@ -1,6 +1,6 @@ // Server functions which perform operations on user objects. // -// Copyright (c) 1987-2022 by the citadel.org team +// Copyright (c) 1987-2023 by the citadel.org team // // This program is open source software; you can redistribute it and/or // modify it under the terms of the GNU General Public License, version 3. @@ -469,13 +469,11 @@ void ListThisUser(char *username, void *data) { if ((CC->user.axlevel >= AxAideU) || ((usbuf.flags & US_UNLISTED) == 0) || ((CC->internal_pgm))) { - cprintf("%s|%d|%ld|%ld|%ld|%ld||\n", + cprintf("%s|%d|%ld|%ld|0|0||\n", usbuf.fullname, usbuf.axlevel, usbuf.usernum, - (long)usbuf.lastcall, - usbuf.timescalled, - usbuf.posted); + (long)usbuf.lastcall); } } } @@ -545,13 +543,11 @@ void cmd_agup(char *cmdbuf) { cprintf("%d No such user.\n", ERROR + NO_SUCH_USER); return; } - cprintf("%d %s|%s|%u|%ld|%ld|%d|%ld|%ld|%d\n", + cprintf("%d %s|%s|%u|0|0|%d|%ld|%ld|%d\n", CIT_OK, usbuf.fullname, usbuf.password, usbuf.flags, - usbuf.timescalled, - usbuf.posted, (int) usbuf.axlevel, usbuf.usernum, (long)usbuf.lastcall, @@ -581,10 +577,6 @@ void cmd_asup(char *cmdbuf) { extract_token(usbuf.password, cmdbuf, 1, '|', sizeof usbuf.password); if (np > 2) usbuf.flags = extract_int(cmdbuf, 2); - if (np > 3) - usbuf.timescalled = extract_int(cmdbuf, 3); - if (np > 4) - usbuf.posted = extract_int(cmdbuf, 4); if (np > 5) { newax = extract_int(cmdbuf, 5); if ((newax >= AxDeleted) && (newax <= AxAideU)) { diff --git a/citadel/server/modules/expire/serv_expire.c b/citadel/server/modules/expire/serv_expire.c index abcf62b12..096360aa4 100644 --- a/citadel/server/modules/expire/serv_expire.c +++ b/citadel/server/modules/expire/serv_expire.c @@ -370,9 +370,6 @@ void do_user_purge(char *username, void *data) { // Moved this lower down so that aides and permanent users get purged if they ask to be. if (!strcasecmp(us.password, "deleteme")) purge = 1; - // Fewer than zero calls is impossible, indicating a corrupted record. - if (us.timescalled < 0) purge = 1; - // any negative user number, is also impossible. if (us.usernum < 0L) purge = 1; diff --git a/citadel/server/modules/migrate/serv_migrate.c b/citadel/server/modules/migrate/serv_migrate.c index 7fd65e874..3a58bac63 100644 --- a/citadel/server/modules/migrate/serv_migrate.c +++ b/citadel/server/modules/migrate/serv_migrate.c @@ -108,8 +108,6 @@ void migr_export_users_backend(char *username, void *data) { cprintf("%ld\n", (long)u.uid); client_write(HKEY("")); xml_strout(u.password); client_write(HKEY("\n")); cprintf("%u\n", u.flags); - cprintf("%ld\n", u.timescalled); - cprintf("%ld\n", u.posted); cprintf("%d\n", u.axlevel); cprintf("%ld\n", u.usernum); cprintf("%ld\n", (long)u.lastcall); @@ -547,8 +545,6 @@ int migr_userrecord(void *data, const char *el) { else if (!strcasecmp(el, "u_uid")) usbuf.uid = atol(ChrPtr(migr_chardata)); else if (!strcasecmp(el, "u_password")) safestrncpy(usbuf.password, ChrPtr(migr_chardata), sizeof usbuf.password); else if (!strcasecmp(el, "u_flags")) usbuf.flags = atoi(ChrPtr(migr_chardata)); - else if (!strcasecmp(el, "u_timescalled")) usbuf.timescalled = atol(ChrPtr(migr_chardata)); - else if (!strcasecmp(el, "u_posted")) usbuf.posted = atol(ChrPtr(migr_chardata)); else if (!strcasecmp(el, "u_axlevel")) usbuf.axlevel = atoi(ChrPtr(migr_chardata)); else if (!strcasecmp(el, "u_usernum")) usbuf.usernum = atol(ChrPtr(migr_chardata)); else if (!strcasecmp(el, "u_lastcall")) usbuf.lastcall = atol(ChrPtr(migr_chardata)); diff --git a/citadel/server/modules/newuser/serv_newuser.c b/citadel/server/modules/newuser/serv_newuser.c deleted file mode 100644 index a75686c2c..000000000 --- a/citadel/server/modules/newuser/serv_newuser.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Automatically copies the contents of a "New User Greetings" room to the - * inbox of any new user upon account creation. - * - * Copyright (c) 1987-2022 by the citadel.org team - * - * This program is open source software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -/* - * Name of the New User Greetings room. - */ -#define NEWUSERGREETINGS "New User Greetings" - -#include "../../sysdep.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../../ctdl_module.h" -#include "../../citadel_defs.h" -#include "../../server.h" -#include "../../citserver.h" -#include "../../support.h" -#include "../../config.h" -#include "../../user_ops.h" -#include "../../database.h" -#include "../../msgbase.h" - -/* - * Copy the contents of the New User Greetings> room to the user's Mail> room. - */ -void CopyNewUserGreetings(void) { - struct cdbdata *cdbfr; - long *msglist = NULL; - int num_msgs = 0; - char mailboxname[ROOMNAMELEN]; - - - /* Only do this for new users. */ - if (CC->user.timescalled != 1) return; - - /* This user's mailbox. */ - CtdlMailboxName(mailboxname, sizeof mailboxname, &CC->user, MAILROOM); - - /* Go to the source room ... bail out silently if it's not there, - * or if it's not private. - */ - if (CtdlGetRoom(&CC->room, NEWUSERGREETINGS) != 0) return; - if ((CC->room.QRflags & QR_PRIVATE) == 0) return; - - cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long)); - - if (cdbfr != NULL) { - msglist = malloc(cdbfr->len); - memcpy(msglist, cdbfr->ptr, cdbfr->len); - num_msgs = cdbfr->len / sizeof(long); - cdb_free(cdbfr); - } - - if (num_msgs > 0) { - CtdlSaveMsgPointersInRoom(mailboxname, msglist, num_msgs, 1, NULL, 0); - } - - /* Now free the memory we used, and go away. */ - if (msglist != NULL) free(msglist); -} - - -// Initialization function, called from modules_init.c -char *ctdl_module_init_newuser(void) { - if (!threading) { - CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN, PRIO_LOGIN + 1); - } - - /* return our module name for the log */ - return "newuser"; -} diff --git a/citadel/server/modules_init.c b/citadel/server/modules_init.c index 17e5b6994..a79f6d326 100644 --- a/citadel/server/modules_init.c +++ b/citadel/server/modules_init.c @@ -52,7 +52,6 @@ void initialize_modules(int is_threading) { syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_listdeliver()); syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_listsub()); syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_migrate()); - syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_newuser()); syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_nntp()); syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_notes()); syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_pop3()); diff --git a/citadel/server/msgbase.c b/citadel/server/msgbase.c index 892c6941e..e5f8b1e19 100644 --- a/citadel/server/msgbase.c +++ b/citadel/server/msgbase.c @@ -2786,12 +2786,6 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ } } - /* Bump this user's messages posted counter. */ - syslog(LOG_DEBUG, "msgbase: updating user"); - CtdlLockGetCurrentUser(); - CC->user.posted = CC->user.posted + 1; - CtdlPutCurrentUserLock(); - /* Decide where bounces need to be delivered */ if ((recps != NULL) && (recps->bounce_to == NULL)) { if (CC->logged_in) { diff --git a/citadel/server/server.h b/citadel/server/server.h index 7e380a724..3c1f6999f 100644 --- a/citadel/server/server.h +++ b/citadel/server/server.h @@ -143,8 +143,8 @@ struct ctdluser { // User record uid_t uid; // Associate with a unix account? char password[32]; // password unsigned flags; // See US_ flags below - long timescalled; // Total number of logins - long posted; // Number of messages ever submitted + long unused1; + long unused2; cit_uint8_t axlevel; // Access level long usernum; // User number (never recycled) time_t lastcall; // Date/time of most recent login diff --git a/citadel/server/user_ops.c b/citadel/server/user_ops.c index f9a7f7146..62e62f492 100644 --- a/citadel/server/user_ops.c +++ b/citadel/server/user_ops.c @@ -566,7 +566,6 @@ void do_login(void) { syslog(LOG_NOTICE, "user_ops: <%s> logged in", CC->curr_user); CtdlGetUserLock(&CC->user, CC->curr_user); - ++(CC->user.timescalled); CC->previous_login = CC->user.lastcall; time(&CC->user.lastcall); @@ -632,9 +631,8 @@ void do_login(void) { void logged_in_response(void) { - cprintf("%d %s|%d|%ld|%ld|%u|%ld|%ld\n", + cprintf("%d %s|%d|0|0|%u|%ld|%ld\n", CIT_OK, CC->user.fullname, CC->user.axlevel, - CC->user.timescalled, CC->user.posted, CC->user.flags, CC->user.usernum, CC->previous_login ); @@ -901,9 +899,6 @@ int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid) { // These are the default flags on new accounts usbuf->flags = US_LASTOLD | US_DISAPPEAR | US_PAGINATOR | US_FLOORS; - - usbuf->timescalled = 0; - usbuf->posted = 0; usbuf->axlevel = CtdlGetConfigInt("c_initax"); usbuf->lastcall = time(NULL); diff --git a/citadel/utils/ctdl3264.c b/citadel/utils/ctdl3264.c index 012cfa89f..dce5739fb 100644 --- a/citadel/utils/ctdl3264.c +++ b/citadel/utils/ctdl3264.c @@ -188,8 +188,6 @@ void convert_users(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT * user64->uid = (uid_t) user32->uid; strcpy(user64->password, user32->password); user64->flags = (unsigned) user32->flags; - user64->timescalled = (long) user32->timescalled; - user64->posted = (long) user32->posted; user64->axlevel = (cit_uint8_t) user32->axlevel; user64->usernum = (long) user32->usernum; user64->lastcall = (time_t) user32->lastcall; -- 2.39.2