void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf);
void CtdlGetFloor (struct floor *flbuf, int floor_num);
void CtdlPutFloor (struct floor *flbuf, int floor_num);
+void CtdlPutFloorLock(struct floor *flbuf, int floor_num);
+int CtdlGetFloorByName(const char *floor_name);
+int CtdlGetFloorByNameLock(const char *floor_name);
+int CtdlGetAvailableFloor(void);
int CtdlIsNonEditable(struct ctdlroom *qrbuf);
void CtdlPutRoom(struct ctdlroom *);
void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix);
+/*
+ * Expose API calls from msgbase.c
+ */
+char *CtdlGetSysConfig(char *sysconfname);
+void CtdlPutSysConfig(char *sysconfname, char *sysconfdata);
+
#endif /* CTDL_MODULE_H */
int do_repl_check, struct CtdlMessage *supplied_msg);
int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *msg);
char *CtdlReadMessageBody(char *terminator, size_t maxlen, char *exist, int crlf, int sock);
-char *CtdlGetSysConfig(char *sysconfname);
-void CtdlPutSysConfig(char *sysconfname, char *sysconfdata);
int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */
int mode, /* how would you like that message? */
int headers_only, /* eschew the message body? */
/****************************************************************************/
+
+/*
+ * CtdlGetFloorByName() - retrieve the number of the named floor
+ * return < 0 if not found else return floor number
+ */
+int CtdlGetFloorByName(const char *floor_name)
+{
+ int a;
+ struct floor *flbuf = NULL;
+
+ for (a = 0; a < MAXFLOORS; ++a) {
+ flbuf = CtdlGetCachedFloor(a);
+
+ /* check to see if it already exists */
+ if ((!strcasecmp(flbuf->f_name, floor_name))
+ && (flbuf->f_flags & F_INUSE)) {
+ return a;
+ }
+ }
+ return -1;
+}
+
+
+
+/*
+ * CtdlGetFloorByNameLock() - retrieve floor number for given floor and lock the floor list.
+ */
+int CtdlGetFloorByNameLock(const char *floor_name)
+{
+ begin_critical_section(S_FLOORTAB);
+ return CtdlGetFloorByName(floor_name);
+}
+
+
+
+/*
+ * CtdlGetAvailableFloor() - Return number of first unused floor
+ * return < 0 if none available
+ */
+int CtdlGetAvailableFloor(void)
+{
+ int a;
+ struct floor *flbuf = NULL;
+
+ for (a = 0; a < MAXFLOORS; a++) {
+ flbuf = CtdlGetCachedFloor(a);
+
+ /* check to see if it already exists */
+ if ((flbuf->f_flags & F_INUSE) == 0) {
+ return a;
+ }
+ }
+ return -1;
+}
+
+
/*
* CtdlGetFloor() - retrieve floor data from disk
*/
}
+
/*
- * lputfloor() - same as CtdlPutFloor() but unlocks the record (if supported)
+ * CtdlPutFloorLock() - same as CtdlPutFloor() but unlocks the record (if supported)
*/
-void lputfloor(struct floor *flbuf, int floor_num)
+void CtdlPutFloorLock(struct floor *flbuf, int floor_num)
{
CtdlPutFloor(flbuf, floor_num);
}
+
+/*
+ * lputfloor() - same as CtdlPutFloor() but unlocks the record (if supported)
+ */
+void lputfloor(struct floor *flbuf, int floor_num)
+{
+ CtdlPutFloorLock(flbuf, floor_num);
+}
+
+
/*
* Traverse the room file...
*/