*/
int lgetroom(struct quickroom *qrbuf, char *room_name)
{
- begin_critical_section(S_QUICKROOM);
- return (getroom(qrbuf, room_name));
+ register int retval;
+ retval = getroom(qrbuf, room_name);
+ if (retval == 0) begin_critical_section(S_QUICKROOM);
+ return(retval);
}
/*
* delete_msglist() - delete room message pointers
- * FIXME - this really should check first to make sure there's actually a
- * msglist to delete. As things stand now, calling this function on
- * a room which has never been posted in will result in a message
- * like "gdbm: illegal data" (no big deal, but could use fixing).
*/
void delete_msglist(struct quickroom *whichroom)
{
+ struct cdbdata *cdbml;
- cdb_delete(CDB_MSGLISTS, &whichroom->QRnumber, sizeof(long));
+ /* Make sure the msglist we're deleting actually exists, otherwise
+ * gdbm will complain when we try to delete an invalid record
+ */
+ cdbml = cdb_fetch(CDB_MSGLISTS, &whichroom->QRnumber, sizeof(long));
+ if (cdbml != NULL) {
+ cdb_free(cdbml);
+
+ /* Go ahead and delete it */
+ cdb_delete(CDB_MSGLISTS, &whichroom->QRnumber, sizeof(long));
+ }
}
if (display_result)
cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d\n",
- OK, check_express(),
+ OK, CtdlCheckExpress(),
truncated_roomname,
new_messages, total_messages,
info, CC->quickroom.QRflags,
ERROR + HIGHER_ACCESS_REQUIRED);
return;
}
+
+ /********
if (is_noneditable(&CC->quickroom)) {
cprintf("%d Can't edit this room.\n", ERROR + NOT_HERE);
return;
}
+ ************/
+
getroom(&CC->quickroom, CC->quickroom.QRname);
cprintf("%d%c%s|%s|%s|%d|%d|%d\n",
- OK, check_express(),
+ OK, CtdlCheckExpress(),
CC->quickroom.QRname,
((CC->quickroom.QRflags & QR_PASSWORDED) ? CC->quickroom.QRpasswd : ""),
((CC->quickroom.QRflags & QR_DIRECTORY) ? CC->quickroom.QRdirname : ""),
char old_name[ROOMNAMELEN];
int old_floor;
int new_order = 0;
+ int ne = 0;
if (!(CC->logged_in)) {
cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
ERROR + HIGHER_ACCESS_REQUIRED);
return;
}
+
+
if (is_noneditable(&CC->quickroom)) {
+ ne = 1;
+ }
+
+ /***
cprintf("%d Can't edit this room.\n", ERROR + NOT_HERE);
return;
}
+ ***/
+
+
if (num_parms(args) >= 6) {
getfloor(&flbuf, extract_int(args, 5));
if ((flbuf.f_flags & F_INUSE) == 0) {
new_order = 127;
}
lgetroom(&CC->quickroom, CC->quickroom.QRname);
+
+ /* Non-editable base rooms can't be renamed */
strcpy(old_name, CC->quickroom.QRname);
- extract(buf, args, 0);
- buf[ROOMNAMELEN] = 0;
- safestrncpy(CC->quickroom.QRname, buf, sizeof CC->quickroom.QRname);
+ if (!ne) {
+ extract(buf, args, 0);
+ buf[ROOMNAMELEN] = 0;
+ safestrncpy(CC->quickroom.QRname, buf,
+ sizeof CC->quickroom.QRname);
+ }
+
extract(buf, args, 1);
buf[10] = 0;
safestrncpy(CC->quickroom.QRpasswd, buf, sizeof CC->quickroom.QRpasswd);