]> code.citadel.org Git - citadel.git/commitdiff
* Added "max messages per page" and "read next nnn" stuff to read loop
authorArt Cancro <ajc@citadel.org>
Fri, 31 Mar 2000 02:08:45 +0000 (02:08 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 31 Mar 2000 02:08:45 +0000 (02:08 +0000)
  (probably not in its final form)

webcit/ChangeLog
webcit/messages.c

index b2125537b5588d219ef9daee39f605928e575c75..9c840331d8d3178900b19dc32304c043b5a14fb2 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 211.9  2000/03/31 02:08:45  ajc
+* Added "max messages per page" and "read next nnn" stuff to read loop
+  (probably not in its final form)
+
 Revision 211.8  2000/03/28 17:02:47  nbryant
 * configure.in: check for -lsocket -lnsl on Solaris and other SVR4-alikes
 
@@ -401,3 +405,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index 7fae2ee80a8e3aa16a7f92f767bb739c16bcaceb..c2b98d37e8a93b5b29fe8c1e3f6caee7f95866ed 100644 (file)
@@ -273,22 +273,29 @@ void readloop(char *oper)
        char cmd[256];
        int a;
        int nummsgs;
+       long startmsg;
+       int maxmsgs;
+       int num_displayed = 0;
+
+       startmsg = atol(bstr("startmsg"));
+       maxmsgs = atoi(bstr("maxmsgs"));
+       if (maxmsgs == 0) maxmsgs = 20;
 
        output_headers(1);
 
-       wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\"><CENTER><B>%s - ",
-               WC->wc_roomname);
+       /* wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\"><CENTER><B>%s - ",
+               WC->wc_roomname); */
        if (!strcmp(oper, "readnew")) {
                strcpy(cmd, "MSGS NEW");
-               wprintf("new messages");
+               /* wprintf("new messages"); */
        } else if (!strcmp(oper, "readold")) {
                strcpy(cmd, "MSGS OLD");
-               wprintf("old messages");
+               /* wprintf("old messages"); */
        } else {
                strcpy(cmd, "MSGS ALL");
-               wprintf("all messages");
+               /* wprintf("all messages"); */
        }
-       wprintf("</B></CENTER><BR>\n");
+       /* wprintf("</B></CENTER><BR>\n"); */
 
        nummsgs = load_msg_ptrs(cmd);
        if (nummsgs == 0) {
@@ -301,8 +308,30 @@ void readloop(char *oper)
                }
                goto DONE;
        }
+
        for (a = 0; a < nummsgs; ++a) {
-               read_message(WC->msgarr[a], oper);
+               if (WC->msgarr[a] >= startmsg) {
+                       read_message(WC->msgarr[a], oper);
+                       ++num_displayed;
+                       if ( (num_displayed >= maxmsgs) && (a < nummsgs) ) {
+                               wprintf("<CENTER></FONT SIZE=+1>"
+                                       "There are %d more messages here."
+                                       "&nbsp;&nbsp;&nbsp;</FONT>",
+                                       nummsgs - num_displayed);
+                               wprintf("<A HREF=\"/readfwd?startmsg=%ld"
+                                       "&maxmsgs=999999\">"
+                                       "Read them ALL"
+                                       "</A>&nbsp;&nbsp;&nbsp;",
+                                       WC->msgarr[a+1]);
+                               wprintf("<A HREF=\"/readfwd?startmsg=%ld"
+                                       "&maxmsgs=%d\">"
+                                       "Read next %d"
+                                       "</A>",
+                                       WC->msgarr[a+1], maxmsgs, maxmsgs);
+                               wprintf("</CENTER><HR>\n");
+                               goto DONE;
+                       }
+               }
        }
 
 DONE:  wDumpContent(1);