Creating rooms
unsigned CtdlCreateRoom(char *new_room_name,
		     int new_room_type,
		     char *new_room_pass,
		     int new_room_floor,
		     int really_create,
		     int avoid_access,
		     int new_room_view)
Parameter Purpose
char *new_room_name A unique name for this new room
int new_room_type The type of room you want to create. 0=public, 1=hidden, 2=passworded, 3=invitation only, 4=mailbox, 5=mailbox but caller supplies namespace.
char *new_room_pass password for accessing this new room
int new_room_floor the floor that this room will be on
int really_create 1=acutally create it, 0=just test to see if the create would succeed.
int avoid_access 1=don't automatically grant the creator access to this room, 0=grant the creator access
int new_room_view Set the default view type of this room
return value meaning
0 creation failed, room already exists
non zero room flags of created room

Many modules use this function at initialisation time to ensure they have a room all of their own to store configuration options etc.

Deleting rooms
int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr);

Check if this user has permission to delete this room

void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf);

Schedule a room to be deleted when the server gets round to it.

You can obtain the ctdlroom struct for a specific room by calling CtdlGetRoom

If you wish to delete a room you should call this function. You should NOT use any other room deletion function.

Do not delete a room at shutdown if you are going to create it again when the server next initialises, just leave it there instead.

Getting Rooms
int CtdlGetRoom(struct ctdlroom *qrbuf, char *room_name);
int CtdlGetRoomLock(struct ctdlroom *qrbuf, char *room_name);

CtdlGetRoomLock performsa the exact same operations as CtdlGetRoom with the exception of locking the record from any updates. If you get a room with CtdlGetRoomLock you MUST unlock it with a call to CtdlPutRoomLock at some point.

Parameter Purpose
struct ctdlroom *qrbuf structure to contain the room information
char * room_name Name of the room to get


0 if the room is not found. 1 if the room was found and the structure pointed to by qrbuf filled with the room details.

Putting Rooms
void CtdlPutRoom(struct ctdlroom *);
void CtdlPutRoomLock(struct ctdlroom *qrbuf);

Updates the current room on disk. Use CtdlPutRoomLock only if you locked the room first with CtdlGetRoomLock.

struct ctdlroom
struct ctdlroom {
 	char QRname[ROOMNAMELEN];	/* Name of room                     */
 	char QRpasswd[10];		/* Only valid if it's a private rm  */
 	long QRroomaide;		/* User number of room aide         */
 	long QRhighest;			/* Highest message NUMBER in room   */
 	time_t QRgen;			/* Generation number of room        */
 	unsigned QRflags;		/* See flag values below            */
 	char QRdirname[15];		/* Directory name, if applicable    */
 	long QRinfo;			/* Info file update relative to msgs*/
 	char QRfloor;			/* Which floor this room is on      */
 	time_t QRmtime;			/* Date/time of last post           */
 	struct ExpirePolicy QRep;	/* Message expiration policy        */
 	long QRnumber;			/* Globally unique room number      */
 	char QRorder;			/* Sort key for room listing order  */
 	unsigned QRflags2;		/* Additional flags                 */
 	int QRdefaultview;		/* How to display the contents      */