]> code.citadel.org Git - citadel.git/blobdiff - citadel/room_ops.c
* Variable names, comments, documentation, etc... removed the acronym 'BBS'
[citadel.git] / citadel / room_ops.c
index 2b80cabae660df0fc16f066de762ac9edbc49721..b335942d2b8c44cd21c99d811b4b401d90d0d5cb 100644 (file)
@@ -49,14 +49,17 @@ struct floor *floorcache[MAXFLOORS];
 /*
  * Generic routine for determining user access to rooms
  */
-int CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf)
+void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
+               int *result, int *view)
 {
        int retval = 0;
        struct visit vbuf;
 
        /* for internal programs, always do everything */
        if (((CC->internal_pgm)) && (roombuf->QRflags & QR_INUSE)) {
-               return (UA_KNOWN | UA_GOTOALLOWED);
+               retval = (UA_KNOWN | UA_GOTOALLOWED);
+               vbuf.v_view = 0;
+               goto SKIP_EVERYTHING;
        }
 
        /* Locate any applicable user/room relationships */
@@ -140,9 +143,10 @@ int CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf)
                }
        }
 
-       /* On some systems, Aides can gain access to mailboxes as well */
-       if ( (config.c_aide_mailboxes)
-          && (userbuf->axlevel >= 6)
+       /* Aides can gain access to mailboxes as well, but they don't show
+        * by default.
+        */
+       if ( (userbuf->axlevel >= 6)
           && (roombuf->QRflags & QR_MAILBOX) ) {
                retval = retval | UA_GOTOALLOWED;
        }
@@ -156,7 +160,11 @@ NEWMSG:    /* By the way, we also check for the presence of new messages */
        if (roombuf->QRflags2 & QR2_SYSTEM) {
                retval = retval & ~UA_KNOWN;
        }
-       return (retval);
+
+SKIP_EVERYTHING:
+       /* Now give the caller the information it wants. */
+       if (result != NULL) *result = retval;
+       if (view != NULL) *view = vbuf.v_view;
 }
 
 /*
@@ -333,17 +341,31 @@ void lgetfloor(struct floor *flbuf, int floor_num)
 struct floor *cgetfloor(int floor_num) {
        static int initialized = 0;
        int i;
+       int fetch_new = 0;
+       struct floor *fl = NULL;
 
+       begin_critical_section(S_FLOORCACHE);
        if (initialized == 0) {
                for (i=0; i<MAXFLOORS; ++i) {
                        floorcache[floor_num] = NULL;
                }
        initialized = 1;
        }
-       
        if (floorcache[floor_num] == NULL) {
-               floorcache[floor_num] = mallok(sizeof(struct floor));
-               getfloor(floorcache[floor_num], floor_num);
+               fetch_new = 1;
+       }
+       end_critical_section(S_FLOORCACHE);
+
+       if (fetch_new) {
+               lprintf(CTDL_DEBUG, "fetch_new is active ... going to disk\n");
+               fl = malloc(sizeof(struct floor));
+               getfloor(fl, floor_num);
+               begin_critical_section(S_FLOORCACHE);
+               if (floorcache[floor_num] != NULL) {
+                       free(floorcache[floor_num]);
+               }
+               floorcache[floor_num] = fl;
+               end_critical_section(S_FLOORCACHE);
        }
 
        return(floorcache[floor_num]);
@@ -356,14 +378,17 @@ struct floor *cgetfloor(int floor_num) {
  */
 void putfloor(struct floor *flbuf, int floor_num)
 {
-       cdb_store(CDB_FLOORTAB, &floor_num, sizeof(int),
-                 flbuf, sizeof(struct floor));
-
        /* If we've cached this, clear it out, 'cuz it's WRONG now! */
+       begin_critical_section(S_FLOORCACHE);
        if (floorcache[floor_num] != NULL) {
-               phree(floorcache[floor_num]);
-               floorcache[floor_num] = NULL;
+               free(floorcache[floor_num]);
+               floorcache[floor_num] = malloc(sizeof(struct floor));
+               memcpy(floorcache[floor_num], flbuf, sizeof(struct floor));
        }
+       end_critical_section(S_FLOORCACHE);
+
+       cdb_store(CDB_FLOORTAB, &floor_num, sizeof(int),
+                 flbuf, sizeof(struct floor));
 }
 
 
@@ -482,15 +507,15 @@ int is_noneditable(struct ctdlroom *qrbuf)
 /*
  * Back-back-end for all room listing commands
  */
-void list_roomname(struct ctdlroom *qrbuf, int ra)
+void list_roomname(struct ctdlroom *qrbuf, int ra, int view)
 {
        char truncated_roomname[ROOMNAMELEN];
 
        /* For my own mailbox rooms, chop off the owner prefix */
        if ( (qrbuf->QRflags & QR_MAILBOX)
             && (atol(qrbuf->QRname) == CC->user.usernum) ) {
-               strcpy(truncated_roomname, qrbuf->QRname);
-               strcpy(truncated_roomname, &truncated_roomname[11]);
+               safestrncpy(truncated_roomname, qrbuf->QRname, sizeof truncated_roomname);
+               safestrncpy(truncated_roomname, &truncated_roomname[11], sizeof truncated_roomname);
                cprintf("%s", truncated_roomname);
        }
        /* For all other rooms, just display the name in its entirety */
@@ -499,12 +524,13 @@ void list_roomname(struct ctdlroom *qrbuf, int ra)
        }
 
        /* ...and now the other parameters */
-       cprintf("|%u|%d|%d|%d|%d|\n",
+       cprintf("|%u|%d|%d|%d|%d|%d|\n",
                qrbuf->QRflags,
                (int) qrbuf->QRfloor,
                (int) qrbuf->QRorder,
                (int) qrbuf->QRflags2,
-               ra
+               ra,
+               view
        );
 }
 
@@ -516,14 +542,15 @@ void cmd_lrms_backend(struct ctdlroom *qrbuf, void *data)
 {
        int FloorBeingSearched = (-1);
        int ra;
+       int view;
 
        FloorBeingSearched = *(int *)data;
-       ra = CtdlRoomAccess(qrbuf, &CC->user);
+       CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
 
        if ((( ra & (UA_KNOWN | UA_ZAPPED)))
            && ((qrbuf->QRfloor == (FloorBeingSearched))
                || ((FloorBeingSearched) < 0)))
-               list_roomname(qrbuf, ra);
+               list_roomname(qrbuf, ra, view);
 }
 
 void cmd_lrms(char *argbuf)
@@ -553,14 +580,15 @@ void cmd_lkra_backend(struct ctdlroom *qrbuf, void *data)
 {
        int FloorBeingSearched = (-1);
        int ra;
+       int view;
 
        FloorBeingSearched = *(int *)data;
-       ra = CtdlRoomAccess(qrbuf, &CC->user);
+       CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
 
        if ((( ra & (UA_KNOWN)))
            && ((qrbuf->QRfloor == (FloorBeingSearched))
                || ((FloorBeingSearched) < 0)))
-               list_roomname(qrbuf, ra);
+               list_roomname(qrbuf, ra, view);
 }
 
 void cmd_lkra(char *argbuf)
@@ -587,15 +615,16 @@ void cmd_lprm_backend(struct ctdlroom *qrbuf, void *data)
 {
        int FloorBeingSearched = (-1);
        int ra;
+       int view;
 
        FloorBeingSearched = *(int *)data;
-       ra = CtdlRoomAccess(qrbuf, &CC->user);
+       CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
 
        if (   ((qrbuf->QRflags & QR_PRIVATE) == 0)
                && ((qrbuf->QRflags & QR_MAILBOX) == 0)
            && ((qrbuf->QRfloor == (FloorBeingSearched))
                || ((FloorBeingSearched) < 0)))
-               list_roomname(qrbuf, ra);
+               list_roomname(qrbuf, ra, view);
 }
 
 void cmd_lprm(char *argbuf)
@@ -619,15 +648,16 @@ void cmd_lkrn_backend(struct ctdlroom *qrbuf, void *data)
 {
        int FloorBeingSearched = (-1);
        int ra;
+       int view;
 
        FloorBeingSearched = *(int *)data;
-       ra = CtdlRoomAccess(qrbuf, &CC->user);
+       CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
 
        if ((ra & UA_KNOWN)
            && (ra & UA_HASNEWMSGS)
            && ((qrbuf->QRfloor == (FloorBeingSearched))
                || ((FloorBeingSearched) < 0)))
-               list_roomname(qrbuf, ra);
+               list_roomname(qrbuf, ra, view);
 }
 
 void cmd_lkrn(char *argbuf)
@@ -657,15 +687,16 @@ void cmd_lkro_backend(struct ctdlroom *qrbuf, void *data)
 {
        int FloorBeingSearched = (-1);
        int ra;
+       int view;
 
        FloorBeingSearched = *(int *)data;
-       ra = CtdlRoomAccess(qrbuf, &CC->user);
+       CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
 
        if ((ra & UA_KNOWN)
            && ((ra & UA_HASNEWMSGS) == 0)
            && ((qrbuf->QRfloor == (FloorBeingSearched))
                || ((FloorBeingSearched) < 0)))
-               list_roomname(qrbuf, ra);
+               list_roomname(qrbuf, ra, view);
 }
 
 void cmd_lkro(char *argbuf)
@@ -694,16 +725,17 @@ void cmd_lkro(char *argbuf)
 void cmd_lzrm_backend(struct ctdlroom *qrbuf, void *data)
 {
        int FloorBeingSearched = (-1);
-
        int ra;
+       int view;
+
        FloorBeingSearched = *(int *)data;
-       ra = CtdlRoomAccess(qrbuf, &CC->user);
+       CtdlRoomAccess(qrbuf, &CC->user, &ra, &view);
 
        if ((ra & UA_GOTOALLOWED)
            && (ra & UA_ZAPPED)
            && ((qrbuf->QRfloor == (FloorBeingSearched))
                || ((FloorBeingSearched) < 0)))
-               list_roomname(qrbuf, ra);
+               list_roomname(qrbuf, ra, view);
 }
 
 void cmd_lzrm(char *argbuf)
@@ -788,7 +820,7 @@ void usergoto(char *where, int display_result, int transiently,
        get_mm();
         cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
         if (cdbfr != NULL) {
-               msglist = mallok(cdbfr->len);
+               msglist = malloc(cdbfr->len);
                memcpy(msglist, cdbfr->ptr, cdbfr->len);
                num_msgs = cdbfr->len / sizeof(long);
                cdb_free(cdbfr);
@@ -803,7 +835,7 @@ void usergoto(char *where, int display_result, int transiently,
                }
        }
 
-       if (msglist != NULL) phree(msglist);
+       if (msglist != NULL) free(msglist);
 
        if (CC->room.QRflags & QR_MAILBOX)
                rmailflag = 1;
@@ -816,10 +848,10 @@ void usergoto(char *where, int display_result, int transiently,
        else
                raideflag = 0;
 
-       strcpy(truncated_roomname, CC->room.QRname);
+       safestrncpy(truncated_roomname, CC->room.QRname, sizeof truncated_roomname);
        if ( (CC->room.QRflags & QR_MAILBOX)
           && (atol(CC->room.QRname) == CC->user.usernum) ) {
-               strcpy(truncated_roomname, &truncated_roomname[11]);
+               safestrncpy(truncated_roomname, &truncated_roomname[11], sizeof truncated_roomname);
        }
 
        if (retmsgs != NULL) *retmsgs = total_messages;
@@ -829,6 +861,8 @@ void usergoto(char *where, int display_result, int transiently,
                new_messages, total_messages
        );
 
+       CC->curr_view = (int)vbuf.v_view;
+
        if (display_result) {
                cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d|%d|%d|\n",
                        CIT_OK, CtdlCheckExpress(),
@@ -859,27 +893,27 @@ void cmd_goto(char *gargs)
        int c;
        int ok = 0;
        int ra;
-       char augmented_roomname[SIZ];
-       char towhere[SIZ];
-       char password[SIZ];
+       char augmented_roomname[ROOMNAMELEN];
+       char towhere[ROOMNAMELEN];
+       char password[32];
        int transiently = 0;
 
        if (CtdlAccessCheck(ac_logged_in)) return;
 
-       extract(towhere, gargs, 0);
-       extract(password, gargs, 1);
+       extract_token(towhere, gargs, 0, '|', sizeof towhere);
+       extract_token(password, gargs, 1, '|', sizeof password);
        transiently = extract_int(gargs, 2);
 
        getuser(&CC->user, CC->curr_user);
 
        if (!strcasecmp(towhere, "_BASEROOM_"))
-               strcpy(towhere, config.c_baseroom);
+               safestrncpy(towhere, config.c_baseroom, sizeof towhere);
 
        if (!strcasecmp(towhere, "_MAIL_"))
-               strcpy(towhere, MAILROOM);
+               safestrncpy(towhere, MAILROOM, sizeof towhere);
 
        if (!strcasecmp(towhere, "_BITBUCKET_"))
-               strcpy(towhere, config.c_twitroom);
+               safestrncpy(towhere, config.c_twitroom, sizeof towhere);
 
 
        /* First try a regular match */
@@ -891,7 +925,7 @@ void cmd_goto(char *gargs)
                            &CC->user, towhere);
                c = getroom(&QRscratch, augmented_roomname);
                if (c == 0)
-                       strcpy(towhere, augmented_roomname);
+                       safestrncpy(towhere, augmented_roomname, sizeof towhere);
        }
 
        /* And if the room was found... */
@@ -906,7 +940,7 @@ void cmd_goto(char *gargs)
                }
 
                /* See if there is an existing user/room relationship */
-               ra = CtdlRoomAccess(&QRscratch, &CC->user);
+               CtdlRoomAccess(&QRscratch, &CC->user, &ra, NULL);
 
                /* normal clients have to pass through security */
                if (ra & UA_GOTOALLOWED) {
@@ -952,6 +986,7 @@ void cmd_whok(void)
 {
        struct ctdluser temp;
        struct cdbdata *cdbus;
+       int ra;
 
        getuser(&CC->user, CC->curr_user);
 
@@ -977,8 +1012,9 @@ void cmd_whok(void)
                memcpy(&temp, cdbus->ptr, sizeof temp);
                cdb_free(cdbus);
 
+               CtdlRoomAccess(&CC->room, &temp, &ra, NULL);
                if ((CC->room.QRflags & QR_INUSE)
-                   && (CtdlRoomAccess(&CC->room, &temp) & UA_KNOWN)
+                   && (ra & UA_KNOWN)
                    )
                        cprintf("%s\n", temp.fullname);
        }
@@ -991,9 +1027,9 @@ void cmd_whok(void)
  */
 void cmd_rdir(void)
 {
-       char buf[SIZ];
-       char flnm[SIZ];
-       char comment[SIZ];
+       char buf[256];
+       char flnm[256];
+       char comment[256];
        FILE *ls, *fd;
        struct stat statbuf;
 
@@ -1013,13 +1049,13 @@ void cmd_rdir(void)
                return;
        }
        cprintf("%d %s|%s/files/%s\n",
-       LISTING_FOLLOWS, config.c_fqdn, BBSDIR, CC->room.QRdirname);
+       LISTING_FOLLOWS, config.c_fqdn, CTDLDIR, CC->room.QRdirname);
 
         snprintf(buf, sizeof buf, "ls %s/files/%s  >%s 2> /dev/null",
-                BBSDIR, CC->room.QRdirname, CC->temp);
+                CTDLDIR, CC->room.QRdirname, CC->temp);
         system(buf);
 
-       snprintf(buf, sizeof buf, "%s/files/%s/filedir", BBSDIR, CC->room.QRdirname);
+       snprintf(buf, sizeof buf, "%s/files/%s/filedir", CTDLDIR, CC->room.QRdirname);
        fd = fopen(buf, "r");
        if (fd == NULL)
                fd = fopen("/dev/null", "r");
@@ -1029,9 +1065,9 @@ void cmd_rdir(void)
                flnm[strlen(flnm) - 1] = 0;
                if (strcasecmp(flnm, "filedir")) {
                        snprintf(buf, sizeof buf, "%s/files/%s/%s",
-                               BBSDIR, CC->room.QRdirname, flnm);
+                               CTDLDIR, CC->room.QRdirname, flnm);
                        stat(buf, &statbuf);
-                       strcpy(comment, "");
+                       safestrncpy(comment, "", sizeof comment);
                        fseek(fd, 0L, 0);
                        while ((fgets(buf, sizeof buf, fd) != NULL)
                               && (strlen(comment) == 0)) {
@@ -1099,7 +1135,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
        struct floor *fl;
        struct floor flbuf;
        long owner = 0L;
-       char actual_old_name[SIZ];
+       char actual_old_name[ROOMNAMELEN];
 
        lprintf(CTDL_DEBUG, "CtdlRenameRoom(%s, %s, %d)\n",
                old_name, new_name, new_floor);
@@ -1134,7 +1170,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
 
        else {
                /* Rename it */
-               strcpy(actual_old_name, qrbuf.QRname);
+               safestrncpy(actual_old_name, qrbuf.QRname, sizeof actual_old_name);
                if (qrbuf.QRflags & QR_MAILBOX) {
                        owner = atol(qrbuf.QRname);
                }
@@ -1209,7 +1245,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
  */
 void cmd_setr(char *args)
 {
-       char buf[SIZ];
+       char buf[256];
        int new_order = 0;
        int r;
        int new_floor;
@@ -1229,9 +1265,9 @@ void cmd_setr(char *args)
        if (CC->room.QRflags & QR_MAILBOX) {
                sprintf(new_name, "%010ld.", atol(CC->room.QRname) );
        } else {
-               strcpy(new_name, "");
+               safestrncpy(new_name, "", sizeof new_name);
        }
-       extract(&new_name[strlen(new_name)], args, 0);
+       extract_token(&new_name[strlen(new_name)], args, 0, '|', (sizeof new_name - strlen(new_name)));
 
        r = CtdlRenameRoom(CC->room.QRname, new_name, new_floor);
 
@@ -1273,7 +1309,7 @@ void cmd_setr(char *args)
        lgetroom(&CC->room, CC->room.QRname);
 
        /* Directory room */
-       extract(buf, args, 2);
+       extract_token(buf, args, 2, '|', sizeof buf);
        buf[15] = 0;
        safestrncpy(CC->room.QRdirname, buf,
                sizeof CC->room.QRdirname);
@@ -1311,7 +1347,7 @@ void cmd_setr(char *args)
                if (num_parms(args) >= 7)
                        CC->room.QRorder = (char) new_order;
                /* Room password */
-               extract(buf, args, 1);
+               extract_token(buf, args, 1, '|', sizeof buf);
                buf[10] = 0;
                safestrncpy(CC->room.QRpasswd, buf,
                            sizeof CC->room.QRpasswd);
@@ -1335,8 +1371,7 @@ void cmd_setr(char *args)
 
        /* Create a room directory if necessary */
        if (CC->room.QRflags & QR_DIRECTORY) {
-               snprintf(buf, sizeof buf, "./files/%s",
-                       CC->room.QRdirname);
+               snprintf(buf, sizeof buf, "./files/%s", CC->room.QRdirname);
                mkdir(buf, 0755);
        }
        snprintf(buf, sizeof buf, "%s> edited by %s\n", CC->room.QRname, CC->curr_user);
@@ -1539,10 +1574,10 @@ void cmd_kill(char *argbuf)
        }
        if (kill_ok) {
                if (CC->room.QRflags & QR_MAILBOX) {
-                       strcpy(deleted_room_name, &CC->room.QRname[11]);
+                       safestrncpy(deleted_room_name, &CC->room.QRname[11], sizeof deleted_room_name);
                }
                else {
-                       strcpy(deleted_room_name, CC->room.QRname);
+                       safestrncpy(deleted_room_name, CC->room.QRname, sizeof deleted_room_name);
                }
 
                /* Do the dirty work */
@@ -1573,20 +1608,22 @@ unsigned create_room(char *new_room_name,
                     char *new_room_pass,
                     int new_room_floor,
                     int really_create,
-                    int avoid_access)
+                    int avoid_access,
+                    int new_room_view)
 {
 
        struct ctdlroom qrbuf;
        struct floor flbuf;
        struct visit vbuf;
 
-       lprintf(CTDL_DEBUG, "create_room(%s)\n", new_room_name);
+       lprintf(CTDL_DEBUG, "create_room(name=%s, type=%d, view=%d)\n",
+               new_room_name, new_room_type, new_room_view);
+
        if (getroom(&qrbuf, new_room_name) == 0) {
                lprintf(CTDL_DEBUG, "%s already exists.\n", new_room_name);
-               return (0);     /* already exists */
+               return(0);
        }
 
-
        memset(&qrbuf, 0, sizeof(struct ctdlroom));
        safestrncpy(qrbuf.QRpasswd, new_room_pass, sizeof qrbuf.QRpasswd);
        qrbuf.QRflags = QR_INUSE;
@@ -1629,6 +1666,7 @@ unsigned create_room(char *new_room_name,
        qrbuf.QRhighest = 0L;   /* No messages in this room yet */
        time(&qrbuf.QRgen);     /* Use a timestamp as the generation number */
        qrbuf.QRfloor = new_room_floor;
+       qrbuf.QRdefaultview = new_room_view;
 
        /* save what we just did... */
        putroom(&qrbuf);
@@ -1661,21 +1699,23 @@ unsigned create_room(char *new_room_name,
 void cmd_cre8(char *args)
 {
        int cre8_ok;
-       char new_room_name[SIZ];
+       char new_room_name[ROOMNAMELEN];
        int new_room_type;
-       char new_room_pass[SIZ];
+       char new_room_pass[32];
        int new_room_floor;
-       char aaa[SIZ];
+       int new_room_view;
+       char *notification_message = NULL;
        unsigned newflags;
        struct floor *fl;
        int avoid_access = 0;
 
        cre8_ok = extract_int(args, 0);
-       extract(new_room_name, args, 1);
+       extract_token(new_room_name, args, 1, '|', sizeof new_room_name);
        new_room_name[ROOMNAMELEN - 1] = 0;
        new_room_type = extract_int(args, 2);
-       extract(new_room_pass, args, 3);
+       extract_token(new_room_pass, args, 3, '|', sizeof new_room_pass);
        avoid_access = extract_int(args, 5);
+       new_room_view = extract_int(args, 6);
        new_room_pass[9] = 0;
        new_room_floor = 0;
 
@@ -1692,7 +1732,12 @@ void cmd_cre8(char *args)
 
        if (num_parms(args) >= 5) {
                fl = cgetfloor(extract_int(args, 4));
-               if ((fl->f_flags & F_INUSE) == 0) {
+               if (fl == NULL) {
+                       cprintf("%d Invalid floor number.\n",
+                               ERROR + INVALID_FLOOR_OPERATION);
+                       return;
+               }
+               else if ((fl->f_flags & F_INUSE) == 0) {
                        cprintf("%d Invalid floor number.\n",
                                ERROR + INVALID_FLOOR_OPERATION);
                        return;
@@ -1720,8 +1765,7 @@ void cmd_cre8(char *args)
        }
 
        if (new_room_type == 5) {
-               if ((config.c_aide_mailboxes == 0)
-                  || (CC->user.axlevel < 6)) {
+               if (CC->user.axlevel < 6) {
                        cprintf("%d Higher access required\n", 
                                ERROR + HIGHER_ACCESS_REQUIRED);
                        return;
@@ -1731,7 +1775,7 @@ void cmd_cre8(char *args)
        /* Check to make sure the requested room name doesn't already exist */
        newflags = create_room(new_room_name,
                                new_room_type, new_room_pass, new_room_floor,
-                               0, avoid_access);
+                               0, avoid_access, new_room_view);
        if (newflags == 0) {
                cprintf("%d '%s' already exists.\n",
                        ERROR + ALREADY_EXISTS, new_room_name);
@@ -1746,24 +1790,23 @@ void cmd_cre8(char *args)
        /* If we reach this point, the room needs to be created. */
 
        newflags = create_room(new_room_name,
-                          new_room_type, new_room_pass, new_room_floor, 1, 0);
+                          new_room_type, new_room_pass, new_room_floor, 1, 0,
+                          new_room_view);
 
        /* post a message in Aide> describing the new room */
-       safestrncpy(aaa, new_room_name, sizeof aaa);
-       strcat(aaa, "> created by ");
-       strcat(aaa, CC->user.fullname);
-       if (newflags & QR_MAILBOX)
-               strcat(aaa, " [personal]");
-       else if (newflags & QR_PRIVATE)
-               strcat(aaa, " [private]");
-       if (newflags & QR_GUESSNAME)
-               strcat(aaa, "[guessname] ");
-       if (newflags & QR_PASSWORDED) {
-               strcat(aaa, "\n Password: ");
-               strcat(aaa, new_room_pass);
-       }
-       strcat(aaa, "\n");
-       aide_message(aaa);
+       notification_message = malloc(1024);
+       snprintf(notification_message, 1024,
+               "%s> created by %s%s%s%s%s%s\n",
+               new_room_name,
+               CC->user.fullname,
+               ((newflags & QR_MAILBOX) ? " [personal]" : ""),
+               ((newflags & QR_PRIVATE) ? " [private]" : ""),
+               ((newflags & QR_GUESSNAME) ? " [hidden]" : ""),
+               ((newflags & QR_PASSWORDED) ? " Password: " : ""),
+               ((newflags & QR_PASSWORDED) ? new_room_pass : "")
+       );
+       aide_message(notification_message);
+       free(notification_message);
 
        cprintf("%d '%s' has been created.\n", CIT_OK, new_room_name);
 }
@@ -1776,6 +1819,8 @@ void cmd_einf(char *ok)
        char infofilename[SIZ];
        char buf[SIZ];
 
+       unbuffer_output();
+
        if (CtdlAccessCheck(ac_room_aide)) return;
 
        if (atoi(ok) == 0) {
@@ -1794,7 +1839,7 @@ void cmd_einf(char *ok)
        cprintf("%d Send info...\n", SEND_LISTING);
 
        do {
-               client_gets(buf);
+               client_getln(buf, sizeof buf);
                if (strcmp(buf, "000"))
                        fprintf(fp, "%s\n", buf);
        } while (strcmp(buf, "000"));
@@ -1838,13 +1883,13 @@ void cmd_lflr(void)
  */
 void cmd_cflr(char *argbuf)
 {
-       char new_floor_name[SIZ];
+       char new_floor_name[256];
        struct floor flbuf;
        int cflr_ok;
        int free_slot = (-1);
        int a;
 
-       extract(new_floor_name, argbuf, 0);
+       extract_token(new_floor_name, argbuf, 0, '|', sizeof new_floor_name);
        cflr_ok = extract_int(argbuf, 1);
 
        if (CtdlAccessCheck(ac_aide)) return;
@@ -1962,7 +2007,7 @@ void cmd_eflr(char *argbuf)
                return;
        }
        if (np >= 2)
-               extract(flbuf.f_name, argbuf, 1);
+               extract_token(flbuf.f_name, argbuf, 1, '|', sizeof flbuf.f_name);
        lputfloor(&flbuf, floor_num);
 
        cprintf("%d Ok\n", CIT_OK);