From 27e718b900627fdb0e9ae851f61fa9613d058100 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 25 Oct 2005 03:10:18 +0000 Subject: [PATCH] fix for above --- citadel/msgbase.c | 1 + citadel/room_ops.c | 56 ++++++++++++++++++++++++++-------------------- citadel/room_ops.h | 1 + 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/citadel/msgbase.c b/citadel/msgbase.c index dfb033cef..88bcff6b4 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -3362,6 +3362,7 @@ void cmd_move(char *args) num = extract_long(args, 0); extract_token(targ, args, 1, '|', sizeof targ); + convert_room_name_macros(targ, sizeof targ); targ[ROOMNAMELEN - 1] = 0; is_copy = extract_int(args, 2); diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 46490bd9d..3d90b405c 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -910,6 +910,37 @@ void usergoto(char *where, int display_result, int transiently, } +/* + * Handle some of the macro named rooms + */ +void convert_room_name_macros(char *towhere, size_t maxlen) { + if (!strcasecmp(towhere, "_BASEROOM_")) { + safestrncpy(towhere, config.c_baseroom, maxlen); + } + else if (!strcasecmp(towhere, "_MAIL_")) { + safestrncpy(towhere, MAILROOM, maxlen); + } + else if (!strcasecmp(towhere, "_TRASH_")) { + safestrncpy(towhere, USERTRASHROOM, maxlen); + } + else if (!strcasecmp(towhere, "_BITBUCKET_")) { + safestrncpy(towhere, config.c_twitroom, maxlen); + } + else if (!strcasecmp(towhere, "_CALENDAR_")) { + safestrncpy(towhere, USERCALENDARROOM, maxlen); + } + else if (!strcasecmp(towhere, "_TASKS_")) { + safestrncpy(towhere, USERTASKSROOM, maxlen); + } + else if (!strcasecmp(towhere, "_CONTACTS_")) { + safestrncpy(towhere, USERCONTACTSROOM, maxlen); + } + else if (!strcasecmp(towhere, "_NOTES_")) { + safestrncpy(towhere, USERNOTESROOM, maxlen); + } +} + + /* * cmd_goto() - goto a new room */ @@ -935,30 +966,7 @@ void cmd_goto(char *gargs) /* * Handle some of the macro named rooms */ - if (!strcasecmp(towhere, "_BASEROOM_")) { - safestrncpy(towhere, config.c_baseroom, sizeof towhere); - } - else if (!strcasecmp(towhere, "_MAIL_")) { - safestrncpy(towhere, MAILROOM, sizeof towhere); - } - else if (!strcasecmp(towhere, "_TRASH_")) { - safestrncpy(towhere, USERTRASHROOM, sizeof towhere); - } - else if (!strcasecmp(towhere, "_BITBUCKET_")) { - safestrncpy(towhere, config.c_twitroom, sizeof towhere); - } - else if (!strcasecmp(towhere, "_CALENDAR_")) { - safestrncpy(towhere, USERCALENDARROOM, sizeof towhere); - } - else if (!strcasecmp(towhere, "_TASKS_")) { - safestrncpy(towhere, USERTASKSROOM, sizeof towhere); - } - else if (!strcasecmp(towhere, "_CONTACTS_")) { - safestrncpy(towhere, USERCONTACTSROOM, sizeof towhere); - } - else if (!strcasecmp(towhere, "_NOTES_")) { - safestrncpy(towhere, USERNOTESROOM, sizeof towhere); - } + convert_room_name_macros(towhere, sizeof towhere); /* First try a regular match */ c = getroom(&QRscratch, towhere); diff --git a/citadel/room_ops.h b/citadel/room_ops.h index f5b820a7f..b0fef7fb5 100644 --- a/citadel/room_ops.h +++ b/citadel/room_ops.h @@ -60,6 +60,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, 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() */ -- 2.39.2