* msgbase.c: modified AddMessageToRoom() and all functions that call it
authorArt Cancro <ajc@citadel.org>
Thu, 3 Dec 1998 01:39:38 +0000 (01:39 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 3 Dec 1998 01:39:38 +0000 (01:39 +0000)
          to use a more reliable/accurate method to set quickroom.QRhighest
        * weekly.in: don't sort/purge filedir where filedir doesn't exist

citadel/ChangeLog
citadel/msgbase.c
citadel/room_ops.c
citadel/room_ops.h

index a1513d8d61e77dde44b9c5a16a477c42834ba692..cfc01e9a3bdddbc8da28d93b10577e2d64a42fb1 100644 (file)
@@ -1,3 +1,8 @@
+Wed Dec  2 20:37:05 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * msgbase.c: modified AddMessageToRoom() and all functions that call it
+         to use a more reliable/accurate method to set quickroom.QRhighest
+       * weekly.in: don't sort/purge filedir where filedir doesn't exist
+
 1998-12-02 Nathan Bryant <bryant@cs.usm.maine.edu>
        * weekly is now generated by configure
 
index 8ab426acf20dff824bbb3c9694692768efa0aae0..4785df0a6f760484d96acf72dea3ba87cd0553a8 100644 (file)
@@ -784,10 +784,9 @@ void save_message(char *mtmp,      /* file containing proper message */
                }
 
        /* Add the message pointer to the room */
-       AddMessageToRoom(&CC->quickroom, newmsgid);
+       CC->quickroom.QRhighest = AddMessageToRoom(&CC->quickroom, newmsgid);
 
        /* update quickroom */
-       CC->quickroom.QRhighest = newmsgid;
        lputroom(&CC->quickroom, actual_rm);
 
        /* Network mail - send a copy to the network program. */
@@ -1232,7 +1231,7 @@ void cmd_move(char *args)
 
        /* put the message into the target room */
        lgetroom(&qtemp, targ);
-       AddMessageToRoom(&qtemp, num);
+       qtemp.QRhighest = AddMessageToRoom(&qtemp, num);
        lputroom(&qtemp, targ);
 
        cprintf("%d Message moved.\n", OK);
index 3d64b8fe4018829b198690e1c2dbac253eea835d..2dac9c90e950fdefbfbbd5a717af3a86bba2a921 100644 (file)
@@ -332,11 +332,16 @@ void delete_msglist(struct quickroom *whichroom) {
  * So, why doesn't this function use the get_msglist() and put_msglist() stuff
  * defined above?  Because the room the message number is being written to
  * may not be the current room (as is the case with cmd_move() for example).
+ *
+ * This function returns the highest message number present in the room after
+ * the add operation is performed - which is not necessarily the message
+ * being added.
  */
-void AddMessageToRoom(struct quickroom *whichroom, long newmsgid) {
+long AddMessageToRoom(struct quickroom *whichroom, long newmsgid) {
        struct cdbdata *cdbfr;
        int num_msgs;
        long *msglist;
+       long highest_msg = 0L;
        
        cdbfr = cdb_fetch(CDB_MSGLISTS, &whichroom->QRnumber, sizeof(long));
        if (cdbfr == NULL) {
@@ -364,12 +369,16 @@ void AddMessageToRoom(struct quickroom *whichroom, long newmsgid) {
        /* Sort the message list, so all the msgid's are in order */
        num_msgs = sort_msglist(msglist, num_msgs);
 
+       /* Determine the highest message number */
+       highest_msg = msglist[num_msgs - 1];
+
        /* Write it back to disk. */
        cdb_store(CDB_MSGLISTS, &whichroom->QRnumber, sizeof(long),
                msglist, num_msgs * sizeof(long));
 
        /* And finally, free up the memory we used. */
        free(msglist);
+       return(highest_msg);
        }
 
 
index 775f64f10124fcd4cef3f59e0dbacafc424bb407..22788e72872051f1c4923765ba34ccb6babdde91 100644 (file)
@@ -15,7 +15,7 @@ void putfloor (struct floor *flbuf, int floor_num);
 void lputfloor (struct floor *flbuf, int floor_num);
 void get_msglist (struct quickroom *whichroom);
 void put_msglist (struct quickroom *whichroom);
-void AddMessageToRoom(struct quickroom *whichroom, long newmsgid);
+long AddMessageToRoom(struct quickroom *whichroom, long newmsgid);
 long int MessageFromList (int whichpos);
 void SetMessageInList (int whichpos, long int newmsgnum);
 int sort_msglist (long int *listptrs, int oldcount);