logging changes
[citadel.git] / citadel / room_ops.c
index ef185650b068201de2d1ba7ee889168e305cdd01..b895fc67dba4adfd7485c2330fed857c5d214770 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Server functions which perform operations on room objects.
  *
- * Copyright (c) 1987-2016 by the citadel.org team
+ * Copyright (c) 1987-2017 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, version 3.
@@ -38,6 +38,7 @@ int CtdlDoIHavePermissionToReadMessagesInThisRoom(void) {
        return(om_ok);
 }
 
+
 /*
  * Check to see whether we have permission to post a message in the current
  * room.  Returns a *CITADEL ERROR CODE* and puts a message in errmsgbuf, or
@@ -112,6 +113,7 @@ int CtdlDoIHavePermissionToPostInThisRoom(
 
 }
 
+
 /*
  * Check whether the current user has permission to delete messages from
  * the current room (returns 1 for yes, 0 for no)
@@ -123,6 +125,7 @@ int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void) {
        return(0);
 }
 
+
 /*
  * Retrieve access control information for any user/room pair.
  * Yes, it has a couple of gotos.  If you don't like that, go die in a car fire.
@@ -811,8 +814,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 +836,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;
        }
 
@@ -902,7 +914,7 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
        if (retnew != NULL) *retnew = new_messages;
        if (retoldest != NULL) *retoldest = oldest_message;
        if (retnewest != NULL) *retnewest = newest_message;
-       MSG_syslog(LOG_DEBUG, "<%s> %d new of %d total messages, oldest=%ld, newest=%ld",
+       syslog(LOG_DEBUG, "<%s> %d new of %d total messages, oldest=%ld, newest=%ld",
                   CCC->room.QRname, new_messages, total_messages, oldest_message, newest_message
        );
 
@@ -985,7 +997,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
        long owner = 0L;
        char actual_old_name[ROOMNAMELEN];
 
-       MSG_syslog(LOG_DEBUG, "CtdlRenameRoom(%s, %s, %d)", old_name, new_name, new_floor);
+       syslog(LOG_DEBUG, "CtdlRenameRoom(%s, %s, %d)", old_name, new_name, new_floor);
 
        if (new_floor >= 0) {
                fl = CtdlGetCachedFloor(new_floor);
@@ -1074,11 +1086,11 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
                lgetfloor(&flbuf, old_floor);
                --flbuf.f_ref_count;
                lputfloor(&flbuf, old_floor);
-               MSG_syslog(LOG_DEBUG, "Reference count for floor %d is now %d", old_floor, flbuf.f_ref_count);
+               syslog(LOG_DEBUG, "Reference count for floor %d is now %d", old_floor, flbuf.f_ref_count);
                lgetfloor(&flbuf, new_floor);
                ++flbuf.f_ref_count;
                lputfloor(&flbuf, new_floor);
-               MSG_syslog(LOG_DEBUG, "Reference count for floor %d is now %d", new_floor, flbuf.f_ref_count);
+               syslog(LOG_DEBUG, "Reference count for floor %d is now %d", new_floor, flbuf.f_ref_count);
        }
 
        /* ...and everybody say "YATTA!" */     
@@ -1128,19 +1140,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);
@@ -1223,10 +1226,10 @@ unsigned CtdlCreateRoom(char *new_room_name,
        struct floor flbuf;
        visit vbuf;
 
-       MARK_syslog(LOG_DEBUG, "CtdlCreateRoom(name=%s, type=%d, view=%d)", new_room_name, new_room_type, new_room_view);
+       syslog(LOG_DEBUG, "CtdlCreateRoom(name=%s, type=%d, view=%d)", new_room_name, new_room_type, new_room_view);
 
        if (CtdlGetRoom(&qrbuf, new_room_name) == 0) {
-               MARK_syslog(LOG_DEBUG, "Cannot create room <%s> - already exists", new_room_name);
+               syslog(LOG_DEBUG, "Cannot create room <%s> - already exists", new_room_name);
                return(0);
        }