From: Art Cancro Date: Wed, 25 Nov 2009 20:38:42 +0000 (+0000) Subject: * Modified the text client so that the nter message command does not work in room... X-Git-Tag: v7.86~590 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=936975983ba97e5049f92a271a83696ca49a69ba * Modified the text client so that the nter message command does not work in room types other than BBS and Mailbox. --- diff --git a/citadel/include/citadel_ipc.h b/citadel/include/citadel_ipc.h index 01b063622..36611e0e2 100644 --- a/citadel/include/citadel_ipc.h +++ b/citadel/include/citadel_ipc.h @@ -113,6 +113,8 @@ struct ctdlipcroom { char RRaide; /* User can do aide commands in room */ long RRnewmail; /* Number of new mail messages */ char RRfloor; /* Which floor this room is on */ + char RRcurrentview; /* The user's current view for this room */ + char RRdefaultview; /* The default view for this room */ }; diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index 6ae8eda01..df46e1b3d 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -108,8 +108,9 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { /* If this isn't a MIME message, don't bother. */ if (msg->cm_format_type != 4) return(0); - /* If there's no EUID we can't do this. */ - if (msg->cm_fields['E'] == NULL) return(0); + /* If there's no EUID we can't do this. Reject the post. */ + if (msg->cm_fields['E'] == NULL) return(1); + snprintf(history_page, sizeof history_page, "%s_HISTORY_", msg->cm_fields['E']); /* Make sure we're saving a real wiki page rather than a wiki history page. @@ -132,7 +133,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { msg->cm_fields['U'] = strdup(msg->cm_fields['E']); /* See if we can retrieve the previous version. */ - old_msgnum = locate_message_by_euid(msg->cm_fields['E'], &CCC->room); + old_msgnum = CtdlLocateMessageByEuid(msg->cm_fields['E'], &CCC->room); if (old_msgnum > 0L) { old_msg = CtdlFetchMessage(old_msgnum, 1); } @@ -203,7 +204,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { /* Now look for the existing edit history */ - history_msgnum = locate_message_by_euid(history_page, &CCC->room); + history_msgnum = CtdlLocateMessageByEuid(history_page, &CCC->room); history_msg = NULL; if (history_msgnum > 0L) { history_msg = CtdlFetchMessage(history_msgnum, 1); @@ -365,7 +366,7 @@ void wiki_history(char *pagename) { } snprintf(history_page_name, sizeof history_page_name, "%s_HISTORY_", pagename); - msgnum = locate_message_by_euid(history_page_name, &CC->room); + msgnum = CtdlLocateMessageByEuid(history_page_name, &CC->room); if (msgnum > 0L) { msg = CtdlFetchMessage(msgnum, 1); } @@ -489,7 +490,7 @@ void wiki_rev(char *pagename, char *rev, char *operation) /* Begin by fetching the current version of the page. We're going to patch * backwards through the diffs until we get the one we want. */ - msgnum = locate_message_by_euid(pagename, &CC->room); + msgnum = CtdlLocateMessageByEuid(pagename, &CC->room); if (msgnum > 0L) { msg = CtdlFetchMessage(msgnum, 1); } @@ -523,7 +524,7 @@ void wiki_rev(char *pagename, char *rev, char *operation) /* Get the revision history */ snprintf(history_page_name, sizeof history_page_name, "%s_HISTORY_", pagename); - msgnum = locate_message_by_euid(history_page_name, &CC->room); + msgnum = CtdlLocateMessageByEuid(history_page_name, &CC->room); if (msgnum > 0L) { msg = CtdlFetchMessage(msgnum, 1); } diff --git a/citadel/textclient/citadel.c b/citadel/textclient/citadel.c index 7e5ef874a..ba6d6103f 100644 --- a/citadel/textclient/citadel.c +++ b/citadel/textclient/citadel.c @@ -92,6 +92,7 @@ int screenwidth; int screenheight; unsigned room_flags; unsigned room_flags2; +int entmsg_ok = 0; char room_name[ROOMNAMELEN]; char *uglist[UGLISTLEN]; /* size of the ungoto list */ long uglistlsn[UGLISTLEN]; /* current read position for all the ungoto's. Not going to make any friends with this one. */ @@ -470,6 +471,19 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto) from_floor = curr_floor; curr_floor = room->RRfloor; + /* Determine, based on the room's default view, whether an nter message + * command will be valid here. + */ + switch(room->RRdefaultview) { + case VIEW_BBS: + case VIEW_MAILBOX: + entmsg_ok = 1; + break; + default: + entmsg_ok = 0; + break; + } + remove_march(room_name, 0); if (!strcasecmp(towhere, "_BASEROOM_")) remove_march(towhere, 0); diff --git a/citadel/textclient/messages.c b/citadel/textclient/messages.c index fdd8d46b4..0434cd36d 100644 --- a/citadel/textclient/messages.c +++ b/citadel/textclient/messages.c @@ -74,6 +74,7 @@ extern char room_name[]; extern char tempdir[]; extern unsigned room_flags; extern unsigned room_flags2; +extern int entmsg_ok; extern long highest_msg_read; extern char temp[]; extern char temp2[]; @@ -1093,10 +1094,17 @@ int entmsg(CtdlIPC *ipc, int r; /* IPC response code */ int subject_required = 0; - if (c > 0) + if (!entmsg_ok) { + scr_printf("You may not enter messages in this type of room.\n"); + return(1); + } + + if (c > 0) { mode = 1; - else + } + else { mode = 0; + } strcpy(subject, ""); diff --git a/citadel/utillib/citadel_ipc.c b/citadel/utillib/citadel_ipc.c index ef902281d..0ac29d4bb 100644 --- a/citadel/utillib/citadel_ipc.c +++ b/citadel/utillib/citadel_ipc.c @@ -443,6 +443,9 @@ int CtdlIPCGotoRoom(CtdlIPC *ipc, const char *room, const char *passwd, rret[0]->RRaide = extract_int(cret, 8); rret[0]->RRnewmail = extract_long(cret, 9); rret[0]->RRfloor = extract_int(cret, 10); + rret[0]->RRcurrentview = extract_int(cret, 11); + rret[0]->RRdefaultview = extract_int(cret, 12); + /* position 13 is a trash folder flag ... irrelevant in this client */ rret[0]->RRflags2 = extract_int(cret, 14); } else { free(*rret);