From: Dave West Date: Sat, 17 Oct 2009 12:21:17 +0000 (+0000) Subject: Citadel API clean up. X-Git-Tag: v7.86~736 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=c1b1936458ccd0d517148615a6ed753f6a3e30c2 Citadel API clean up. Moved public function prototypes for room operations into ctdl_module.h and renamed them to match the documented naming convention. create_room -> CtdlCreateRoom getroom -> CtdlGetRoom putroom -> CtdlPutRoom lgetroom -> CtdlGetRoomLock lputroom -> CtdlPutRoomLock getfloor -> CtdlGetFloor putfloor -> CtdlPutFloor do_i_have_permission_to_delete_this_room -> CtdlDoIHavePermissionToDeleteThisRoom ForEachRoom -> CtdlForEachRoom delete_room -> CtdlDeleteRoom usergoto -> CtdlUserGoto cgetfloor -> CtdlGetCachedFloor schedule_room_for_deletion -> CtdlScheduleRoomForDeletion is_noneditable -> CtdlIsNonEditable This is probably not all of the functions from room_ops.c that should be exposed but it is all the ones that any current module uses. No module should now need to include "room_ops.h" --- diff --git a/citadel/citserver.c b/citadel/citserver.c index 1f19d0c00..94132babc 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -159,21 +159,21 @@ void master_startup(void) { 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"); diff --git a/citadel/control.c b/citadel/control.c index 327270bcc..65a6d0fd6 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -110,7 +110,7 @@ void control_find_highest(struct ctdlroom *qrbuf, void *data) room_fixed = 1; } - getroom (&room, qrbuf->QRname); + CtdlGetRoom (&room, qrbuf->QRname); /* Load the message list */ cdbfr = cdb_fetch(CDB_MSGLISTS, &room.QRnumber, sizeof(long)); @@ -232,7 +232,7 @@ void check_control(void) 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(); } @@ -669,7 +669,7 @@ void cmd_conf(char *argbuf) 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. diff --git a/citadel/euidindex.c b/citadel/euidindex.c index 2dac3730f..ce46a459f 100644 --- a/citadel/euidindex.c +++ b/citadel/euidindex.c @@ -171,7 +171,7 @@ void rebuild_euid_index_for_room(struct ctdlroom *qrbuf, void *data) { 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. */ @@ -187,12 +187,12 @@ void rebuild_euid_index_for_room(struct ctdlroom *qrbuf, void *data) { } 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); } @@ -209,7 +209,7 @@ void rebuild_euid_index_for_room(struct ctdlroom *qrbuf, void *data) { */ 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 */ } diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 165fd281f..2544077bd 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -195,7 +195,7 @@ void cmd_movf(char *cmdbuf) return; } - if (getroom(&qrbuf, newroom) != 0) { + if (CtdlGetRoom(&qrbuf, newroom) != 0) { cprintf("%d '%s' does not exist.\n", ERROR + ROOM_NOT_FOUND, newroom); return; } diff --git a/citadel/housekeeping.c b/citadel/housekeeping.c index 7fed15418..742291c5a 100644 --- a/citadel/housekeeping.c +++ b/citadel/housekeeping.c @@ -117,7 +117,7 @@ void check_ref_counts(void) { } 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; aroom, 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); @@ -254,7 +253,7 @@ void cmd_auto(char *argbuf) { 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) { diff --git a/citadel/modules/bio/serv_bio.c b/citadel/modules/bio/serv_bio.c index 6d09c1bf4..afebe1242 100644 --- a/citadel/modules/bio/serv_bio.c +++ b/citadel/modules/bio/serv_bio.c @@ -53,7 +53,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index 1dd5935e0..8fc856111 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -43,7 +43,6 @@ #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" @@ -616,8 +615,8 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) { 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); } @@ -630,7 +629,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) { */ 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) { @@ -1188,8 +1187,8 @@ void ical_hunt_for_conflicts(icalcomponent *cal) { 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; } @@ -1204,7 +1203,7 @@ void ical_hunt_for_conflicts(icalcomponent *cal) { ); cprintf("000\n"); - getroom(&CC->room, hold_rm); /* return to saved room */ + CtdlGetRoom(&CC->room, hold_rm); /* return to saved room */ } @@ -1507,9 +1506,9 @@ void ical_freebusy(char *who) { 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; } @@ -1519,7 +1518,7 @@ void ical_freebusy(char *who) { 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; } @@ -1561,7 +1560,7 @@ void ical_freebusy(char *who) { 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; } @@ -1582,7 +1581,7 @@ void ical_freebusy(char *who) { cprintf("\n000\n"); /* Go back to the room from which we came... */ - getroom(&CC->room, hold_rm); + CtdlGetRoom(&CC->room, hold_rm); } @@ -1920,22 +1919,22 @@ void cmd_ical(char *argbuf) /* * 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); @@ -1943,16 +1942,16 @@ void ical_create_room(void) 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); @@ -1960,16 +1959,16 @@ void ical_create_room(void) 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); @@ -2605,7 +2604,7 @@ CTDL_MODULE_INIT(calendar) /* 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); diff --git a/citadel/modules/chat/serv_chat.c b/citadel/modules/chat/serv_chat.c index d5c7be32c..e0515963f 100644 --- a/citadel/modules/chat/serv_chat.c +++ b/citadel/modules/chat/serv_chat.c @@ -54,7 +54,6 @@ #include "config.h" #include "msgbase.h" #include "user_ops.h" -#include "room_ops.h" #ifndef HAVE_SNPRINTF #include "snprintf.h" @@ -498,7 +497,7 @@ void cmd_chat(char *argbuf) 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; } } @@ -903,20 +902,20 @@ void flush_individual_conversation(struct imlog *im) { * 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); } diff --git a/citadel/modules/clamav/serv_virus.c b/citadel/modules/clamav/serv_virus.c index a7bb22cd7..310860720 100644 --- a/citadel/modules/clamav/serv_virus.c +++ b/citadel/modules/clamav/serv_virus.c @@ -57,7 +57,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/dspam/serv_dspam.c b/citadel/modules/dspam/serv_dspam.c index cd96e6135..8285b5368 100644 --- a/citadel/modules/dspam/serv_dspam.c +++ b/citadel/modules/dspam/serv_dspam.c @@ -51,7 +51,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "policy.h" #include "database.h" #include "msgbase.h" diff --git a/citadel/modules/expire/serv_expire.c b/citadel/modules/expire/serv_expire.c index 00466cf77..00869827d 100644 --- a/citadel/modules/expire/serv_expire.c +++ b/citadel/modules/expire/serv_expire.c @@ -75,7 +75,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "policy.h" #include "database.h" #include "msgbase.h" @@ -260,7 +259,7 @@ void PurgeMessages(void) { return; } - ForEachRoom(GatherPurgeMessages, (void *)purgelist ); + CtdlForEachRoom(GatherPurgeMessages, (void *)purgelist ); DoPurgeMessages(purgelist); fclose(purgelist); } @@ -311,7 +310,7 @@ void DoPurgeRooms(struct ctdlroom *qrbuf, void *data) { 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; @@ -353,7 +352,7 @@ int PurgeRooms(void) { ForEachUser(AddValidUser, NULL); /* Then cycle through the room file */ - ForEachRoom(DoPurgeRooms, NULL); + CtdlForEachRoom(DoPurgeRooms, NULL); /* Free the valid user list */ while (ValidUserList != NULL) { @@ -367,11 +366,11 @@ int PurgeRooms(void) { 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); @@ -626,7 +625,7 @@ int PurgeVisits(void) { 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); @@ -966,7 +965,7 @@ void do_fsck_msg(long msgnum, void *userdata) { 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); } @@ -992,7 +991,7 @@ void cmd_fsck(char *argbuf) { 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"); diff --git a/citadel/modules/extnotify/extnotify_main.c b/citadel/modules/extnotify/extnotify_main.c index 6f33e687e..b772bbb09 100644 --- a/citadel/modules/extnotify/extnotify_main.c +++ b/citadel/modules/extnotify/extnotify_main.c @@ -57,7 +57,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -147,15 +146,15 @@ StrBuf** GetNotifyHosts(void) 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 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); } } /*! @@ -183,7 +182,7 @@ void do_extnotify_queue(void) 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; } @@ -370,7 +369,7 @@ long extNotify_getConfigMessage(char *username) { 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 diff --git a/citadel/modules/fulltext/serv_fulltext.c b/citadel/modules/fulltext/serv_fulltext.c index 74e0b22ee..68f5f4136 100644 --- a/citadel/modules/fulltext/serv_fulltext.c +++ b/citadel/modules/fulltext/serv_fulltext.c @@ -55,7 +55,6 @@ #include "database.h" #include "msgbase.h" #include "control.h" -#include "room_ops.h" #include "serv_fulltext.h" #include "ft_wordbreaker.h" #include "threads.h" @@ -226,7 +225,7 @@ void ft_index_room(struct ctdlroom *qrbuf, void *data) if (CtdlThreadCheckStop()) return; - getroom(&CC->room, qrbuf->QRname); + CtdlGetRoom(&CC->room, qrbuf->QRname); CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, NULL, ft_index_msg, NULL); } @@ -290,7 +289,7 @@ void do_fulltext_indexing(void) { * 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); diff --git a/citadel/modules/imap/imap_acl.c b/citadel/modules/imap/imap_acl.c index 11b400b9e..7ef289db5 100644 --- a/citadel/modules/imap/imap_acl.c +++ b/citadel/modules/imap/imap_acl.c @@ -54,7 +54,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -67,6 +66,7 @@ #include "genstamp.h" +#include "ctdl_module.h" /* * Implements the SETACL command. @@ -170,13 +170,13 @@ void imap_getacl(int num_parms, char *parms[]) { } /* - * 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(" "); @@ -209,7 +209,7 @@ void imap_getacl(int num_parms, char *parms[]) { * 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]); @@ -260,13 +260,13 @@ void imap_listrights(int num_parms, char *parms[]) { } /* - * 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); /* @@ -286,7 +286,7 @@ void imap_listrights(int num_parms, char *parms[]) { * 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]); @@ -318,13 +318,13 @@ void imap_myrights(int num_parms, char *parms[]) { } /* - * 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); @@ -337,7 +337,7 @@ void imap_myrights(int num_parms, char *parms[]) { * 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]); diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 19d92dafd..2d6363103 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -54,7 +54,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/imap/imap_list.c b/citadel/modules/imap/imap_list.c index 8e4192712..e6f6c19d4 100644 --- a/citadel/modules/imap/imap_list.c +++ b/citadel/modules/imap/imap_list.c @@ -52,7 +52,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -80,7 +79,7 @@ void imap_list_floors(char *verb, int num_patterns, char **patterns) 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; jselected) { 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. @@ -177,9 +176,9 @@ void imap_setmetadata(int num_parms, char *parms[]) { ) || (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]); } @@ -192,7 +191,7 @@ void imap_setmetadata(int num_parms, char *parms[]) { * 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; } @@ -223,13 +222,13 @@ void imap_getmetadata(int num_parms, char *parms[]) { } /* - * 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]); @@ -295,7 +294,7 @@ void imap_getmetadata(int num_parms, char *parms[]) { * 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]); diff --git a/citadel/modules/imap/imap_misc.c b/citadel/modules/imap/imap_misc.c index c5c7dfbbd..5c3a12796 100644 --- a/citadel/modules/imap/imap_misc.c +++ b/citadel/modules/imap/imap_misc.c @@ -53,7 +53,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -143,7 +142,7 @@ int imap_do_copy(char *destination_folder) { } /* 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); @@ -383,13 +382,13 @@ void imap_append(int num_parms, char *parms[]) { } /* - * 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? @@ -441,7 +440,7 @@ void imap_append(int num_parms, char *parms[]) { * 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 */ diff --git a/citadel/modules/imap/imap_search.c b/citadel/modules/imap/imap_search.c index 1cb38c97b..90644b1e4 100644 --- a/citadel/modules/imap/imap_search.c +++ b/citadel/modules/imap/imap_search.c @@ -53,7 +53,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/imap/imap_store.c b/citadel/modules/imap/imap_store.c index 9750a6538..892933025 100644 --- a/citadel/modules/imap/imap_store.c +++ b/citadel/modules/imap/imap_store.c @@ -54,7 +54,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/imap/imap_tools.c b/citadel/modules/imap/imap_tools.c index 0ca98feb7..52844462a 100644 --- a/citadel/modules/imap/imap_tools.c +++ b/citadel/modules/imap/imap_tools.c @@ -29,7 +29,6 @@ #include #include "citadel.h" #include "sysdep_decls.h" -#include "room_ops.h" #include "internet_addressing.h" #include "imap_tools.h" #include "ctdl_module.h" @@ -500,7 +499,7 @@ void imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf) { /* 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++ = '/'; @@ -575,7 +574,7 @@ int imap_roomname(char *rbuf, int bufsize, char *foldername) 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) diff --git a/citadel/modules/imap/serv_imap.c b/citadel/modules/imap/serv_imap.c index 3d5d2ac7b..e06dd5623 100644 --- a/citadel/modules/imap/serv_imap.c +++ b/citadel/modules/imap/serv_imap.c @@ -55,7 +55,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -292,7 +291,7 @@ void imap_rescan_msgids(void) * 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; } @@ -717,13 +716,13 @@ void imap_select(int num_parms, char *parms[]) 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); } @@ -750,11 +749,11 @@ void imap_select(int num_parms, char *parms[]) 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")) { @@ -881,7 +880,7 @@ void imap_namespace(int num_parms, char *parms[]) /* 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("("); @@ -954,7 +953,7 @@ void imap_create(int num_parms, char *parms[]) 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]); @@ -997,13 +996,13 @@ int imap_grabroom(char *returned_roomname, char *foldername, int zapped_ok) } /* 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); } @@ -1054,14 +1053,14 @@ void imap_status(int num_parms, char *parms[]) } /* - * 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 @@ -1082,7 +1081,7 @@ void imap_status(int num_parms, char *parms[]) * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, 0, &msgs, &new); + CtdlUserGoto(savedroom, 0, 0, &msgs, &new); } /* @@ -1115,21 +1114,21 @@ void imap_subscribe(int num_parms, char *parms[]) } /* - * 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]); @@ -1156,12 +1155,12 @@ void imap_unsubscribe(int num_parms, char *parms[]) } /* - * 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 @@ -1179,7 +1178,7 @@ void imap_unsubscribe(int num_parms, char *parms[]) * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, 0, &msgs, &new); + CtdlUserGoto(savedroom, 0, 0, &msgs, &new); } } @@ -1204,20 +1203,20 @@ void imap_delete(int num_parms, char *parms[]) } /* - * 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]); @@ -1228,7 +1227,7 @@ void imap_delete(int num_parms, char *parms[]) * our happy day without violent explosions. */ if (IMAP->selected) { - usergoto(savedroom, 0, 0, &msgs, &new); + CtdlUserGoto(savedroom, 0, 0, &msgs, &new); } } @@ -1333,7 +1332,7 @@ void imap_rename(int num_parms, char *parms[]) * (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... */ @@ -1341,7 +1340,7 @@ void imap_rename(int num_parms, char *parms[]) 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) { diff --git a/citadel/modules/inetcfg/serv_inetcfg.c b/citadel/modules/inetcfg/serv_inetcfg.c index 49c401d1b..cfd72d64f 100644 --- a/citadel/modules/inetcfg/serv_inetcfg.c +++ b/citadel/modules/inetcfg/serv_inetcfg.c @@ -53,7 +53,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -178,7 +177,7 @@ void spamstrings_init_backend(long msgnum, void *userdata) { 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); } diff --git a/citadel/modules/jabber/serv_xmpp.c b/citadel/modules/jabber/serv_xmpp.c index fe7178db3..a2532a351 100644 --- a/citadel/modules/jabber/serv_xmpp.c +++ b/citadel/modules/jabber/serv_xmpp.c @@ -51,7 +51,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/listsub/serv_listsub.c b/citadel/modules/listsub/serv_listsub.c index cf854789b..6823260cd 100644 --- a/citadel/modules/listsub/serv_listsub.c +++ b/citadel/modules/listsub/serv_listsub.c @@ -52,7 +52,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -106,7 +105,7 @@ void do_subscribe(char *room, char *email, char *subtype, char *webpage) { 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; } @@ -246,7 +245,7 @@ void do_unsubscribe(char *room, char *email, char *webpage) { 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; @@ -395,7 +394,7 @@ void do_confirm(char *room, char *token) { 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; diff --git a/citadel/modules/managesieve/serv_managesieve.c b/citadel/modules/managesieve/serv_managesieve.c index 8904ea1cf..9c81c9093 100644 --- a/citadel/modules/managesieve/serv_managesieve.c +++ b/citadel/modules/managesieve/serv_managesieve.c @@ -61,7 +61,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/migrate/serv_migrate.c b/citadel/modules/migrate/serv_migrate.c index 07027db06..7f855c5db 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -57,7 +57,6 @@ #include "database.h" #include "msgbase.h" #include "user_ops.h" -#include "room_ops.h" #include "control.h" #include "euidindex.h" @@ -159,7 +158,7 @@ void migr_export_rooms_backend(struct ctdlroom *buf, void *data) { /* message list goes inside this tag */ - getroom(&CC->room, buf->QRname); + CtdlGetRoom(&CC->room, buf->QRname); client_write("", 15); client_write("", 8); xml_strout(CC->room.QRname); client_write("\n", 10); client_write("", 11); @@ -175,7 +174,7 @@ void migr_export_rooms(void) { 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); } @@ -199,7 +198,7 @@ void migr_export_floors(void) { for (i=0; i < MAXFLOORS; ++i) { client_write("\n", 8); cprintf("%d\n", i); - getfloor(&qfbuf, i); + CtdlGetFloor(&qfbuf, i); buf = &qfbuf; cprintf("%u\n", buf->f_flags); client_write("", 8); xml_strout(buf->f_name); client_write("\n", 10); @@ -761,7 +760,7 @@ void migr_xml_end(void *data, const char *el, const char **attr) { 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); } @@ -819,7 +818,7 @@ void migr_xml_end(void *data, const char *el, const char **attr) { 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); } diff --git a/citadel/modules/mrtg/serv_mrtg.c b/citadel/modules/mrtg/serv_mrtg.c index 18d2cbc6a..2ee6f4b23 100644 --- a/citadel/modules/mrtg/serv_mrtg.c +++ b/citadel/modules/mrtg/serv_mrtg.c @@ -55,7 +55,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/netfilter/serv_netfilter.c b/citadel/modules/netfilter/serv_netfilter.c index cf5e756a7..19e8f845f 100644 --- a/citadel/modules/netfilter/serv_netfilter.c +++ b/citadel/modules/netfilter/serv_netfilter.c @@ -51,7 +51,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index d8227a881..bb1947354 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -67,7 +67,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -1142,7 +1141,7 @@ void network_spoolout_room(char *room_to_spool) { * 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; } @@ -2175,7 +2174,7 @@ void *network_do_queue(void *args) { */ 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) { diff --git a/citadel/modules/newuser/serv_newuser.c b/citadel/modules/newuser/serv_newuser.c index 0e4b8bad9..dae9c40cf 100644 --- a/citadel/modules/newuser/serv_newuser.c +++ b/citadel/modules/newuser/serv_newuser.c @@ -56,7 +56,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -89,7 +88,7 @@ void CopyNewUserGreetings(void) { /* 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)); diff --git a/citadel/modules/notes/serv_notes.c b/citadel/modules/notes/serv_notes.c index 0b3c3e384..9da02a0db 100644 --- a/citadel/modules/notes/serv_notes.c +++ b/citadel/modules/notes/serv_notes.c @@ -50,7 +50,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/pop3/serv_pop3.c b/citadel/modules/pop3/serv_pop3.c index baee5a2aa..c0db0ea86 100644 --- a/citadel/modules/pop3/serv_pop3.c +++ b/citadel/modules/pop3/serv_pop3.c @@ -61,7 +61,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -195,7 +194,7 @@ int pop3_grab_mailbox(void) { 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, diff --git a/citadel/modules/pop3client/serv_pop3client.c b/citadel/modules/pop3client/serv_pop3client.c index c7576146d..de70ea865 100644 --- a/citadel/modules/pop3client/serv_pop3client.c +++ b/citadel/modules/pop3client/serv_pop3client.c @@ -46,7 +46,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "ctdl_module.h" #include "clientsocket.h" #include "msgbase.h" @@ -323,7 +322,7 @@ void pop3client_scan(void) { 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)) diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index 47ef68207..e60c5ad94 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -49,7 +49,6 @@ #include "support.h" #include "config.h" #include "threads.h" -#include "room_ops.h" #include "ctdl_module.h" #include "clientsocket.h" #include "msgbase.h" @@ -580,7 +579,7 @@ void *rssclient_scan(void *args) { 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); diff --git a/citadel/modules/rwho/serv_rwho.c b/citadel/modules/rwho/serv_rwho.c index 3d60b1a5a..9a1944061 100644 --- a/citadel/modules/rwho/serv_rwho.c +++ b/citadel/modules/rwho/serv_rwho.c @@ -52,7 +52,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index 85cd92a0c..960393d96 100644 --- a/citadel/modules/sieve/serv_sieve.c +++ b/citadel/modules/sieve/serv_sieve.c @@ -51,7 +51,6 @@ #include "citserver.h" #include "support.h" #include "config.h" -#include "room_ops.h" #include "policy.h" #include "database.h" #include "msgbase.h" @@ -178,12 +177,12 @@ int ctdl_fileinto(sieve2_context_t *s, void *my) /* 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) { @@ -192,13 +191,13 @@ int ctdl_fileinto(sieve2_context_t *s, void *my) } /* 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) { @@ -883,7 +882,7 @@ void sieve_do_room(char *roomname) { * 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; } @@ -902,7 +901,7 @@ void sieve_do_room(char *roomname) { 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; } @@ -991,7 +990,7 @@ void msiv_load(struct sdm_userdata *u) { 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); @@ -1001,7 +1000,7 @@ void msiv_load(struct sdm_userdata *u) { } 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 */ } } diff --git a/citadel/modules/smtp/serv_smtp.c b/citadel/modules/smtp/serv_smtp.c index 2680d908c..11a53020d 100644 --- a/citadel/modules/smtp/serv_smtp.c +++ b/citadel/modules/smtp/serv_smtp.c @@ -75,7 +75,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -1740,7 +1739,7 @@ void smtp_do_queue(void) { */ 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; } @@ -1804,15 +1803,15 @@ void smtp_init_spoolout(void) { * 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 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); } } diff --git a/citadel/modules/spam/serv_spam.c b/citadel/modules/spam/serv_spam.c index 0744fe283..7868545ad 100644 --- a/citadel/modules/spam/serv_spam.c +++ b/citadel/modules/spam/serv_spam.c @@ -57,7 +57,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index ae5c8da11..c7a7b7220 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -52,7 +52,6 @@ #include "config.h" #include "control.h" #include "database.h" -#include "room_ops.h" #include "user_ops.h" #include "msgbase.h" #include "serv_upgrade.h" @@ -114,7 +113,7 @@ void cmd_bmbx_backend(struct ctdlroom *qrbuf, void *data) { 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. */ @@ -131,7 +130,7 @@ void cmd_bmbx_backend(struct ctdlroom *qrbuf, void *data) { 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"); @@ -141,7 +140,7 @@ void cmd_bmbx_backend(struct ctdlroom *qrbuf, void *data) { qr.QRgen = time(NULL); CtdlLogPrintf(CTDL_DEBUG, " -- fixed!\n"); } - lputroom(&qr); + CtdlPutRoomLock(&qr); } ptr = rplist; @@ -155,7 +154,7 @@ void cmd_bmbx_backend(struct ctdlroom *qrbuf, void *data) { */ 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; } diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index f31b538b8..a4e92d234 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -68,7 +68,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" @@ -191,8 +190,8 @@ void cmd_igab(char *argbuf) { 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; } @@ -205,7 +204,7 @@ void cmd_igab(char *argbuf) { 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); } @@ -604,8 +603,8 @@ struct vCard *vcard_get_user(struct ctdluser *u) { 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(); } @@ -613,7 +612,7 @@ struct vCard *vcard_get_user(struct ctdluser *u) { 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(); @@ -1162,22 +1161,22 @@ void check_get_greeting(void) { /* * 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); @@ -1229,7 +1228,7 @@ void vcard_session_login_hook(void) { /* * Create the user's 'Contacts' room (personal address book) if it doesn't already exist. */ - vcard_create_room(); + vcard_CtdlCreateRoom(); } @@ -1318,7 +1317,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) { 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); @@ -1437,13 +1436,13 @@ CTDL_MODULE_INIT(vcard) 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 diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index 2cab57586..c41fb12d0 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -52,7 +52,6 @@ #include "support.h" #include "config.h" #include "control.h" -#include "room_ops.h" #include "user_ops.h" #include "policy.h" #include "database.h" diff --git a/citadel/msgbase.c b/citadel/msgbase.c index d5be1bb33..d46ec6cf6 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -2310,7 +2310,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms 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); @@ -2377,7 +2377,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms /* 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) ) { @@ -2418,7 +2418,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms 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; iroom.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); } /* @@ -2977,7 +2977,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ /* 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 @@ -3589,7 +3589,7 @@ struct recptypes *validate_recipients(char *supplied_recipients, 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; @@ -4079,7 +4079,7 @@ int CtdlDeleteMessages(char *room_name, /* which 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); @@ -4136,7 +4136,7 @@ int CtdlDeleteMessages(char *room_name, /* which room */ 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 @@ -4253,7 +4253,7 @@ void cmd_move(char *args) 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; } @@ -4607,8 +4607,8 @@ void CtdlWriteObject(char *req_room, /* Room to stuff it in */ 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); } @@ -4643,8 +4643,8 @@ char *CtdlGetSysConfig(char *sysconfname) { 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; } @@ -4671,7 +4671,7 @@ char *CtdlGetSysConfig(char *sysconfname) { } } - getroom(&CC->room, hold_rm); + CtdlGetRoom(&CC->room, hold_rm); if (conf != NULL) do { extract_token(buf, conf, 0, '\n', sizeof buf); diff --git a/citadel/policy.c b/citadel/policy.c index dd1b7994b..1c8ca4a2a 100644 --- a/citadel/policy.c +++ b/citadel/policy.c @@ -53,7 +53,7 @@ void GetExpirePolicy(struct ExpirePolicy *epbuf, struct ctdlroom *qrbuf) { * 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; @@ -89,7 +89,7 @@ void cmd_gpex(char *argbuf) { 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")) { @@ -131,9 +131,9 @@ void cmd_spex(char *argbuf) { 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; } diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 07ad2f5e0..290190762 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -222,9 +222,9 @@ void room_sanity_check(struct ctdlroom *qrbuf) /* - * 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]; @@ -270,12 +270,12 @@ int getroom(struct ctdlroom *qrbuf, char *room_name) } /* - * 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); } @@ -315,9 +315,9 @@ void b_putroom(struct ctdlroom *qrbuf, char *room_name) /* - * 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); } @@ -332,12 +332,12 @@ void b_deleteroom(char *room_name) { /* - * 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); } @@ -345,9 +345,9 @@ void lputroom(struct ctdlroom *qrbuf) /****************************************************************************/ /* - * 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; @@ -370,22 +370,22 @@ void getfloor(struct floor *flbuf, int floor_num) } /* - * 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; @@ -405,7 +405,7 @@ struct floor *cgetfloor(int floor_num) { 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]); @@ -420,9 +420,9 @@ struct floor *cgetfloor(int 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); @@ -439,12 +439,12 @@ void putfloor(struct floor *flbuf, int floor_num) /* - * 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); } @@ -453,7 +453,7 @@ void lputfloor(struct floor *flbuf, int floor_num) /* * 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; @@ -535,7 +535,7 @@ int sort_msglist(long listptrs[], int oldcount) /* * Determine whether a given room is non-editable. */ -int is_noneditable(struct ctdlroom *qrbuf) +int CtdlIsNonEditable(struct ctdlroom *qrbuf) { /* Mail> rooms are non-editable */ @@ -614,7 +614,7 @@ void cmd_lrms(char *argbuf) } cprintf("%d Accessible rooms:\n", LISTING_FOLLOWS); - ForEachRoom(cmd_lrms_backend, &FloorBeingSearched); + CtdlForEachRoom(cmd_lrms_backend, &FloorBeingSearched); cprintf("000\n"); } @@ -652,7 +652,7 @@ void cmd_lkra(char *argbuf) } cprintf("%d Known rooms:\n", LISTING_FOLLOWS); - ForEachRoom(cmd_lkra_backend, &FloorBeingSearched); + CtdlForEachRoom(cmd_lkra_backend, &FloorBeingSearched); cprintf("000\n"); } @@ -682,7 +682,7 @@ void cmd_lprm(char *argbuf) cprintf("%d Publiic rooms:\n", LISTING_FOLLOWS); - ForEachRoom(cmd_lprm_backend, &FloorBeingSearched); + CtdlForEachRoom(cmd_lprm_backend, &FloorBeingSearched); cprintf("000\n"); } @@ -721,7 +721,7 @@ void cmd_lkrn(char *argbuf) } cprintf("%d Rooms w/ new msgs:\n", LISTING_FOLLOWS); - ForEachRoom(cmd_lkrn_backend, &FloorBeingSearched); + CtdlForEachRoom(cmd_lkrn_backend, &FloorBeingSearched); cprintf("000\n"); } @@ -760,7 +760,7 @@ void cmd_lkro(char *argbuf) } cprintf("%d Rooms w/o new msgs:\n", LISTING_FOLLOWS); - ForEachRoom(cmd_lkro_backend, &FloorBeingSearched); + CtdlForEachRoom(cmd_lkro_backend, &FloorBeingSearched); cprintf("000\n"); } @@ -799,7 +799,7 @@ void cmd_lzrm(char *argbuf) } cprintf("%d Zapped rooms:\n", LISTING_FOLLOWS); - ForEachRoom(cmd_lzrm_backend, &FloorBeingSearched); + CtdlForEachRoom(cmd_lzrm_backend, &FloorBeingSearched); cprintf("000\n"); } @@ -809,7 +809,7 @@ void cmd_lzrm(char *argbuf) * 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; @@ -838,7 +838,7 @@ void usergoto(char *where, int display_result, int transiently, */ 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. */ @@ -873,7 +873,7 @@ void usergoto(char *where, int display_result, int transiently, 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); } @@ -1026,13 +1026,13 @@ void cmd_goto(char *gargs) 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); } @@ -1044,7 +1044,7 @@ void cmd_goto(char *gargs) if (CC->internal_pgm) { memcpy(&CC->room, &QRscratch, sizeof(struct ctdlroom)); - usergoto(NULL, 1, transiently, NULL, NULL); + CtdlUserGoto(NULL, 1, transiently, NULL, NULL); return; } @@ -1061,7 +1061,7 @@ void cmd_goto(char *gargs) ((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) && @@ -1081,7 +1081,7 @@ void cmd_goto(char *gargs) } else { memcpy(&CC->room, &QRscratch, sizeof(struct ctdlroom)); - usergoto(NULL, 1, transiently, NULL, NULL); + CtdlUserGoto(NULL, 1, transiently, NULL, NULL); return; } } @@ -1132,7 +1132,7 @@ void cmd_rdir(char *cmdbuf) 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) { @@ -1214,7 +1214,7 @@ void cmd_getr(char *cmdbuf) { 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(), @@ -1260,7 +1260,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { 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); } @@ -1268,12 +1268,12 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_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; } @@ -1283,7 +1283,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { ret = crr_access_denied; } - else if (is_noneditable(&qrbuf)) { + else if (CtdlIsNonEditable(&qrbuf)) { ret = crr_noneditable; } @@ -1314,7 +1314,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { new_floor = old_floor; } qrbuf.QRfloor = new_floor; - putroom(&qrbuf); + CtdlPutRoom(&qrbuf); begin_critical_section(S_CONFIG); @@ -1413,7 +1413,7 @@ void cmd_setr(char *args) return; } - getroom(&CC->room, new_name); + CtdlGetRoom(&CC->room, new_name); /* Now we have to do a bunch of other stuff */ @@ -1425,7 +1425,7 @@ void cmd_setr(char *args) new_order = 127; } - lgetroom(&CC->room, CC->room.QRname); + CtdlGetRoomLock(&CC->room, CC->room.QRname); /* Directory room */ extract_token(buf, args, 2, '|', sizeof buf); @@ -1486,7 +1486,7 @@ void cmd_setr(char *args) } /* 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) { @@ -1538,13 +1538,13 @@ void cmd_seta(char *new_ra) 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 @@ -1595,7 +1595,7 @@ void cmd_rinf(char *gargs) * 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; @@ -1605,7 +1605,7 @@ void schedule_room_for_deletion(struct ctdlroom *qrbuf) 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, @@ -1619,7 +1619,7 @@ void schedule_room_for_deletion(struct ctdlroom *qrbuf) qrbuf->QRflags |= QR_MAILBOX; time(&qrbuf->QRgen); /* Use a timestamp as the new generation number */ - putroom(qrbuf); + CtdlPutRoom(qrbuf); b_deleteroom(old_name); } @@ -1632,7 +1632,7 @@ void schedule_room_for_deletion(struct ctdlroom *qrbuf) * 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]; @@ -1658,9 +1658,9 @@ void delete_room(struct ctdlroom *qrbuf) 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)); @@ -1682,7 +1682,7 @@ int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr) { return(0); } - if (is_noneditable(qr)) { + if (CtdlIsNonEditable(qr)) { return(0); } @@ -1734,10 +1734,10 @@ void cmd_kill(char *argbuf) } /* 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", @@ -1756,7 +1756,7 @@ void cmd_kill(char *argbuf) * 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, @@ -1769,10 +1769,10 @@ unsigned create_room(char *new_room_name, 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); } @@ -1824,7 +1824,7 @@ unsigned create_room(char *new_room_name, 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); @@ -1884,7 +1884,7 @@ void cmd_cre8(char *args) } 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); @@ -1926,7 +1926,7 @@ void cmd_cre8(char *args) } /* 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) { @@ -1942,7 +1942,7 @@ void cmd_cre8(char *args) /* 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); @@ -1999,9 +1999,9 @@ void cmd_einf(char *ok) 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); } @@ -2018,7 +2018,7 @@ void cmd_lflr(char *gargs) 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, @@ -2054,7 +2054,7 @@ void cmd_cflr(char *argbuf) } 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) diff --git a/citadel/room_ops.h b/citadel/room_ops.h index d099459c1..880ff8219 100644 --- a/citadel/room_ops.h +++ b/citadel/room_ops.h @@ -5,49 +5,13 @@ int has_newmsgs (struct ctdlroom *roombuf, int roomnum, 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 */ -}; diff --git a/citadel/user_ops.c b/citadel/user_ops.c index a4bb7eab4..9f867f971 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -692,16 +692,16 @@ void do_login(void) /* 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); } @@ -1135,13 +1135,13 @@ int create_user(char *newusername, int become_user) * 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 */ @@ -1557,7 +1557,7 @@ int CtdlForgetThisRoom(void) { 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); } @@ -1923,7 +1923,7 @@ int InitialMailCheck() 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);