]> code.citadel.org Git - citadel.git/blobdiff - citadel/room_ops.c
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / citadel / room_ops.c
index 0d90bc3b300ea0eb7bb73dce6565f95e8fd56bdc..729846d3eb0e12010935922a1cc2ad3e67a66e5b 100644 (file)
  * GNU General Public License for more details.
  */
 
-#include "sysdep.h"
-#include <stdlib.h>
-#include <unistd.h>
 #include <stdio.h>
-#include <sys/stat.h>
-#include <ctype.h>
-#include <string.h>
-#include <dirent.h>    /* for cmd_rdir to read contents of the directory */
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# else
-#  include <time.h>
-# endif
-#endif
-
-#include <limits.h>
-#include <errno.h>
-#include "citadel.h"
 #include <libcitadel.h>
-#include "server.h"
-#include "database.h"
-#include "config.h"
-#include "room_ops.h"
-#include "sysdep_decls.h"
-#include "support.h"
-#include "msgbase.h"
+
 #include "citserver.h"
-#include "control.h"
-#include "citadel_dirs.h"
-#include "threads.h"
 
 #include "ctdl_module.h"
+#include "config.h"
+#include "control.h"
 #include "user_ops.h"
+#include "room_ops.h"
 
 struct floor *floorcache[MAXFLOORS];
 
@@ -804,13 +776,15 @@ int CtdlIsNonEditable(struct ctdlroom *qrbuf)
  * specified room exists and is ok to access.
  */
 void CtdlUserGoto(char *where, int display_result, int transiently,
-               int *retmsgs, int *retnew)
+               int *retmsgs, int *retnew, long *retoldest, long *retnewest)
 {
        struct CitContext *CCC = CC;
        int a;
        int new_messages = 0;
        int old_messages = 0;
        int total_messages = 0;
+       long oldest_message = 0;
+       long newest_message = 0;
        int info = 0;
        int rmailflag;
        int raideflag;
@@ -878,6 +852,11 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
                if (msglist[a] > 0L) ++total_messages;
        }
 
+       if (total_messages > 0) {
+               oldest_message = msglist[0];
+               newest_message = msglist[num_msgs - 1];
+       }
+
        num_sets = num_tokens(vbuf.v_seen, ',');
        for (s=0; s<num_sets; ++s) {
                extract_token(setstr, vbuf.v_seen, s, ',', sizeof setstr);
@@ -929,10 +908,11 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
 
        if (retmsgs != NULL) *retmsgs = total_messages;
        if (retnew != NULL) *retnew = new_messages;
-       MSG_syslog(LOG_INFO, "<%s> %d new of %d total messages\n",
-                  CCC->room.QRname,
-                  new_messages, total_messages
-               );
+       if (retoldest != NULL) *retoldest = oldest_message;
+       if (retnewest != NULL) *retnewest = newest_message;
+       MSG_syslog(LOG_INFO, "<%s> %d new of %d total messages, oldest=%ld, newest=%ld\n",
+                  CCC->room.QRname, new_messages, total_messages, oldest_message, newest_message
+       );
 
        CCC->curr_view = (int)vbuf.v_view;