From: Dave West Date: Tue, 10 Nov 2009 19:39:19 +0000 (+0000) Subject: Moved BumpNewMailCounter() into context.c because it manipulates contexts. X-Git-Tag: v7.86~635 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=58621c6cc8f4963f1c9e2b64ab52b1716084cc12 Moved BumpNewMailCounter() into context.c because it manipulates contexts. Exposed it to the API as CtdlBumpNewMailCounter() and deprected the old name. --- diff --git a/citadel/context.c b/citadel/context.c index 478ed03ad..c7902af98 100644 --- a/citadel/context.c +++ b/citadel/context.c @@ -129,6 +129,32 @@ int CtdlIsSingleUser(void) +/* + * 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); +} + +void CtdlBumpNewMailCounter(long which_user) +{ + CitContext *ptr; + + begin_critical_section(S_SESSION_TABLE); + + for (ptr = ContextList; ptr != NULL; ptr = ptr->next) { + if (ptr->user.usernum == which_user) { + ptr->newmail += 1; + } + } + + end_critical_section(S_SESSION_TABLE); +} + + /* * Check to see if a user is currently logged in * Take care with what you do as a result of this test. @@ -160,7 +186,7 @@ int CtdlIsUserLoggedIn (char *user_name) * The user may not have been logged in when this function was called BUT * because of threading the user might be logged in before you test the result. */ -int CtdlIsUserLoggedInByNum (int usernum) +int CtdlIsUserLoggedInByNum (long usernum) { CitContext *cptr; int ret = 0; diff --git a/citadel/context.h b/citadel/context.h index 17034271e..98d5feb55 100644 --- a/citadel/context.h +++ b/citadel/context.h @@ -146,6 +146,8 @@ INLINE void become_session(struct CitContext *which_con); void InitializeMasterCC(void); void dead_session_purge(int force); +/* Deprecated, user CtdlBumpNewMailCounter() instead */ +void BumpNewMailCounter(long) __attribute__ ((deprecated)); #endif /* CONTEXT_H */ diff --git a/citadel/include/ctdl_module.h b/citadel/include/ctdl_module.h index 5ec05ab08..fbb632e69 100644 --- a/citadel/include/ctdl_module.h +++ b/citadel/include/ctdl_module.h @@ -190,7 +190,8 @@ int CtdlIsSingleUser(void); int CtdlIsUserLoggedIn (char *user_name); -int CtdlIsUserLoggedInByNum (int usernum); +int CtdlIsUserLoggedInByNum (long usernum); +void CtdlBumpNewMailCounter(long which_user); /* diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 67935a34f..118ee6061 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -1933,26 +1933,6 @@ void cmd_asup(char *cmdbuf) -/* - * 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) { - CitContext *ptr; - - begin_critical_section(S_SESSION_TABLE); - - for (ptr = ContextList; ptr != NULL; ptr = ptr->next) { - if (ptr->user.usernum == which_user) { - ptr->newmail += 1; - } - } - - end_critical_section(S_SESSION_TABLE); -} - - /* * Count the number of new mail messages the user has */ diff --git a/citadel/user_ops.h b/citadel/user_ops.h index 5ae367c86..727c98cb3 100644 --- a/citadel/user_ops.h +++ b/citadel/user_ops.h @@ -45,7 +45,6 @@ void CtdlSetPassword(char *new_pw); int CtdlForgetThisRoom(void); void cmd_newu (char *cmdbuf); -void BumpNewMailCounter(long); void start_chkpwd_daemon(void);