check_ref_counts();
CtdlLogPrintf(CTDL_INFO, "Creating base rooms (if necessary)\n");
- create_room(config.c_baseroom, 0, "", 0, 1, 0, VIEW_BBS);
- create_room(AIDEROOM, 3, "", 0, 1, 0, VIEW_BBS);
- create_room(SYSCONFIGROOM, 3, "", 0, 1, 0, VIEW_BBS);
- create_room(config.c_twitroom, 0, "", 0, 1, 0, VIEW_BBS);
+ CtdlCreateRoom(config.c_baseroom, 0, "", 0, 1, 0, VIEW_BBS);
+ CtdlCreateRoom(AIDEROOM, 3, "", 0, 1, 0, VIEW_BBS);
+ CtdlCreateRoom(SYSCONFIGROOM, 3, "", 0, 1, 0, VIEW_BBS);
+ CtdlCreateRoom(config.c_twitroom, 0, "", 0, 1, 0, VIEW_BBS);
/* The "Local System Configuration" room doesn't need to be visible */
- if (lgetroom(&qrbuf, SYSCONFIGROOM) == 0) {
+ if (CtdlGetRoomLock(&qrbuf, SYSCONFIGROOM) == 0) {
qrbuf.QRflags2 |= QR2_SYSTEM;
- lputroom(&qrbuf);
+ CtdlPutRoomLock(&qrbuf);
}
/* Aide needs to be public postable, else we're not RFC conformant. */
- if (lgetroom(&qrbuf, AIDEROOM) == 0) {
+ if (CtdlGetRoomLock(&qrbuf, AIDEROOM) == 0) {
qrbuf.QRflags2 |= QR2_SMTP_PUBLIC;
- lputroom(&qrbuf);
+ CtdlPutRoomLock(&qrbuf);
}
CtdlLogPrintf(CTDL_INFO, "Seeding the pseudo-random number generator...\n");
room_fixed = 1;
}
- getroom (&room, qrbuf->QRname);
+ CtdlGetRoom (&room, qrbuf->QRname);
/* Load the message list */
cdbfr = cdb_fetch(CDB_MSGLISTS, &room.QRnumber, sizeof(long));
CtdlLogPrintf(CTDL_INFO, "Checking/re-building control record\n");
get_control();
// Find highest room number and message number.
- ForEachRoom(control_find_highest, NULL);
+ CtdlForEachRoom(control_find_highest, NULL);
ForEachUser(control_find_user, NULL);
put_control();
}
aide_message(buf,"Citadel Configuration Manager Message");
if (!IsEmptyStr(config.c_logpages))
- create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
+ CtdlCreateRoom(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
/* If full text indexing has been disabled, invalidate the
* index so it doesn't try to use it later.
struct RoomProcList *ptr;
struct ctdlroom qr;
- /* Lazy programming here. Call this function as a ForEachRoom backend
+ /* Lazy programming here. Call this function as a CtdlForEachRoom backend
* in order to queue up the room names, or call it with a null room
* to make it do the processing.
*/
}
while (rplist != NULL) {
- if (getroom(&qr, rplist->name) == 0) {
+ if (CtdlGetRoom(&qr, rplist->name) == 0) {
if (DoesThisRoomNeedEuidIndexing(&qr)) {
CtdlLogPrintf(CTDL_DEBUG,
"Rebuilding EUID index for <%s>\n",
rplist->name);
- usergoto(rplist->name, 0, 0, NULL, NULL);
+ CtdlUserGoto(rplist->name, 0, 0, NULL, NULL);
CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL,
rebuild_euid_index_for_msg, NULL);
}
*/
void rebuild_euid_index(void) {
cdb_trunc(CDB_EUIDINDEX); /* delete the old indices */
- ForEachRoom(rebuild_euid_index_for_room, NULL); /* enumerate rm names */
+ CtdlForEachRoom(rebuild_euid_index_for_room, NULL); /* enumerate rm names */
rebuild_euid_index_for_room(NULL, NULL); /* and index them */
}
return;
}
- if (getroom(&qrbuf, newroom) != 0) {
+ if (CtdlGetRoom(&qrbuf, newroom) != 0) {
cprintf("%d '%s' does not exist.\n", ERROR + ROOM_NOT_FOUND, newroom);
return;
}
}
cdb_begin_transaction();
- ForEachRoom(check_ref_counts_backend, (void *)new_refcounts );
+ CtdlForEachRoom(check_ref_counts_backend, (void *)new_refcounts );
cdb_end_transaction();
for (a=0; a<MAXFLOORS; ++a) {
*/
long CtdlGetCurrentMessageNumber(void);
+
+
+/*
+ * Expose various room operation functions from room_ops.c to the modules API
+ */
+
+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);
+int CtdlGetRoom(struct ctdlroom *qrbuf, char *room_name);
+int CtdlGetRoomLock(struct ctdlroom *qrbuf, char *room_name);
+int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr);
+void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
+ int *result, int *view);
+void CtdlPutRoomLock(struct ctdlroom *qrbuf);
+void CtdlForEachRoom(void (*CallBack)(struct ctdlroom *EachRoom, void *out_data),
+ void *in_data);
+void CtdlDeleteRoom(struct ctdlroom *qrbuf);
+int CtdlRenameRoom(char *old_name, char *new_name, int new_floor);
+void CtdlUserGoto (char *where, int display_result, int transiently,
+ int *msgs, int *new);
+struct floor *CtdlGetCachedFloor(int floor_num);
+void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf);
+void CtdlGetFloor (struct floor *flbuf, int floor_num);
+void CtdlPutFloor (struct floor *flbuf, int floor_num);
+int CtdlIsNonEditable(struct ctdlroom *qrbuf);
+void CtdlPutRoom(struct ctdlroom *);
+
+/*
+ * Possible return values for CtdlRenameRoom()
+ */
+enum {
+ crr_ok, /* success */
+ crr_room_not_found, /* room not found */
+ crr_already_exists, /* new name already exists */
+ crr_noneditable, /* cannot edit this room */
+ crr_invalid_floor, /* target floor does not exist */
+ crr_access_denied /* not allowed to edit this room */
+};
+
#endif /* CTDL_MODULE_H */
#include "config.h"
#include "msgbase.h"
#include "user_ops.h"
-#include "room_ops.h"
#include "database.h"
#include "serv_autocompletion.h"
* Gather up message pointers in rooms containing vCards
*/
for (r=0; r < (sizeof(rooms_to_try) / sizeof(char *)); ++r) {
- if (getroom(&CC->room, rooms_to_try[r]) == 0) {
+ if (CtdlGetRoom(&CC->room, rooms_to_try[r]) == 0) {
cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
if (cdbfr != NULL) {
msglist = realloc(msglist, (num_msgs * sizeof(long)) + cdbfr->len + 1);
cprintf("000\n");
if (strcmp(CC->room.QRname, hold_rm)) {
- getroom(&CC->room, hold_rm); /* return to saved room */
+ CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
}
if (msglist) {
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "support.h"
#include "config.h"
#include "user_ops.h"
-#include "room_ops.h"
#include "msgbase.h"
#include "internet_addressing.h"
#include "serv_calendar.h"
strcpy(hold_rm, CC->room.QRname); /* save current room */
- if (getroom(&CC->room, USERCALENDARROOM) != 0) {
- getroom(&CC->room, hold_rm);
+ if (CtdlGetRoom(&CC->room, USERCALENDARROOM) != 0) {
+ CtdlGetRoom(&CC->room, hold_rm);
CtdlLogPrintf(CTDL_CRIT, "cannot get user calendar room\n");
return(2);
}
*/
msgnum_being_replaced = locate_message_by_euid(uid, &CC->room);
- getroom(&CC->room, hold_rm); /* return to saved room */
+ CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
CtdlLogPrintf(CTDL_DEBUG, "msgnum_being_replaced == %ld\n", msgnum_being_replaced);
if (msgnum_being_replaced == 0) {
strcpy(hold_rm, CC->room.QRname); /* save current room */
- if (getroom(&CC->room, USERCALENDARROOM) != 0) {
- getroom(&CC->room, hold_rm);
+ if (CtdlGetRoom(&CC->room, USERCALENDARROOM) != 0) {
+ CtdlGetRoom(&CC->room, hold_rm);
cprintf("%d You do not have a calendar.\n", ERROR + ROOM_NOT_FOUND);
return;
}
);
cprintf("000\n");
- getroom(&CC->room, hold_rm); /* return to saved room */
+ CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
}
strcpy(hold_rm, CC->room.QRname); /* save current room */
- if (getroom(&CC->room, calendar_room_name) != 0) {
+ if (CtdlGetRoom(&CC->room, calendar_room_name) != 0) {
cprintf("%d Cannot open calendar\n", ERROR + ROOM_NOT_FOUND);
- getroom(&CC->room, hold_rm);
+ CtdlGetRoom(&CC->room, hold_rm);
return;
}
if (fb == NULL) {
cprintf("%d Internal error: cannot allocate memory.\n",
ERROR + INTERNAL_ERROR);
- getroom(&CC->room, hold_rm);
+ CtdlGetRoom(&CC->room, hold_rm);
return;
}
icalcomponent_free(fb);
cprintf("%d Internal error: cannot allocate memory.\n",
ERROR + INTERNAL_ERROR);
- getroom(&CC->room, hold_rm);
+ CtdlGetRoom(&CC->room, hold_rm);
return;
}
cprintf("\n000\n");
/* Go back to the room from which we came... */
- getroom(&CC->room, hold_rm);
+ CtdlGetRoom(&CC->room, hold_rm);
}
/*
* We don't know if the calendar room exists so we just create it at login
*/
-void ical_create_room(void)
+void ical_CtdlCreateRoom(void)
{
struct ctdlroom qr;
struct visit vbuf;
/* Create the calendar room if it doesn't already exist */
- create_room(USERCALENDARROOM, 4, "", 0, 1, 0, VIEW_CALENDAR);
+ CtdlCreateRoom(USERCALENDARROOM, 4, "", 0, 1, 0, VIEW_CALENDAR);
/* Set expiration policy to manual; otherwise objects will be lost! */
- if (lgetroom(&qr, USERCALENDARROOM)) {
+ if (CtdlGetRoomLock(&qr, USERCALENDARROOM)) {
CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
qr.QRdefaultview = VIEW_CALENDAR; /* 3 = calendar view */
- lputroom(&qr);
+ CtdlPutRoomLock(&qr);
/* Set the view to a calendar view */
CtdlGetRelationship(&vbuf, &CC->user, &qr);
CtdlSetRelationship(&vbuf, &CC->user, &qr);
/* Create the tasks list room if it doesn't already exist */
- create_room(USERTASKSROOM, 4, "", 0, 1, 0, VIEW_TASKS);
+ CtdlCreateRoom(USERTASKSROOM, 4, "", 0, 1, 0, VIEW_TASKS);
/* Set expiration policy to manual; otherwise objects will be lost! */
- if (lgetroom(&qr, USERTASKSROOM)) {
+ if (CtdlGetRoomLock(&qr, USERTASKSROOM)) {
CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
qr.QRdefaultview = VIEW_TASKS;
- lputroom(&qr);
+ CtdlPutRoomLock(&qr);
/* Set the view to a task list view */
CtdlGetRelationship(&vbuf, &CC->user, &qr);
CtdlSetRelationship(&vbuf, &CC->user, &qr);
/* Create the notes room if it doesn't already exist */
- create_room(USERNOTESROOM, 4, "", 0, 1, 0, VIEW_NOTES);
+ CtdlCreateRoom(USERNOTESROOM, 4, "", 0, 1, 0, VIEW_NOTES);
/* Set expiration policy to manual; otherwise objects will be lost! */
- if (lgetroom(&qr, USERNOTESROOM)) {
+ if (CtdlGetRoomLock(&qr, USERNOTESROOM)) {
CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
qr.QRdefaultview = VIEW_NOTES;
- lputroom(&qr);
+ CtdlPutRoomLock(&qr);
/* Set the view to a notes view */
CtdlGetRelationship(&vbuf, &CC->user, &qr);
/* Initialize our hook functions */
CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
- CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);
+ CtdlRegisterSessionHook(ical_CtdlCreateRoom, EVT_LOGIN);
CtdlRegisterProtoHook(cmd_ical, "ICAL", "Citadel iCal commands");
CtdlRegisterSessionHook(ical_session_startup, EVT_START);
CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP);
#include "config.h"
#include "msgbase.h"
#include "user_ops.h"
-#include "room_ops.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
CtdlInvtKick(CC->user.fullname, 0);
/* And return to the Lobby */
- usergoto(config.c_baseroom, 0, 0, NULL, NULL);
+ CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
return;
}
}
* prefix will be created. That's ok because the auto-purger will clean it up later.
*/
snprintf(roomname, sizeof roomname, "%010ld.%s", im->usernums[1], PAGELOGROOM);
- create_room(roomname, 5, "", 0, 1, 1, VIEW_BBS);
+ CtdlCreateRoom(roomname, 5, "", 0, 1, 1, VIEW_BBS);
msgnum = CtdlSubmitMsg(msg, NULL, roomname, 0);
CtdlFreeMessage(msg);
/* If there is a valid user number in usernums[0], save a copy for them too. */
if (im->usernums[0] > 0) {
snprintf(roomname, sizeof roomname, "%010ld.%s", im->usernums[0], PAGELOGROOM);
- create_room(roomname, 5, "", 0, 1, 1, VIEW_BBS);
+ CtdlCreateRoom(roomname, 5, "", 0, 1, 1, VIEW_BBS);
CtdlSaveMsgPointerInRoom(roomname, msgnum, 0, NULL);
}
/* Finally, if we're logging instant messages globally, do that now. */
if (!IsEmptyStr(config.c_logpages)) {
- create_room(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
+ CtdlCreateRoom(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0, NULL);
}
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "policy.h"
#include "database.h"
#include "msgbase.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "policy.h"
#include "database.h"
#include "msgbase.h"
return;
}
- ForEachRoom(GatherPurgeMessages, (void *)purgelist );
+ CtdlForEachRoom(GatherPurgeMessages, (void *)purgelist );
DoPurgeMessages(purgelist);
fclose(purgelist);
}
if (qrbuf->QRflags & QR_NETWORK) return;
if (qrbuf->QRflags2 & QR2_SYSTEM) return;
if (!strcasecmp(qrbuf->QRname, SYSCONFIGROOM)) return;
- if (is_noneditable(qrbuf)) return;
+ if (CtdlIsNonEditable(qrbuf)) return;
/* If we don't know the modification date, be safe and don't purge */
if (qrbuf->QRmtime <= (time_t)0) return;
ForEachUser(AddValidUser, NULL);
/* Then cycle through the room file */
- ForEachRoom(DoPurgeRooms, NULL);
+ CtdlForEachRoom(DoPurgeRooms, NULL);
/* Free the valid user list */
while (ValidUserList != NULL) {
strcpy(transcript, "The following rooms have been auto-purged:\n");
while (RoomPurgeList != NULL) {
- if (getroom(&qrbuf, RoomPurgeList->name) == 0) {
+ if (CtdlGetRoom(&qrbuf, RoomPurgeList->name) == 0) {
transcript=realloc(transcript, strlen(transcript)+SIZ);
snprintf(&transcript[strlen(transcript)], SIZ, " %s\n",
qrbuf.QRname);
- delete_room(&qrbuf);
+ CtdlDeleteRoom(&qrbuf);
}
pptr = RoomPurgeList->next;
free(RoomPurgeList);
int RoomIsValid, UserIsValid;
/* First, load up a table full of valid room/gen combinations */
- ForEachRoom(AddValidRoom, NULL);
+ CtdlForEachRoom(AddValidRoom, NULL);
/* Then load up a table full of valid user numbers */
ForEachUser(AddValidUser, NULL);
void do_fsck_room(struct ctdlroom *qrbuf, void *data)
{
- getroom(&CC->room, qrbuf->QRname);
+ CtdlGetRoom(&CC->room, qrbuf->QRname);
CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL, do_fsck_msg, NULL);
}
cprintf("\nThis could take a while. Please be patient!\n\n");
cprintf("Gathering pointers...\n");
- ForEachRoom(do_fsck_room, NULL);
+ CtdlForEachRoom(do_fsck_room, NULL);
get_control();
cprintf("Checking message base...\n");
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
void create_extnotify_queue(void) {
struct ctdlroom qrbuf;
- create_room(FNBL_QUEUE_ROOM, 3, "", 0, 1, 0, VIEW_MAILBOX);
+ CtdlCreateRoom(FNBL_QUEUE_ROOM, 3, "", 0, 1, 0, VIEW_MAILBOX);
/*
* Make sure it's set to be a "system room" so it doesn't show up
* in the <K>nown rooms list for Aides.
*/
- if (lgetroom(&qrbuf, FNBL_QUEUE_ROOM) == 0) {
+ if (CtdlGetRoomLock(&qrbuf, FNBL_QUEUE_ROOM) == 0) {
qrbuf.QRflags2 |= QR2_SYSTEM;
- lputroom(&qrbuf);
+ CtdlPutRoomLock(&qrbuf);
}
}
/*!
memset(&Ctx, 0, sizeof(NotifyContext));
Ctx.NotifyHostList = GetNotifyHosts();
- if (getroom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
+ if (CtdlGetRoom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
return;
}
MailboxName(configRoomName, sizeof configRoomName, &user, USERCONFIGROOM);
// Fill qrbuf
- getroom(&qrbuf, configRoomName);
+ CtdlGetRoom(&qrbuf, configRoomName);
/* Do something really, really stoopid here. Raid the room on ourselves,
* loop through the messages manually and find it. I don't want
* to use a CtdlForEachMessage callback here, as we would be
#include "database.h"
#include "msgbase.h"
#include "control.h"
-#include "room_ops.h"
#include "serv_fulltext.h"
#include "ft_wordbreaker.h"
#include "threads.h"
if (CtdlThreadCheckStop())
return;
- getroom(&CC->room, qrbuf->QRname);
+ CtdlGetRoom(&CC->room, qrbuf->QRname);
CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL, ft_index_msg, NULL);
}
* Now go through each room and find messages to index.
*/
ft_newhighest = CitControl.MMhighest;
- ForEachRoom(ft_index_room, NULL); /* load all msg pointers */
+ CtdlForEachRoom(ft_index_room, NULL); /* load all msg pointers */
if (ft_num_msgs > 0) {
qsort(ft_newmsgs, ft_num_msgs, sizeof(long), longcmp);
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "genstamp.h"
+#include "ctdl_module.h"
/*
* Implements the SETACL command.
}
/*
- * usergoto() formally takes us to the desired room. (If another
+ * CtdlUserGoto() formally takes us to the desired room. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
cprintf("* ACL");
cprintf(" ");
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
cprintf("%s OK GETACL completed\r\n", parms[0]);
}
/*
- * usergoto() formally takes us to the desired room. (If another
+ * CtdlUserGoto() formally takes us to the desired room. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
/*
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
cprintf("%s OK LISTRIGHTS completed\r\n", parms[0]);
}
/*
- * usergoto() formally takes us to the desired room. (If another
+ * CtdlUserGoto() formally takes us to the desired room. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
CtdlRoomAccess(&CC->room, &CC->user, &ra, NULL);
imap_acl_flags(rights, ra);
* If a different folder was previously selected, return there now.
*/
if ( (IMAP->selected) && (strcasecmp(roomname, savedroom)) ) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
cprintf("%s OK MYRIGHTS completed\r\n", parms[0]);
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
int match = 0;
for (i = 0; i < MAXFLOORS; ++i) {
- fl = cgetfloor(i);
+ fl = CtdlGetCachedFloor(i);
if (fl->f_flags & F_INUSE) {
match = 0;
for (j=0; j<num_patterns; ++j) {
}
}
- /* Now start setting up the data we're going to send to the ForEachRoom() callback.
+ /* Now start setting up the data we're going to send to the CtdlForEachRoom() callback.
*/
data_for_callback[0] = (char *) verb;
data_for_callback[1] = (char *) subscribed_rooms_only;
*/
else {
imap_list_floors(verb, num_patterns, patterns);
- ForEachRoom(imap_listroom, data_for_callback);
+ CtdlForEachRoom(imap_listroom, data_for_callback);
}
/*
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "imap_misc.h"
#include "genstamp.h"
-
+#include "ctdl_module.h"
/*
* Implements the SETMETADATA command.
}
/*
- * usergoto() formally takes us to the desired room. (If another
+ * CtdlUserGoto() formally takes us to the desired room. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
/*
* Always set the per-user view to the requested one.
)
|| (msgs == 0) /* hack: if room is empty, assume we just created it */
) {
- lgetroom(&CC->room, CC->room.QRname);
+ CtdlGetRoomLock(&CC->room, CC->room.QRname);
CC->room.QRdefaultview = set_view;
- lputroom(&CC->room);
+ CtdlPutRoomLock(&CC->room);
cprintf("%s OK SETANNOTATION complete\r\n", parms[0]);
}
* If a different folder was previously selected, return there now.
*/
if ( (IMAP->selected) && (strcasecmp(roomname, savedroom)) ) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
return;
}
}
/*
- * usergoto() formally takes us to the desired room. (If another
+ * CtdlUserGoto() formally takes us to the desired room. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
cprintf("* METADATA ");
imap_strout(parms[2]);
* If a different folder was previously selected, return there now.
*/
if ( (IMAP->selected) && (strcasecmp(roomname, savedroom)) ) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
cprintf("%s OK GETMETADATA complete\r\n", parms[0]);
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
}
/* Set the flags... */
- i = getroom(&qrbuf, roomname);
+ i = CtdlGetRoom(&qrbuf, roomname);
if (i == 0) {
CtdlSetSeen(seen_yes, num_seen_yes, 1, ctdlsetseen_seen, NULL, &qrbuf);
CtdlSetSeen(seen_no, num_seen_no, 0, ctdlsetseen_seen, NULL, &qrbuf);
}
/*
- * usergoto() formally takes us to the desired room. (If another
+ * CtdlUserGoto() formally takes us to the desired room. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (Imap->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
/* If the user is locally authenticated, FORCE the From: header to
* show up as the real sender. FIXME do we really want to do this?
* our happy day without violent explosions.
*/
if (Imap->selected) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
/* We don't need this buffer anymore */
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include <libcitadel.h>
#include "citadel.h"
#include "sysdep_decls.h"
-#include "room_ops.h"
#include "internet_addressing.h"
#include "imap_tools.h"
#include "ctdl_module.h"
{
/* Otherwise, prefix the floor name as a "public folders" moniker. */
- fl = cgetfloor(qrbuf->QRfloor);
+ fl = CtdlGetCachedFloor(qrbuf->QRfloor);
p = toimap(p, bufend, fl->f_name);
if (p < bufend)
*p++ = '/';
for (i = 0; i < MAXFLOORS; ++i)
{
- fl = cgetfloor(i);
+ fl = CtdlGetCachedFloor(i);
if (fl->f_flags & F_INUSE)
{
if (strcasecmp(floorname, fl->f_name) == 0)
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
* Check to see if the room's contents have changed.
* If not, we can avoid this rescan.
*/
- getroom(&CC->room, CC->room.QRname);
+ CtdlGetRoom(&CC->room, CC->room.QRname);
if (IMAP->last_mtime == CC->room.QRmtime) { /* No changes! */
return;
}
roomflags = (i & 0xff00);
/* First try a regular match */
- c = getroom(&QRscratch, towhere);
+ c = CtdlGetRoom(&QRscratch, towhere);
/* Then try a mailbox name match */
if (c != 0) {
MailboxName(augmented_roomname, sizeof augmented_roomname,
&CC->user, towhere);
- c = getroom(&QRscratch, augmented_roomname);
+ c = CtdlGetRoom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(towhere, augmented_roomname);
}
imap_do_expunge();
/*
- * usergoto() formally takes us to the desired room, happily returning
+ * CtdlUserGoto() formally takes us to the desired room, happily returning
* the number of messages and number of new messages.
*/
memcpy(&CC->room, &QRscratch, sizeof(struct ctdlroom));
- usergoto(NULL, 0, 0, &msgs, &new);
+ CtdlUserGoto(NULL, 0, 0, &msgs, &new);
IMAP->selected = 1;
if (!strcasecmp(parms[1], "EXAMINE")) {
/* Show all floors as shared namespaces. Neato! */
cprintf("(");
for (i = 0; i < MAXFLOORS; ++i) {
- fl = cgetfloor(i);
+ fl = CtdlGetCachedFloor(i);
if (fl->f_flags & F_INUSE) {
if (floors > 0) cprintf(" ");
cprintf("(");
CtdlLogPrintf(CTDL_INFO, "Create new room <%s> on floor <%d> with type <%d>\n",
roomname, floornum, newroomtype);
- ret = create_room(roomname, newroomtype, "", floornum, 1, 0, newroomview);
+ ret = CtdlCreateRoom(roomname, newroomtype, "", floornum, 1, 0, newroomview);
if (ret == 0) {
/*** DO NOT CHANGE THIS ERROR MESSAGE IN ANY WAY! BYNARI CONNECTOR DEPENDS ON IT! ***/
cprintf("%s NO Mailbox already exists, or create failed\r\n", parms[0]);
}
/* First try a regular match */
- c = getroom(&QRscratch, roomname);
+ c = CtdlGetRoom(&QRscratch, roomname);
/* Then try a mailbox name match */
if (c != 0) {
MailboxName(augmented_roomname, sizeof augmented_roomname,
&CC->user, roomname);
- c = getroom(&QRscratch, augmented_roomname);
+ c = CtdlGetRoom(&QRscratch, augmented_roomname);
if (c == 0)
strcpy(roomname, augmented_roomname);
}
}
/*
- * usergoto() formally takes us to the desired room, happily returning
+ * CtdlUserGoto() formally takes us to the desired room, happily returning
* the number of messages and number of new messages. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
/*
* Tell the client what it wants to know. In fact, tell it *more* than
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
/*
}
/*
- * usergoto() formally takes us to the desired room, which has the side
+ * CtdlUserGoto() formally takes us to the desired room, which has the side
* effect of marking the room as not-zapped ... exactly the effect
* we're looking for.
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
/*
* If another folder is selected, go back to that room so we can resume
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
cprintf("%s OK SUBSCRIBE completed\r\n", parms[0]);
}
/*
- * usergoto() formally takes us to the desired room.
+ * CtdlUserGoto() formally takes us to the desired room.
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
/*
* Now make the API call to zap the room
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
}
}
/*
- * usergoto() formally takes us to the desired room, happily returning
+ * CtdlUserGoto() formally takes us to the desired room, happily returning
* the number of messages and number of new messages. (If another
* folder is selected, save its name so we can return there!!!!!)
*/
if (IMAP->selected) {
strcpy(savedroom, CC->room.QRname);
}
- usergoto(roomname, 0, 0, &msgs, &new);
+ CtdlUserGoto(roomname, 0, 0, &msgs, &new);
/*
* Now delete the room.
*/
if (CtdlDoIHavePermissionToDeleteThisRoom(&CC->room)) {
- schedule_room_for_deletion(&CC->room);
+ CtdlScheduleRoomForDeletion(&CC->room);
cprintf("%s OK DELETE completed\r\n", parms[0]);
} else {
cprintf("%s NO Can't delete this folder.\r\n", parms[0]);
* our happy day without violent explosions.
*/
if (IMAP->selected) {
- usergoto(savedroom, 0, 0, &msgs, &new);
+ CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
}
}
* (already did that) and create a new inbox.
*/
if (!strcasecmp(parms[2], "INBOX")) {
- create_room(MAILROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
+ CtdlCreateRoom(MAILROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
}
/* Otherwise, do the subfolders. Build a list of rooms to rename... */
irlparms.oldname = parms[2];
irlparms.newname = parms[3];
irlparms.irl = &irl;
- ForEachRoom(imap_rename_backend, (void *) &irlparms);
+ CtdlForEachRoom(imap_rename_backend, (void *) &irlparms);
/* ... and now rename them. */
while (irl != NULL) {
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
void inetcfg_init(void) {
- if (getroom(&CC->room, SYSCONFIGROOM) != 0) return;
+ if (CtdlGetRoom(&CC->room, SYSCONFIGROOM) != 0) return;
CtdlForEachMessage(MSGS_LAST, 1, NULL, INTERNETCFG, NULL,
inetcfg_init_backend, NULL);
}
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
char scanemail[256];
int found_sub = 0;
- if (getroom(&qrbuf, room) != 0) {
+ if (CtdlGetRoom(&qrbuf, room) != 0) {
cprintf("%d There is no list called '%s'\n", ERROR + ROOM_NOT_FOUND, room);
return;
}
char scanemail[256];
int found_sub = 0;
- if (getroom(&qrbuf, room) != 0) {
+ if (CtdlGetRoom(&qrbuf, room) != 0) {
cprintf("%d There is no list called '%s'\n",
ERROR + ROOM_NOT_FOUND, room);
return;
strcpy(address_to_unsubscribe, "");
- if (getroom(&qrbuf, room) != 0) {
+ if (CtdlGetRoom(&qrbuf, room) != 0) {
cprintf("%d There is no list called '%s'\n",
ERROR + ROOM_NOT_FOUND, room);
return;
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "database.h"
#include "msgbase.h"
#include "user_ops.h"
-#include "room_ops.h"
#include "control.h"
#include "euidindex.h"
/* message list goes inside this tag */
- getroom(&CC->room, buf->QRname);
+ CtdlGetRoom(&CC->room, buf->QRname);
client_write("<room_messages>", 15);
client_write("<FRname>", 8); xml_strout(CC->room.QRname); client_write("</FRname>\n", 10);
client_write("<FRmsglist>", 11);
char cmd[SIZ];
migr_global_message_list = fopen(migr_tempfilename1, "w");
if (migr_global_message_list != NULL) {
- ForEachRoom(migr_export_rooms_backend, NULL);
+ CtdlForEachRoom(migr_export_rooms_backend, NULL);
fclose(migr_global_message_list);
}
for (i=0; i < MAXFLOORS; ++i) {
client_write("<floor>\n", 8);
cprintf("<f_num>%d</f_num>\n", i);
- getfloor(&qfbuf, i);
+ CtdlGetFloor(&qfbuf, i);
buf = &qfbuf;
cprintf("<f_flags>%u</f_flags>\n", buf->f_flags);
client_write("<f_name>", 8); xml_strout(buf->f_name); client_write("</f_name>\n", 10);
else if (!strcasecmp(el, "QRdefaultview")) qrbuf.QRdefaultview = atoi(migr_chardata);
else if (!strcasecmp(el, "room")) {
- putroom(&qrbuf);
+ CtdlPutRoom(&qrbuf);
CtdlLogPrintf(CTDL_INFO, "Imported room: %s\n", qrbuf.QRname);
}
else if (!strcasecmp(el, "f_ep_expire_value")) flbuf.f_ep.expire_value = atoi(migr_chardata);
else if (!strcasecmp(el, "floor")) {
- putfloor(&flbuf, floornum);
+ CtdlPutFloor(&flbuf, floornum);
CtdlLogPrintf(CTDL_INFO, "Imported floor #%d (%s)\n", floornum, flbuf.f_name);
}
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
* Normally this should never happen, but once in a while maybe a room gets
* queued for networking and then deleted before it can happen.
*/
- if (getroom(&CC->room, room_to_spool) != 0) {
+ if (CtdlGetRoom(&CC->room, room_to_spool) != 0) {
CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", room_to_spool);
return;
}
*/
if (full_processing && !CtdlThreadCheckStop()) {
CtdlLogPrintf(CTDL_DEBUG, "network: loading outbound queue\n");
- ForEachRoom(network_queue_room, NULL);
+ CtdlForEachRoom(network_queue_room, NULL);
}
if (rplist != NULL) {
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
/* Go to the source room ... bail out silently if it's not there,
* or if it's not private.
*/
- if (getroom(&CC->room, NEWUSERGREETINGS) != 0) return;
+ if (CtdlGetRoom(&CC->room, NEWUSERGREETINGS) != 0) return;
if (! CC->room.QRflags & QR_PRIVATE ) return;
cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
struct visit vbuf;
int i;
- if (getroom(&CC->room, MAILROOM) != 0) return(-1);
+ if (CtdlGetRoom(&CC->room, MAILROOM) != 0) return(-1);
/* Load up the messages */
CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL,
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "ctdl_module.h"
#include "clientsocket.h"
#include "msgbase.h"
doing_pop3client = 1;
CtdlLogPrintf(CTDL_DEBUG, "pop3client started\n");
- ForEachRoom(pop3client_scan_room, NULL);
+ CtdlForEachRoom(pop3client_scan_room, NULL);
while (palist != NULL && !CtdlThreadCheckStop()) {
if ((palist->interval && time(NULL) > (last_run + palist->interval))
#include "support.h"
#include "config.h"
#include "threads.h"
-#include "room_ops.h"
#include "ctdl_module.h"
#include "clientsocket.h"
#include "msgbase.h"
doing_rssclient = 1;
CtdlLogPrintf(CTDL_DEBUG, "rssclient started\n");
- ForEachRoom(rssclient_scan_room, NULL);
+ CtdlForEachRoom(rssclient_scan_room, NULL);
while (rnclist != NULL && !CtdlThreadCheckStop()) {
rss_do_fetching(rnclist->url, rnclist->rooms);
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "room_ops.h"
#include "policy.h"
#include "database.h"
#include "msgbase.h"
/* First try a mailbox name match (check personal mail folders first) */
snprintf(foldername, sizeof foldername, "%010ld.%s", cs->usernum, dest_folder);
- c = getroom(&CC->room, foldername);
+ c = CtdlGetRoom(&CC->room, foldername);
/* Then a regular room name match (public and private rooms) */
if (c != 0) {
safestrncpy(foldername, dest_folder, sizeof foldername);
- c = getroom(&CC->room, foldername);
+ c = CtdlGetRoom(&CC->room, foldername);
}
if (c != 0) {
}
/* Yes, we actually have to go there */
- usergoto(NULL, 0, 0, NULL, NULL);
+ CtdlUserGoto(NULL, 0, 0, NULL, NULL);
c = CtdlSaveMsgPointersInRoom(NULL, &cs->msgnum, 1, 0, NULL);
/* Go back to the room we came from */
if (strcasecmp(original_room_name, CC->room.QRname)) {
- usergoto(original_room_name, 0, 0, NULL, NULL);
+ CtdlUserGoto(original_room_name, 0, 0, NULL, NULL);
}
if (c == 0) {
* require execution.
*/
snprintf(u.config_roomname, sizeof u.config_roomname, "%010ld.%s", atol(roomname), USERCONFIGROOM);
- if (getroom(&CC->room, u.config_roomname) != 0) {
+ if (CtdlGetRoom(&CC->room, u.config_roomname) != 0) {
CtdlLogPrintf(CTDL_DEBUG, "<%s> does not exist. No processing is required.\n", u.config_roomname);
return;
}
CtdlLogPrintf(CTDL_DEBUG, "Rules found. Performing Sieve processing for <%s>\n", roomname);
- if (getroom(&CC->room, roomname) != 0) {
+ if (CtdlGetRoom(&CC->room, roomname) != 0) {
CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", roomname);
return;
}
strcpy(hold_rm, CC->room.QRname); /* save current room */
/* Take a spin through the user's personal address book */
- if (getroom(&CC->room, USERCONFIGROOM) == 0) {
+ if (CtdlGetRoom(&CC->room, USERCONFIGROOM) == 0) {
u->config_msgnum = (-1);
strcpy(u->config_roomname, CC->room.QRname);
}
if (strcmp(CC->room.QRname, hold_rm)) {
- getroom(&CC->room, hold_rm); /* return to saved room */
+ CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
}
}
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
*/
CtdlLogPrintf(CTDL_INFO, "SMTP client: processing outbound queue\n");
- if (getroom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
+ if (CtdlGetRoom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
return;
}
* Create the room. This will silently fail if the room already
* exists, and that's perfectly ok, because we want it to exist.
*/
- create_room(SMTP_SPOOLOUT_ROOM, 3, "", 0, 1, 0, VIEW_MAILBOX);
+ CtdlCreateRoom(SMTP_SPOOLOUT_ROOM, 3, "", 0, 1, 0, VIEW_MAILBOX);
/*
* Make sure it's set to be a "system room" so it doesn't show up
* in the <K>nown rooms list for Aides.
*/
- if (lgetroom(&qrbuf, SMTP_SPOOLOUT_ROOM) == 0) {
+ if (CtdlGetRoomLock(&qrbuf, SMTP_SPOOLOUT_ROOM) == 0) {
qrbuf.QRflags2 |= QR2_SYSTEM;
- lputroom(&qrbuf);
+ CtdlPutRoomLock(&qrbuf);
}
}
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "config.h"
#include "control.h"
#include "database.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "msgbase.h"
#include "serv_upgrade.h"
struct RoomProcList *ptr;
struct ctdlroom qr;
- /* Lazy programming here. Call this function as a ForEachRoom backend
+ /* Lazy programming here. Call this function as a CtdlForEachRoom backend
* in order to queue up the room names, or call it with a null room
* to make it do the processing.
*/
while (rplist != NULL) {
- if (lgetroom(&qr, rplist->name) == 0) {
+ if (CtdlGetRoomLock(&qr, rplist->name) == 0) {
CtdlLogPrintf(CTDL_DEBUG, "Processing <%s>...\n", rplist->name);
if ( (qr.QRflags & QR_MAILBOX) == 0) {
CtdlLogPrintf(CTDL_DEBUG, " -- not a mailbox\n");
qr.QRgen = time(NULL);
CtdlLogPrintf(CTDL_DEBUG, " -- fixed!\n");
}
- lputroom(&qr);
+ CtdlPutRoomLock(&qr);
}
ptr = rplist;
*/
void bump_mailbox_generation_numbers(void) {
CtdlLogPrintf(CTDL_WARNING, "Applying security fix to mailbox rooms\n");
- ForEachRoom(cmd_bmbx_backend, NULL);
+ CtdlForEachRoom(cmd_bmbx_backend, NULL);
cmd_bmbx_backend(NULL, NULL);
return;
}
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
strcpy(hold_rm, CC->room.QRname); /* save current room */
- if (getroom(&CC->room, ADDRESS_BOOK_ROOM) != 0) {
- getroom(&CC->room, hold_rm);
+ if (CtdlGetRoom(&CC->room, ADDRESS_BOOK_ROOM) != 0) {
+ CtdlGetRoom(&CC->room, hold_rm);
cprintf("%d cannot get address book room\n", ERROR + ROOM_NOT_FOUND);
return;
}
CtdlForEachMessage(MSGS_ALL, 0, NULL, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
NULL, vcard_add_to_directory, NULL);
- getroom(&CC->room, hold_rm); /* return to saved room */
+ CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
cprintf("%d Directory has been rebuilt.\n", CIT_OK);
}
strcpy(hold_rm, CC->room.QRname); /* save current room */
MailboxName(config_rm, sizeof config_rm, u, USERCONFIGROOM);
- if (getroom(&CC->room, config_rm) != 0) {
- getroom(&CC->room, hold_rm);
+ if (CtdlGetRoom(&CC->room, config_rm) != 0) {
+ CtdlGetRoom(&CC->room, hold_rm);
return vcard_new();
}
VCmsgnum = (-1);
CtdlForEachMessage(MSGS_LAST, 1, NULL, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$",
NULL, vcard_gu_backend, (void *)&VCmsgnum );
- getroom(&CC->room, hold_rm); /* return to saved room */
+ CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */
if (VCmsgnum < 0L) return vcard_new();
/*
* We don't know if the Contacts room exists so we just create it at login
*/
-void vcard_create_room(void)
+void vcard_CtdlCreateRoom(void)
{
struct ctdlroom qr;
struct visit vbuf;
/* Create the calendar room if it doesn't already exist */
- create_room(USERCONTACTSROOM, 4, "", 0, 1, 0, VIEW_ADDRESSBOOK);
+ CtdlCreateRoom(USERCONTACTSROOM, 4, "", 0, 1, 0, VIEW_ADDRESSBOOK);
/* Set expiration policy to manual; otherwise objects will be lost! */
- if (lgetroom(&qr, USERCONTACTSROOM)) {
+ if (CtdlGetRoomLock(&qr, USERCONTACTSROOM)) {
CtdlLogPrintf(CTDL_ERR, "Couldn't get the user CONTACTS room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
qr.QRdefaultview = VIEW_ADDRESSBOOK; /* 2 = address book view */
- lputroom(&qr);
+ CtdlPutRoomLock(&qr);
/* Set the view to a calendar view */
CtdlGetRelationship(&vbuf, &CC->user, &qr);
/*
* Create the user's 'Contacts' room (personal address book) if it doesn't already exist.
*/
- vcard_create_room();
+ vcard_CtdlCreateRoom();
}
int i;
/* First remove any addresses we already have in the address book */
- usergoto(aptr->roomname, 0, 0, NULL, NULL);
+ CtdlUserGoto(aptr->roomname, 0, 0, NULL, NULL);
CtdlForEachMessage(MSGS_ALL, 0, NULL, "^[Tt][Ee][Xx][Tt]/.*[Vv][Cc][Aa][Rr][Dd]$", NULL,
strip_addresses_already_have, aptr->collected_addresses);
CtdlRegisterFixedOutputHook("text/vcard", vcard_fixed_output);
/* Create the Global ADdress Book room if necessary */
- create_room(ADDRESS_BOOK_ROOM, 3, "", 0, 1, 0, VIEW_ADDRESSBOOK);
+ CtdlCreateRoom(ADDRESS_BOOK_ROOM, 3, "", 0, 1, 0, VIEW_ADDRESSBOOK);
/* Set expiration policy to manual; otherwise objects will be lost! */
- if (!lgetroom(&qr, ADDRESS_BOOK_ROOM)) {
+ if (!CtdlGetRoomLock(&qr, ADDRESS_BOOK_ROOM)) {
qr.QRep.expire_mode = EXPIRE_MANUAL;
qr.QRdefaultview = VIEW_ADDRESSBOOK; /* 2 = address book view */
- lputroom(&qr);
+ CtdlPutRoomLock(&qr);
/*
* Also make sure it has a netconfig file, so the networker runs
#include "support.h"
#include "config.h"
#include "control.h"
-#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
if (num_newmsgs > 1) supplied_msg = NULL;
/* Now the regular stuff */
- if (lgetroom(&CC->room,
+ if (CtdlGetRoomLock(&CC->room,
((roomname != NULL) ? roomname : CC->room.QRname) )
!= 0) {
CtdlLogPrintf(CTDL_ERR, "No such room <%s>\n", roomname);
/* Update the highest-message pointer and unlock the room. */
CC->room.QRhighest = highest_msg;
- lputroom(&CC->room);
+ CtdlPutRoomLock(&CC->room);
/* Perform replication checks if necessary */
if ( (DoesThisRoomNeedEuidIndexing(&CC->room)) && (do_repl_check) ) {
PerformRoomHooks(&CC->room);
/* Go back to the room we were in before we wandered here... */
- getroom(&CC->room, hold_rm);
+ CtdlGetRoom(&CC->room, hold_rm);
/* Bump the reference count for all messages which were merged */
for (i=0; i<num_msgs_to_be_merged; ++i) {
CtdlLogPrintf(CTDL_DEBUG, "Final selection: %s\n", actual_rm);
if (strcasecmp(actual_rm, CCC->room.QRname)) {
- /* getroom(&CCC->room, actual_rm); */
- usergoto(actual_rm, 0, 1, NULL, NULL);
+ /* CtdlGetRoom(&CCC->room, actual_rm); */
+ CtdlUserGoto(actual_rm, 0, 1, NULL, NULL);
}
/*
/* Go back to the room we started from */
CtdlLogPrintf(CTDL_DEBUG, "Returning to original room %s\n", hold_rm);
if (strcasecmp(hold_rm, CCC->room.QRname))
- usergoto(hold_rm, 0, 1, NULL, NULL);
+ CtdlUserGoto(hold_rm, 0, 1, NULL, NULL);
/* For internet mail, generate delivery instructions.
* Yes, this is recursive. Deal with it. Infinite recursion does
strcat(ret->recp_room, this_recp);
}
else if ( (!strncasecmp(this_recp, "room_", 5))
- && (!getroom(&tempQR, &this_recp_cooked[5])) ) {
+ && (!CtdlGetRoom(&tempQR, &this_recp_cooked[5])) ) {
/* Save room so we can restore it later */
tempQR2 = CC->room;
room_name, num_dmsgnums, content_type);
/* get room record, obtaining a lock... */
- if (lgetroom(&qrbuf, room_name) != 0) {
+ if (CtdlGetRoomLock(&qrbuf, room_name) != 0) {
CtdlLogPrintf(CTDL_ERR, "CtdlDeleteMessages(): Room <%s> not found\n",
room_name);
if (need_to_free_re) regfree(&re);
qrbuf.QRhighest = msglist[num_msgs - 1];
}
- lputroom(&qrbuf);
+ CtdlPutRoomLock(&qrbuf);
/* Go through the messages we pulled out of the index, and decrement
* their reference counts by 1. If this is the only room the message
targ[ROOMNAMELEN - 1] = 0;
is_copy = extract_int(args, 2);
- if (getroom(&qtemp, targ) != 0) {
+ if (CtdlGetRoom(&qtemp, targ) != 0) {
cprintf("%d '%s' does not exist.\n", ERROR + ROOM_NOT_FOUND, targ);
return;
}
msg->cm_fields['M'] = encoded_message;
/* Create the requested room if we have to. */
- if (getroom(&qrbuf, roomname) != 0) {
- create_room(roomname,
+ if (CtdlGetRoom(&qrbuf, roomname) != 0) {
+ CtdlCreateRoom(roomname,
( (is_mailbox != NULL) ? 5 : 3 ),
"", 0, 1, 0, VIEW_BBS);
}
char buf[SIZ];
strcpy(hold_rm, CC->room.QRname);
- if (getroom(&CC->room, SYSCONFIGROOM) != 0) {
- getroom(&CC->room, hold_rm);
+ if (CtdlGetRoom(&CC->room, SYSCONFIGROOM) != 0) {
+ CtdlGetRoom(&CC->room, hold_rm);
return NULL;
}
}
}
- getroom(&CC->room, hold_rm);
+ CtdlGetRoom(&CC->room, hold_rm);
if (conf != NULL) do {
extract_token(buf, conf, 0, '\n', sizeof buf);
* If the floor has its own policy, return it
*/
if ( (qrbuf->QRflags & QR_MAILBOX) == 0) {
- fl = cgetfloor(qrbuf->QRfloor);
+ fl = CtdlGetCachedFloor(qrbuf->QRfloor);
if (fl->f_ep.expire_mode != 0) {
memcpy(epbuf, &fl->f_ep, sizeof(struct ExpirePolicy));
return;
memcpy(&exp, &CC->room.QRep, sizeof(struct ExpirePolicy));
}
else if (!strcasecmp(which, "floor")) {
- fl = cgetfloor(CC->room.QRfloor);
+ fl = CtdlGetCachedFloor(CC->room.QRfloor);
memcpy(&exp, &fl->f_ep, sizeof(struct ExpirePolicy));
}
else if (!strcasecmp(which, "mailboxes")) {
ERROR + HIGHER_ACCESS_REQUIRED);
return;
}
- lgetroom(&CC->room, CC->room.QRname);
+ CtdlGetRoomLock(&CC->room, CC->room.QRname);
memcpy(&CC->room.QRep, &exp, sizeof(struct ExpirePolicy));
- lputroom(&CC->room);
+ CtdlPutRoomLock(&CC->room);
cprintf("%d Room expire policy has been updated.\n", CIT_OK);
return;
}
/*
- * getroom() - retrieve room data from disk
+ * CtdlGetRoom() - retrieve room data from disk
*/
-int getroom(struct ctdlroom *qrbuf, char *room_name)
+int CtdlGetRoom(struct ctdlroom *qrbuf, char *room_name)
{
struct cdbdata *cdbqr;
char lowercase_name[ROOMNAMELEN];
}
/*
- * lgetroom() - same as getroom() but locks the record (if supported)
+ * CtdlGetRoomLock() - same as getroom() but locks the record (if supported)
*/
-int lgetroom(struct ctdlroom *qrbuf, char *room_name)
+int CtdlGetRoomLock(struct ctdlroom *qrbuf, char *room_name)
{
register int retval;
- retval = getroom(qrbuf, room_name);
+ retval = CtdlGetRoom(qrbuf, room_name);
if (retval == 0) begin_critical_section(S_ROOMS);
return(retval);
}
/*
- * putroom() - store room data to disk
+ * CtdlPutRoom() - store room data to disk
*/
-void putroom(struct ctdlroom *qrbuf) {
+void CtdlPutRoom(struct ctdlroom *qrbuf) {
b_putroom(qrbuf, qrbuf->QRname);
}
/*
- * lputroom() - same as putroom() but unlocks the record (if supported)
+ * CtdlPutRoomLock() - same as CtdlPutRoom() but unlocks the record (if supported)
*/
-void lputroom(struct ctdlroom *qrbuf)
+void CtdlPutRoomLock(struct ctdlroom *qrbuf)
{
- putroom(qrbuf);
+ CtdlPutRoom(qrbuf);
end_critical_section(S_ROOMS);
}
/****************************************************************************/
/*
- * getfloor() - retrieve floor data from disk
+ * CtdlGetFloor() - retrieve floor data from disk
*/
-void getfloor(struct floor *flbuf, int floor_num)
+void CtdlGetFloor(struct floor *flbuf, int floor_num)
{
struct cdbdata *cdbfl;
}
/*
- * lgetfloor() - same as getfloor() but locks the record (if supported)
+ * lgetfloor() - same as CtdlGetFloor() but locks the record (if supported)
*/
void lgetfloor(struct floor *flbuf, int floor_num)
{
begin_critical_section(S_FLOORTAB);
- getfloor(flbuf, floor_num);
+ CtdlGetFloor(flbuf, floor_num);
}
/*
- * cgetfloor() - Get floor record from *cache* (loads from disk if needed)
+ * CtdlGetCachedFloor() - Get floor record from *cache* (loads from disk if needed)
*
* This is strictly a performance hack.
*/
-struct floor *cgetfloor(int floor_num) {
+struct floor *CtdlGetCachedFloor(int floor_num) {
static int initialized = 0;
int i;
int fetch_new = 0;
if (fetch_new) {
fl = malloc(sizeof(struct floor));
- getfloor(fl, floor_num);
+ CtdlGetFloor(fl, floor_num);
begin_critical_section(S_FLOORCACHE);
if (floorcache[floor_num] != NULL) {
free(floorcache[floor_num]);
/*
- * putfloor() - store floor data on disk
+ * CtdlPutFloor() - store floor data on disk
*/
-void putfloor(struct floor *flbuf, int floor_num)
+void CtdlPutFloor(struct floor *flbuf, int floor_num)
{
/* If we've cached this, clear it out, 'cuz it's WRONG now! */
begin_critical_section(S_FLOORCACHE);
/*
- * lputfloor() - same as putfloor() but unlocks the record (if supported)
+ * lputfloor() - same as CtdlPutFloor() but unlocks the record (if supported)
*/
void lputfloor(struct floor *flbuf, int floor_num)
{
- putfloor(flbuf, floor_num);
+ CtdlPutFloor(flbuf, floor_num);
end_critical_section(S_FLOORTAB);
}
/*
* Traverse the room file...
*/
-void ForEachRoom(void (*CallBack) (struct ctdlroom *EachRoom, void *out_data),
+void CtdlForEachRoom(void (*CallBack) (struct ctdlroom *EachRoom, void *out_data),
void *in_data)
{
struct ctdlroom qrbuf;
/*
* Determine whether a given room is non-editable.
*/
-int is_noneditable(struct ctdlroom *qrbuf)
+int CtdlIsNonEditable(struct ctdlroom *qrbuf)
{
/* Mail> rooms are non-editable */
}
cprintf("%d Accessible rooms:\n", LISTING_FOLLOWS);
- ForEachRoom(cmd_lrms_backend, &FloorBeingSearched);
+ CtdlForEachRoom(cmd_lrms_backend, &FloorBeingSearched);
cprintf("000\n");
}
}
cprintf("%d Known rooms:\n", LISTING_FOLLOWS);
- ForEachRoom(cmd_lkra_backend, &FloorBeingSearched);
+ CtdlForEachRoom(cmd_lkra_backend, &FloorBeingSearched);
cprintf("000\n");
}
cprintf("%d Publiic rooms:\n", LISTING_FOLLOWS);
- ForEachRoom(cmd_lprm_backend, &FloorBeingSearched);
+ CtdlForEachRoom(cmd_lprm_backend, &FloorBeingSearched);
cprintf("000\n");
}
}
cprintf("%d Rooms w/ new msgs:\n", LISTING_FOLLOWS);
- ForEachRoom(cmd_lkrn_backend, &FloorBeingSearched);
+ CtdlForEachRoom(cmd_lkrn_backend, &FloorBeingSearched);
cprintf("000\n");
}
}
cprintf("%d Rooms w/o new msgs:\n", LISTING_FOLLOWS);
- ForEachRoom(cmd_lkro_backend, &FloorBeingSearched);
+ CtdlForEachRoom(cmd_lkro_backend, &FloorBeingSearched);
cprintf("000\n");
}
}
cprintf("%d Zapped rooms:\n", LISTING_FOLLOWS);
- ForEachRoom(cmd_lzrm_backend, &FloorBeingSearched);
+ CtdlForEachRoom(cmd_lzrm_backend, &FloorBeingSearched);
cprintf("000\n");
}
* or access control is done here -- the caller should make sure that the
* specified room exists and is ok to access.
*/
-void usergoto(char *where, int display_result, int transiently,
+void CtdlUserGoto(char *where, int display_result, int transiently,
int *retmsgs, int *retnew)
{
int a;
*/
if (where != NULL) {
safestrncpy(CC->room.QRname, where, sizeof CC->room.QRname);
- getroom(&CC->room, where);
+ CtdlGetRoom(&CC->room, where);
}
/* Take care of all the formalities. */
cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
if (cdbfr != NULL) {
msglist = (long *) cdbfr->ptr;
- cdbfr->ptr = NULL; /* usergoto() now owns this memory */
+ cdbfr->ptr = NULL; /* CtdlUserGoto() now owns this memory */
num_msgs = cdbfr->len / sizeof(long);
cdb_free(cdbfr);
}
convert_room_name_macros(towhere, sizeof towhere);
/* First try a regular match */
- c = getroom(&QRscratch, towhere);
+ c = CtdlGetRoom(&QRscratch, towhere);
/* Then try a mailbox name match */
if (c != 0) {
MailboxName(augmented_roomname, sizeof augmented_roomname,
&CC->user, towhere);
- c = getroom(&QRscratch, augmented_roomname);
+ c = CtdlGetRoom(&QRscratch, augmented_roomname);
if (c == 0)
safestrncpy(towhere, augmented_roomname, sizeof towhere);
}
if (CC->internal_pgm) {
memcpy(&CC->room, &QRscratch,
sizeof(struct ctdlroom));
- usergoto(NULL, 1, transiently, NULL, NULL);
+ CtdlUserGoto(NULL, 1, transiently, NULL, NULL);
return;
}
((ra & UA_GOTOALLOWED))) {
memcpy(&CC->room, &QRscratch,
sizeof(struct ctdlroom));
- usergoto(NULL, 1, transiently, NULL, NULL);
+ CtdlUserGoto(NULL, 1, transiently, NULL, NULL);
return;
} else if ((QRscratch.QRflags & QR_PASSWORDED) &&
((ra & UA_KNOWN) == 0) &&
} else {
memcpy(&CC->room, &QRscratch,
sizeof(struct ctdlroom));
- usergoto(NULL, 1, transiently, NULL, NULL);
+ CtdlUserGoto(NULL, 1, transiently, NULL, NULL);
return;
}
}
if (CtdlAccessCheck(ac_logged_in)) return;
- getroom(&CC->room, CC->room.QRname);
+ CtdlGetRoom(&CC->room, CC->room.QRname);
getuser(&CC->user, CC->curr_user);
if ((CC->room.QRflags & QR_DIRECTORY) == 0) {
{
if (CtdlAccessCheck(ac_room_aide)) return;
- getroom(&CC->room, CC->room.QRname);
+ CtdlGetRoom(&CC->room, CC->room.QRname);
cprintf("%d%c%s|%s|%s|%d|%d|%d|%d|%d|\n",
CIT_OK,
CtdlCheckExpress(),
old_name, new_name, new_floor);
if (new_floor >= 0) {
- fl = cgetfloor(new_floor);
+ fl = CtdlGetCachedFloor(new_floor);
if ((fl->f_flags & F_INUSE) == 0) {
return(crr_invalid_floor);
}
begin_critical_section(S_ROOMS);
- if ( (getroom(&qrtmp, new_name) == 0)
+ if ( (CtdlGetRoom(&qrtmp, new_name) == 0)
&& (strcasecmp(new_name, old_name)) ) {
ret = crr_already_exists;
}
- else if (getroom(&qrbuf, old_name) != 0) {
+ else if (CtdlGetRoom(&qrbuf, old_name) != 0) {
ret = crr_room_not_found;
}
ret = crr_access_denied;
}
- else if (is_noneditable(&qrbuf)) {
+ else if (CtdlIsNonEditable(&qrbuf)) {
ret = crr_noneditable;
}
new_floor = old_floor;
}
qrbuf.QRfloor = new_floor;
- putroom(&qrbuf);
+ CtdlPutRoom(&qrbuf);
begin_critical_section(S_CONFIG);
return;
}
- getroom(&CC->room, new_name);
+ CtdlGetRoom(&CC->room, new_name);
/* Now we have to do a bunch of other stuff */
new_order = 127;
}
- lgetroom(&CC->room, CC->room.QRname);
+ CtdlGetRoomLock(&CC->room, CC->room.QRname);
/* Directory room */
extract_token(buf, args, 2, '|', sizeof buf);
}
/* Write the room record back to disk */
- lputroom(&CC->room);
+ CtdlPutRoomLock(&CC->room);
/* Create a room directory if necessary */
if (CC->room.QRflags & QR_DIRECTORY) {
newu = usbuf.usernum;
}
- lgetroom(&CC->room, CC->room.QRname);
+ CtdlGetRoomLock(&CC->room, CC->room.QRname);
post_notice = 0;
if (CC->room.QRroomaide != newu) {
post_notice = 1;
}
CC->room.QRroomaide = newu;
- lputroom(&CC->room);
+ CtdlPutRoomLock(&CC->room);
/*
* We have to post the change notice _after_ writing changes to
* deleted to the user(s), but it won't actually get purged from the
* database until THE DREADED AUTO-PURGER makes its next run.
*/
-void schedule_room_for_deletion(struct ctdlroom *qrbuf)
+void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf)
{
char old_name[ROOMNAMELEN];
static int seq = 0;
safestrncpy(old_name, qrbuf->QRname, sizeof old_name);
- getroom(qrbuf, qrbuf->QRname);
+ CtdlGetRoom(qrbuf, qrbuf->QRname);
/* Turn the room into a private mailbox owned by a user who doesn't
* exist. This will immediately make the room invisible to everyone,
qrbuf->QRflags |= QR_MAILBOX;
time(&qrbuf->QRgen); /* Use a timestamp as the new generation number */
- putroom(qrbuf);
+ CtdlPutRoom(qrbuf);
b_deleteroom(old_name);
}
* AUTO-PURGER in serv_expire.c. All user-facing code should call
* the asynchronous schedule_room_for_deletion() instead.)
*/
-void delete_room(struct ctdlroom *qrbuf)
+void CtdlDeleteRoom(struct ctdlroom *qrbuf)
{
struct floor flbuf;
char filename[100];
CtdlDeleteMessages(qrbuf->QRname, NULL, 0, "");
/* Flag the room record as not in use */
- lgetroom(qrbuf, qrbuf->QRname);
+ CtdlGetRoomLock(qrbuf, qrbuf->QRname);
qrbuf->QRflags = 0;
- lputroom(qrbuf);
+ CtdlPutRoomLock(qrbuf);
/* then decrement the reference count for the floor */
lgetfloor(&flbuf, (int) (qrbuf->QRfloor));
return(0);
}
- if (is_noneditable(qr)) {
+ if (CtdlIsNonEditable(qr)) {
return(0);
}
}
/* Do the dirty work */
- schedule_room_for_deletion(&CC->room);
+ CtdlScheduleRoomForDeletion(&CC->room);
/* Return to the Lobby */
- usergoto(config.c_baseroom, 0, 0, NULL, NULL);
+ CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
/* tell the world what we did */
snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
* Room types: 0=public, 1=guessname, 2=passworded, 3=inv-only,
* 4=mailbox, 5=mailbox, but caller supplies namespace
*/
-unsigned create_room(char *new_room_name,
+unsigned CtdlCreateRoom(char *new_room_name,
int new_room_type,
char *new_room_pass,
int new_room_floor,
struct floor flbuf;
struct visit vbuf;
- CtdlLogPrintf(CTDL_DEBUG, "create_room(name=%s, type=%d, view=%d)\n",
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlCreateRoom(name=%s, type=%d, view=%d)\n",
new_room_name, new_room_type, new_room_view);
- if (getroom(&qrbuf, new_room_name) == 0) {
+ if (CtdlGetRoom(&qrbuf, new_room_name) == 0) {
CtdlLogPrintf(CTDL_DEBUG, "%s already exists.\n", new_room_name);
return(0);
}
qrbuf.QRdefaultview = new_room_view;
/* save what we just did... */
- putroom(&qrbuf);
+ CtdlPutRoom(&qrbuf);
/* bump the reference count on whatever floor the room is on */
lgetfloor(&flbuf, (int) qrbuf.QRfloor);
}
if (num_parms(args) >= 5) {
- fl = cgetfloor(extract_int(args, 4));
+ fl = CtdlGetCachedFloor(extract_int(args, 4));
if (fl == NULL) {
cprintf("%d Invalid floor number.\n",
ERROR + INVALID_FLOOR_OPERATION);
}
/* Check to make sure the requested room name doesn't already exist */
- newflags = create_room(new_room_name,
+ newflags = CtdlCreateRoom(new_room_name,
new_room_type, new_room_pass, new_room_floor,
0, avoid_access, new_room_view);
if (newflags == 0) {
/* If we reach this point, the room needs to be created. */
- newflags = create_room(new_room_name,
+ newflags = CtdlCreateRoom(new_room_name,
new_room_type, new_room_pass, new_room_floor, 1, 0,
new_room_view);
fclose(fp);
/* now update the room index so people will see our new info */
- lgetroom(&CC->room, CC->room.QRname); /* lock so no one steps on us */
+ CtdlGetRoomLock(&CC->room, CC->room.QRname); /* lock so no one steps on us */
CC->room.QRinfo = CC->room.QRhighest + 1L;
- lputroom(&CC->room);
+ CtdlPutRoomLock(&CC->room);
}
cprintf("%d Known floors:\n", LISTING_FOLLOWS);
for (a = 0; a < MAXFLOORS; ++a) {
- getfloor(&flbuf, a);
+ CtdlGetFloor(&flbuf, a);
if (flbuf.f_flags & F_INUSE) {
cprintf("%d|%s|%d\n",
a,
}
for (a = 0; a < MAXFLOORS; ++a) {
- getfloor(&flbuf, a);
+ CtdlGetFloor(&flbuf, a);
/* note any free slots while we're scanning... */
if (((flbuf.f_flags & F_INUSE) == 0)
struct ctdluser *userbuf);
int is_zapped (struct ctdlroom *roombuf, int roomnum,
struct ctdluser *userbuf);
-int getroom(struct ctdlroom *qrbuf, char *room_name);
void b_putroom(struct ctdlroom *qrbuf, char *room_name);
-void putroom(struct ctdlroom *);
void b_deleteroom(char *);
-int lgetroom(struct ctdlroom *qrbuf, char *room_name);
-void lputroom(struct ctdlroom *qrbuf);
-void getfloor (struct floor *flbuf, int floor_num);
-struct floor *cgetfloor(int floor_num);
void lgetfloor (struct floor *flbuf, int floor_num);
-void putfloor (struct floor *flbuf, int floor_num);
void lputfloor (struct floor *flbuf, int floor_num);
int sort_msglist (long int *listptrs, int oldcount);
-void usergoto (char *where, int display_result, int transiently,
- int *msgs, int *new);
-unsigned create_room(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);
-void ForEachRoom(void (*CallBack)(struct ctdlroom *EachRoom, void *out_data),
- void *in_data);
-void schedule_room_for_deletion(struct ctdlroom *qrbuf);
-void delete_room(struct ctdlroom *qrbuf);
void list_roomname(struct ctdlroom *qrbuf, int ra, int current_view, int default_view);
-int is_noneditable(struct ctdlroom *qrbuf);
-void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
- int *result, int *view);
-int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr);
-int CtdlRenameRoom(char *old_name, char *new_name, int new_floor);
void convert_room_name_macros(char *towhere, size_t maxlen);
-/*
- * Possible return values for CtdlRenameRoom()
- */
-enum {
- crr_ok, /* success */
- crr_room_not_found, /* room not found */
- crr_already_exists, /* new name already exists */
- crr_noneditable, /* cannot edit this room */
- crr_invalid_floor, /* target floor does not exist */
- crr_access_denied /* not allowed to edit this room */
-};
/* Create any personal rooms required by the system.
* (Technically, MAILROOM should be there already, but just in case...)
*/
- create_room(MAILROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
- create_room(SENTITEMS, 4, "", 0, 1, 0, VIEW_MAILBOX);
- create_room(USERTRASHROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
- /* create_room(USERDRAFTROOM, 4, "", 0, 1, 0, VIEW_MAILBOX); temporarily disabled for 7.60 */
+ CtdlCreateRoom(MAILROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
+ CtdlCreateRoom(SENTITEMS, 4, "", 0, 1, 0, VIEW_MAILBOX);
+ CtdlCreateRoom(USERTRASHROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
+ /* CtdlCreateRoom(USERDRAFTROOM, 4, "", 0, 1, 0, VIEW_MAILBOX); temporarily disabled for 7.60 */
/* Run any startup routines registered by loadable modules */
PerformSessionHooks(EVT_LOGIN);
/* Enter the lobby */
- usergoto(config.c_baseroom, 0, 0, NULL, NULL);
+ CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
}
* Make the latter an invisible system room.
*/
MailboxName(mailboxname, sizeof mailboxname, &usbuf, MAILROOM);
- create_room(mailboxname, 5, "", 0, 1, 1, VIEW_MAILBOX);
+ CtdlCreateRoom(mailboxname, 5, "", 0, 1, 1, VIEW_MAILBOX);
MailboxName(mailboxname, sizeof mailboxname, &usbuf, USERCONFIGROOM);
- create_room(mailboxname, 5, "", 0, 1, 1, VIEW_BBS);
- if (lgetroom(&qrbuf, mailboxname) == 0) {
+ CtdlCreateRoom(mailboxname, 5, "", 0, 1, 1, VIEW_BBS);
+ if (CtdlGetRoomLock(&qrbuf, mailboxname) == 0) {
qrbuf.QRflags2 |= QR2_SYSTEM;
- lputroom(&qrbuf);
+ CtdlPutRoomLock(&qrbuf);
}
/* Perform any create functions registered by server extensions */
lputuser(&CC->user);
/* Return to the Lobby, so we don't end up in an undefined room */
- usergoto(config.c_baseroom, 0, 0, NULL, NULL);
+ CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
return(0);
}
int num_msgs = 0;
MailboxName(mailboxname, sizeof mailboxname, &CC->user, MAILROOM);
- if (getroom(&mailbox, mailboxname) != 0)
+ if (CtdlGetRoom(&mailbox, mailboxname) != 0)
return (0);
CtdlGetRelationship(&vbuf, &CC->user, &mailbox);