Moved BumpNewMailCounter() into context.c because it manipulates contexts.
authorDave West <davew@uncensored.citadel.org>
Tue, 10 Nov 2009 19:39:19 +0000 (19:39 +0000)
committerDave West <davew@uncensored.citadel.org>
Tue, 10 Nov 2009 19:39:19 +0000 (19:39 +0000)
Exposed it to the API as CtdlBumpNewMailCounter() and deprected the old name.

citadel/context.c
citadel/context.h
citadel/include/ctdl_module.h
citadel/user_ops.c
citadel/user_ops.h

index 478ed03ad71eb5f5f5aa55b733d88e45ddb77a1a..c7902af980ad2fb743d8927f7529b3074e72fbfa 100644 (file)
@@ -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;
index 17034271ed9f72c949911d01e65c0a35543ec636..98d5feb5567eb523b7ee72f4ec92245ca8450b6d 100644 (file)
@@ -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 */
index 5ec05ab08ee91c9ee2f1357bee9a68b6636f0703..fbb632e690a73001ca947381805b79554f78dc40 100644 (file)
@@ -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);
 
 
 /*
index 67935a34f20ae7bbfebfe3e25650eaef4df8f9ce..118ee60618459d4fc56efe2946c11781717e76cf 100644 (file)
@@ -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
  */
index 5ae367c8653b33547517d70ecdc41582552b90bb..727c98cb33e758daafe50cb3b6d62a3a1fa22b8f 100644 (file)
@@ -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);