Fixed a null pointer comparison
[citadel.git] / citadel / room_ops.c
index ef185650b068201de2d1ba7ee889168e305cdd01..c0221dde08d1e96688f515d2ae86fd59221cdced 100644 (file)
@@ -811,8 +811,15 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
        /* Know the room ... but not if it's the page log room, or if the
         * caller specified that we're only entering this room transiently.
         */
-       if ((strcasecmp(CCC->room.QRname, CtdlGetConfigStr("c_logpages"))) && (transiently == 0))
-       {
+       int add_room_to_known_list = 1;
+       if (transiently == 1) {
+               add_room_to_known_list = 0;
+       }
+       char *c_logpages = CtdlGetConfigStr("c_logpages");
+       if ( (c_logpages != NULL) && (!strcasecmp(CCC->room.QRname, c_logpages)) ) {
+               add_room_to_known_list = 0;
+       }
+       if (add_room_to_known_list) {
                vbuf.v_flags = vbuf.v_flags & ~V_FORGET & ~V_LOCKOUT;
                vbuf.v_flags = vbuf.v_flags | V_ACCESS;
        }
@@ -826,8 +833,10 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
        /* Check for new mail */
        newmailcount = NewMailCount();
 
-       /* set info to 1 if the user needs to read the room's info file */
-       if (CCC->room.QRinfo > vbuf.v_lastseen) {
+       /* Set info to 1 if the room banner is new since our last visit.
+        * Some clients only want to display it when it changes.
+        */
+       if (CCC->room.msgnum_info > vbuf.v_lastseen) {
                info = 1;
        }
 
@@ -1128,19 +1137,10 @@ void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf)
 void CtdlDeleteRoom(struct ctdlroom *qrbuf)
 {
        struct floor flbuf;
-       char filename[PATH_MAX];
        char configdbkeyname[25];
 
        syslog(LOG_NOTICE, "Deleting room <%s>", qrbuf->QRname);
 
-       /* Delete the info file */
-       assoc_file_name(filename, sizeof filename, qrbuf, ctdl_info_dir);
-       unlink(filename);
-
-       /* Delete the image file */
-       assoc_file_name(filename, sizeof filename, qrbuf, ctdl_image_dir);
-       unlink(filename);
-
        /* Delete the room's network configdb entry */
        netcfg_keyname(configdbkeyname, qrbuf->QRnumber);
        CtdlDelConfig(configdbkeyname);