this room" flag. I was confused by the poor wording of this option
in the text client, and screwed up the server's behavior when I
rewrote the mailing list server. It's fixed now, and once again
has the correct behavior: anyone can email a room when the flag is
set, and subscribers can email the room regardless of the flag.
// This file contains functions which handle the mapping of Internet addresses
// to users on the Citadel system.
//
// This file contains functions which handle the mapping of Internet addresses
// to users on the Citadel system.
//
-// Copyright (c) 1987-2021 by the citadel.org team
+// Copyright (c) 1987-2022 by the citadel.org team
//
// This program is open source software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3.
//
// This program is open source software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 3.
// If the last item in a list of recipients was truncated to a partial address,
// remove it completely in order to avoid choking library functions.
// If the last item in a list of recipients was truncated to a partial address,
// remove it completely in order to avoid choking library functions.
-void sanitize_truncated_recipient(char *str)
-{
+void sanitize_truncated_recipient(char *str) {
if (!str) return;
if (num_tokens(str, ',') < 2) return;
if (!str) return;
if (num_tokens(str, ',') < 2) return;
if (CtdlGetRoom(&room, room_name)) {
return(0); // room not found, so definitely not subscribed
}
if (CtdlGetRoom(&room, room_name)) {
return(0); // room not found, so definitely not subscribed
}
+
+ // If this room has the QR2_SMTP_PUBLIC flag set, anyone may email a post to this room, even non-subscribers.
+ if (room.QRflags2 & QR2_SMTP_PUBLIC) {
+ return(1);
+ }
+
roomnum = room.QRnumber;
roomnetconfig = LoadRoomNetConfigFile(roomnum);
if (roomnetconfig == NULL) {
roomnum = room.QRnumber;
roomnetconfig = LoadRoomNetConfigFile(roomnum);
if (roomnetconfig == NULL) {
// Client-side functions which perform room operations
//
// Client-side functions which perform room operations
//
-// Copyright (c) 1987-2018 by the citadel.org team
+// Copyright (c) 1987-2022 by the citadel.org team
//
// This program is open source software. Use, duplication, and/or
// disclosure are subject to the GNU General Purpose License version 3.
//
// This program is open source software. Use, duplication, and/or
// disclosure are subject to the GNU General Purpose License version 3.
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Read-only room", QR_READONLY);
attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Allow message deletion by anyone who can post", QR2_COLLABDEL);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Permanent room", QR_PERMANENT);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Read-only room", QR_READONLY);
attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Allow message deletion by anyone who can post", QR2_COLLABDEL);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Permanent room", QR_PERMANENT);
- attr->QRflags2 = set_room_attr(ipc, attr->QRflags2,
- "Subject Required (Force " "users to specify a message " "subject)", QR2_SUBJECTREQ);
+ attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Subject Required (Force users to specify a message subject)", QR2_SUBJECTREQ);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Directory room", QR_DIRECTORY);
if (attr->QRflags & QR_DIRECTORY) {
strprompt("Directory name", attr->QRdirname, 14);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Directory room", QR_DIRECTORY);
if (attr->QRflags & QR_DIRECTORY) {
strprompt("Directory name", attr->QRdirname, 14);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Visible directory", QR_VISDIR);
}
attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Self-service list subscribe/unsubscribe", QR2_SELFLIST);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Visible directory", QR_VISDIR);
}
attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Self-service list subscribe/unsubscribe", QR2_SELFLIST);
- attr->QRflags2 = set_room_attr(ipc, attr->QRflags2,
- "public posting to this room via room_roomname@yourcitadel.org", QR2_SMTP_PUBLIC);
- attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "moderated mailinglist", QR2_MODERATED);
+ attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Allow non-subscribers to mail to this room", QR2_SMTP_PUBLIC);
+ attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Moderated mailing list", QR2_MODERATED);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Automatically make all messages anonymous", QR_ANONONLY);
if ((attr->QRflags & QR_ANONONLY) == 0) {
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Ask users whether to make messages anonymous", QR_ANONOPT);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Automatically make all messages anonymous", QR_ANONONLY);
if ((attr->QRflags & QR_ANONONLY) == 0) {
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Ask users whether to make messages anonymous", QR_ANONOPT);
if (!strcasecmp(room_admin_name, "none")) {
strcpy(room_admin_name, "");
break;
if (!strcasecmp(room_admin_name, "none")) {
strcpy(room_admin_name, "");
break;
r = CtdlIPCQueryUsername(ipc, room_admin_name, buf);
r = CtdlIPCQueryUsername(ipc, room_admin_name, buf);
}
} while (r / 100 != 2);
}
} while (r / 100 != 2);
scr_printf("%s\n", buf);
strncpy(buf, attr->QRname, ROOMNAMELEN);
free(attr);
scr_printf("%s\n", buf);
strncpy(buf, attr->QRname, ROOMNAMELEN);
free(attr);
}
/*
* un-goto the previous room, or a specified room
*/
}
/*
* un-goto the previous room, or a specified room
*/
-void dotungoto(CtdlIPC * ipc, char *towhere)
-{
- /* Find this 'towhere' room in the list ungoto from this room to
- that at the messagepointer position in that room in our ungoto list.
- I suppose I could be a real dick and just ungoto that many places
- in our list. */
+void dotungoto(CtdlIPC * ipc, char *towhere) {
+ // Find this 'towhere' room in the list ungoto from this room to
+ // that at the messagepointer position in that room in our ungoto list.
+ // I suppose I could be a real dick and just ungoto that many places
+ // in our list.
int found = -1;
int lp;
char buf[SIZ];
int found = -1;
int lp;
char buf[SIZ];
- struct ctdlipcroom *rret = NULL; /* ignored */
+ struct ctdlipcroom *rret = NULL; // ignored
int r;
if (uglistsize == 0) {
int r;
if (uglistsize == 0) {
r = CtdlIPCGotoRoom(ipc, uglist[found], "", &rret, buf);
if (rret)
r = CtdlIPCGotoRoom(ipc, uglist[found], "", &rret, buf);
if (rret)
- free(rret); /* ignored */
if (r / 100 != 2) {
scr_printf("%s\n", buf);
return;
if (r / 100 != 2) {
scr_printf("%s\n", buf);
return;
scr_printf("%s\n", buf);
}
strncpy(buf, uglist[found], sizeof(buf));
scr_printf("%s\n", buf);
}
strncpy(buf, uglist[found], sizeof(buf));
- /* we queue ungoto information here, because we're not really
- ungotoing, we're really going to a random spot in some arbitrary
- room list. */
+ // we queue ungoto information here, because we're not really
+ // ungotoing, we're really going to a random spot in some arbitrary
+ // room list.
dotgoto(ipc, buf, 0, 0);
}
dotgoto(ipc, buf, 0, 0);
}
-void ungoto(CtdlIPC * ipc)
-{
+
+void ungoto(CtdlIPC * ipc) {
- struct ctdlipcroom *rret = NULL; /* ignored */
+ struct ctdlipcroom *rret = NULL; // ignored
r = CtdlIPCGotoRoom(ipc, uglist[uglistsize - 1], "", &rret, buf);
r = CtdlIPCGotoRoom(ipc, uglist[uglistsize - 1], "", &rret, buf);
- if (rret)
- free(rret); /* ignored */
+ if (rret) {
+ free(rret); // ignored
+ }
if (r / 100 != 2) {
scr_printf("%s\n", buf);
return;
if (r / 100 != 2) {
scr_printf("%s\n", buf);
return;
strncpy(buf, uglist[uglistsize - 1], sizeof(buf));
uglistsize--;
free(uglist[uglistsize]);
strncpy(buf, uglist[uglistsize - 1], sizeof(buf));
uglistsize--;
free(uglist[uglistsize]);
- /* Don't queue ungoto info or we end up in a loop */
+ // Don't queue ungoto info or we end up in a loop
dotgoto(ipc, buf, 0, 1);
}
dotgoto(ipc, buf, 0, 1);
}
/*
* saves filelen bytes from file at pathname
*/
/*
* saves filelen bytes from file at pathname
*/
-int save_buffer(void *file, size_t filelen, const char *pathname)
-{
+int save_buffer(void *file, size_t filelen, const char *pathname) {
size_t block = 0;
size_t bytes_written = 0;
FILE *fp;
size_t block = 0;
size_t bytes_written = 0;
FILE *fp;
/*
* Save supplied_filename in dest directory; gets the name only
*/
/*
* Save supplied_filename in dest directory; gets the name only
*/
-void destination_directory(char *dest, const char *supplied_filename)
-{
+void destination_directory(char *dest, const char *supplied_filename) {
static char save_dir[SIZ] = { 0 };
if (IsEmptyStr(save_dir)) {
static char save_dir[SIZ] = { 0 };
if (IsEmptyStr(save_dir)) {
* function determines which protocol to use.
* proto - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
*/
* function determines which protocol to use.
* proto - 0 = paginate, 1 = xmodem, 2 = raw, 3 = ymodem, 4 = zmodem, 5 = save
*/
-void download(CtdlIPC * ipc, int proto)
-{
+void download(CtdlIPC * ipc, int proto) {
char buf[SIZ];
char filename[PATH_MAX];
char tempname[PATH_MAX];
char buf[SIZ];
char filename[PATH_MAX];
char tempname[PATH_MAX];