From 20070c580d49e475e9177e88eada3d23696f0ca4 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 23 Nov 2022 13:05:48 -0500 Subject: [PATCH] biff was here --- citadel/server/context.c | 33 ++++++++++++++------------------- citadel/server/context.h | 39 ++++++++++++++++----------------------- citadel/server/msgbase.c | 6 ++---- 3 files changed, 32 insertions(+), 46 deletions(-) diff --git a/citadel/server/context.c b/citadel/server/context.c index 9121a783b..270505b01 100644 --- a/citadel/server/context.c +++ b/citadel/server/context.c @@ -2,7 +2,7 @@ // Citadel context management stuff. // Here's where we (hopefully) have all the code that manipulates contexts. // -// Copyright (c) 1987-2020 by the citadel.org team +// Copyright (c) 1987-2022 by the citadel.org team // // This program is open source software. Use, duplication, or disclosure // is subject to the terms of the GNU General Public License, version 3. @@ -32,10 +32,10 @@ int CtdlTrySingleUser(void) { int can_do = 0; begin_critical_section(S_SINGLE_USER); - if (want_single_user) + if (want_single_user) { can_do = 0; - else - { + } + else { can_do = 1; want_single_user = 1; } @@ -93,31 +93,26 @@ int CtdlTerminateOtherSession (int session_num) { } } - if (((ret & TERM_FOUND) != 0) && ((ret & TERM_ALLOWED) != 0)) - { - if (ccptr->user.usernum == CC->user.usernum) + if (((ret & TERM_FOUND) != 0) && ((ret & TERM_ALLOWED) != 0)) { + if (ccptr->user.usernum == CC->user.usernum) { ccptr->kill_me = KILLME_ADMIN_TERMINATE; - else + } + else { ccptr->kill_me = KILLME_IDLE; + } end_critical_section(S_SESSION_TABLE); } - else + else { end_critical_section(S_SESSION_TABLE); + } return ret; } -/* - * Check to see if the user who we just sent mail to is logged in. If yes, - * bump the 'new mail' counter for their session. That enables them to - * receive a new mail notification without having to hit the database. - */ -void BumpNewMailCounter(long which_user) { - CtdlBumpNewMailCounter(which_user); -} - - +// Check to see if the user who we just sent mail to is logged in. If yes, +// bump the 'new mail' counter for their session. That enables them to +// receive a new mail notification without having to hit the database. void CtdlBumpNewMailCounter(long which_user) { CitContext *ptr; diff --git a/citadel/server/context.h b/citadel/server/context.h index e76d7acb0..faacdd65f 100644 --- a/citadel/server/context.h +++ b/citadel/server/context.h @@ -9,23 +9,21 @@ #include "threads.h" -/* - * Values for CitContext.state - * - * A session that is doing nothing is in CON_IDLE state. When activity - * is detected on the socket, it goes to CON_READY, indicating that it - * needs to have a worker thread bound to it. When a thread binds to - * the session, it goes to CON_EXECUTING and does its thing. When the - * transaction is finished, the thread sets it back to CON_IDLE and lets - * it go. - */ +// Values for CitContext.state +// +// A session that is doing nothing is in CON_IDLE state. When activity +// is detected on the socket, it goes to CON_READY, indicating that it +// needs to have a worker thread bound to it. When a thread binds to +// the session, it goes to CON_EXECUTING and does its thing. When the +// transaction is finished, the thread sets it back to CON_IDLE and lets +// it go. typedef enum __CCState { - CON_IDLE, /* This context is doing nothing */ - CON_GREETING, /* This context needs to output its greeting */ - CON_STARTING, /* This context is outputting its greeting */ - CON_READY, /* This context needs attention */ - CON_EXECUTING, /* This context is bound to a thread */ - CON_SYS /* This is a system context and mustn't be purged */ + CON_IDLE, // This context is doing nothing + CON_GREETING, // This context needs to output its greeting + CON_STARTING, // This context is outputting its greeting + CON_READY, // This context needs attention + CON_EXECUTING, // This context is bound to a thread + CON_SYS // This is a system context and mustn't be purged } CCState; #ifndef __CIT_CONTEXT__ @@ -33,10 +31,8 @@ typedef enum __CCState { typedef struct CitContext CitContext; #endif -/* - * This structure keeps track of all information relating to a running - * session on the server. We keep one of these for each session. - */ +// This structure keeps track of all information relating to a running +// session on the server. We keep one of these for each session. struct CitContext { CitContext *prev; /* Link to previous session in list */ CitContext *next; /* Link to next session in the list */ @@ -158,9 +154,6 @@ CitContext *CloneContext(CitContext *CloneMe); /* forcibly close and flush fd's on shutdown */ void terminate_all_sessions(void); -/* Deprecated, user CtdlBumpNewMailCounter() instead */ -void BumpNewMailCounter(long) __attribute__ ((deprecated)); - void terminate_idle_sessions(void); int CtdlTerminateOtherSession (int session_num); /* bits returned by CtdlTerminateOtherSession */ diff --git a/citadel/server/msgbase.c b/citadel/server/msgbase.c index 679390eea..bf24b4148 100644 --- a/citadel/server/msgbase.c +++ b/citadel/server/msgbase.c @@ -2803,9 +2803,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ CM_SetFieldLONG(msg, eVltMsgNum, newmsgid); - /* If this is private, local mail, make a copy in the - * recipient's mailbox and bump the reference count. - */ + // If this is private, local mail, make a copy in the recipient's mailbox and bump the reference count. if ((recps != NULL) && (recps->num_local > 0)) { char *pch; int ntokens; @@ -2819,7 +2817,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ if (CtdlGetUser(&userbuf, recipient) == 0) { CtdlMailboxName(actual_rm, sizeof actual_rm, &userbuf, MAILROOM); CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0, msg); - CtdlBumpNewMailCounter(userbuf.usernum); + CtdlBumpNewMailCounter(userbuf.usernum); // if this user is logged in, tell them they have new mail. PerformMessageHooks(msg, recps, EVT_AFTERUSRMBOXSAVE); } else { -- 2.39.2