// Message-related protocol commands for Citadel clients
//
-// 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.
msgid = extract_long(cmdbuf, 0);
extract_token(desired_section, cmdbuf, 1, '|', sizeof desired_section);
- safestrncpy(CC->download_desired_section, desired_section,
- sizeof CC->download_desired_section);
+ safestrncpy(CC->download_desired_section, desired_section, sizeof CC->download_desired_section);
CtdlOutputMsg(msgid, MT_SPEW_SECTION, 0, 1, 1, NULL, 0, NULL, NULL, NULL);
}
sizeof errmsg,
NULL,
POST_LOGGED_IN,
- (!IsEmptyStr(references)) /* is this a reply? or a top-level post? */
+ (!IsEmptyStr(references)) // is this a reply? or a top-level post?
);
if (err) {
cprintf("%d %s\n", err, errmsg);
strcpy(bcc, "");
}
- TRACE;
valid_to = validate_recipients(recp, NULL, 0);
- TRACE;
if (valid_to->num_error > 0) {
cprintf("%d %s\n", ERROR + NO_SUCH_USER, valid_to->errormsg);
free_recipients(valid_to);
return;
}
- TRACE;
valid_cc = validate_recipients(cc, NULL, 0);
- TRACE;
if (valid_cc->num_error > 0) {
cprintf("%d %s\n", ERROR + NO_SUCH_USER, valid_cc->errormsg);
free_recipients(valid_to);
return;
}
- TRACE;
valid_bcc = validate_recipients(bcc, NULL, 0);
- TRACE;
if (valid_bcc->num_error > 0) {
cprintf("%d %s\n", ERROR + NO_SUCH_USER, valid_bcc->errormsg);
free_recipients(valid_to);
return;
}
- /* Recipient required, but none were specified */
+ // Recipient required, but none were specified
if ( (valid_to->num_error < 0) && (valid_cc->num_error < 0) && (valid_bcc->num_error < 0) ) {
free_recipients(valid_to);
free_recipients(valid_cc);
}
}
- if ( ( (valid_to->num_internet + valid_to->num_ignet + valid_cc->num_internet + valid_cc->num_ignet + valid_bcc->num_internet + valid_bcc->num_ignet) > 0)
- && (CC->user.axlevel < AxNetU) ) {
- cprintf("%d Higher access required for network mail.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
+ if ( ( (valid_to->num_internet + valid_cc->num_internet + valid_bcc->num_internet) > 0) && (CC->user.axlevel < AxNetU) ) {
+ cprintf("%d Higher access required for network mail.\n", ERROR + HIGHER_ACCESS_REQUIRED);
free_recipients(valid_to);
free_recipients(valid_cc);
free_recipients(valid_bcc);
}
- /* Is this a room which has anonymous-only or anonymous-option? */
+ // Is this a room which has anonymous-only or anonymous-option?
anonymous = MES_NORMAL;
if (CC->room.QRflags & QR_ANONONLY) {
anonymous = MES_ANONONLY;
}
if (CC->room.QRflags & QR_ANONOPT) {
- if (anon_flag == 1) { /* only if the user requested it */
+ if (anon_flag == 1) { // only if the user requested it
anonymous = MES_ANONOPT;
}
}
recp[0] = 0;
}
- /* Recommend to the client that the use of a message subject is
- * strongly recommended in this room, if either the SUBJECTREQ flag
- * is set, or if there is one or more Internet email recipients.
- */
+ // Recommend to the client that the use of a message subject is
+ // strongly recommended in this room, if either the SUBJECTREQ flag
+ // is set, or if there is one or more Internet email recipients.
+
if (CC->room.QRflags2 & QR2_SUBJECTREQ) subject_required = 1;
if ((valid_to) && (valid_to->num_internet > 0)) subject_required = 1;
if ((valid_cc) && (valid_cc->num_internet > 0)) subject_required = 1;
if ((valid_bcc) && (valid_bcc->num_internet > 0)) subject_required = 1;
- /* If we're only checking the validity of the request, return
- * success without creating the message.
- */
+ // If we're only checking the validity of the request, return success without creating the message.
if (post == 0) {
cprintf("%d %s|%d\n", CIT_OK,
((valid_to != NULL) ? valid_to->display_recp : ""),
return;
}
- /* We don't need these anymore because we'll do it differently below */
+ // We don't need these anymore because we'll do it differently below
free_recipients(valid_to);
free_recipients(valid_cc);
free_recipients(valid_bcc);
- /* Read in the message from the client. */
+ // Read in the message from the client.
if (do_confirm) {
cprintf("%d send message\n", START_CHAT_MODE);
- } else {
+ }
+ else {
cprintf("%d send message\n", SEND_LISTING);
}
((!IsEmptyStr(supplied_euid)) ? supplied_euid : NULL),
NULL, references);
- /* Put together one big recipients struct containing to/cc/bcc all in
- * one. This is for the envelope.
- */
+ // Put together one big recipients struct containing to/cc/bcc all in one. This is for the envelope.
char *all_recps = malloc(SIZ * 3);
strcpy(all_recps, recp);
if (!IsEmptyStr(cc)) {
strcat(all_recps, bcc);
}
if (!IsEmptyStr(all_recps)) {
- TRACE;
valid = validate_recipients(all_recps, NULL, 0);
- TRACE;
}
else {
valid = NULL;
}
free(all_recps);
- if ((valid != NULL) && (valid->num_room == 1) && !IsEmptyStr(valid->recp_orgroom))
- {
- /* posting into an ML room? set the envelope from
- * to the actual mail address so others get a valid
- * reply-to-header.
- */
+ // posting into a mailing list room? set the envelope from
+ // to the actual mail address so others get a valid reply-to-header.
+ if ((valid != NULL) && (valid->num_room == 1) && !IsEmptyStr(valid->recp_orgroom)) {
CM_SetField(msg, eenVelopeTo, valid->recp_orgroom, strlen(valid->recp_orgroom));
}
return;
}
- /*
- * Build our message set to be moved/copied
- */
+ // Build our message set to be moved/copied
msgs = malloc(num_msgs * sizeof(long));
for (i=0; i<num_msgs; ++i) {
extract_token(msgtok, msgset, i, ',', sizeof msgtok);
CtdlGetUser(&CC->user, CC->curr_user);
CtdlRoomAccess(&qtemp, &CC->user, &ra, NULL);
- /* Check for permission to perform this operation.
- * Remember: "CC->room" is source, "qtemp" is target.
- */
+ // Check for permission to perform this operation.
+ // Remember: "CC->room" is source, "qtemp" is target.
permit = 0;
- /* Admins can move/copy */
+ // Admins can move/copy
if (CC->user.axlevel >= AxAideU) permit = 1;
- /* Room aides can move/copy */
+ // Room aides can move/copy
if (CC->user.usernum == CC->room.QRroomaide) permit = 1;
- /* Permit move/copy from personal rooms */
+ // Permit move/copy from personal rooms
if ((CC->room.QRflags & QR_MAILBOX)
&& (qtemp.QRflags & QR_MAILBOX)) permit = 1;
- /* Permit only copy from public to personal room */
- if ( (is_copy)
- && (!(CC->room.QRflags & QR_MAILBOX))
- && (qtemp.QRflags & QR_MAILBOX)) permit = 1;
+ // Permit only copy from public to personal room
+ if ( (is_copy)
+ && (!(CC->room.QRflags & QR_MAILBOX))
+ && (qtemp.QRflags & QR_MAILBOX)
+ ) {
+ permit = 1;
+ }
- /* Permit message removal from collaborative delete rooms */
+ // Permit message removal from collaborative delete rooms
if (CC->room.QRflags2 & QR2_COLLABDEL) permit = 1;
- /* Users allowed to post into the target room may move into it too. */
+ // Users allowed to post into the target room may move into it too.
if ((CC->room.QRflags & QR_MAILBOX) &&
(qtemp.QRflags & UA_POSTALLOWED)) permit = 1;
- /* User must have access to target room */
+ // User must have access to target room
if (!(ra & UA_KNOWN)) permit = 0;
if (!permit) {
return;
}
- /*
- * Build our message set to be moved/copied
- */
+ // Build our message set to be moved/copied
msgs = malloc(num_msgs * sizeof(long));
for (i=0; i<num_msgs; ++i) {
extract_token(msgtok, msgset, i, ',', sizeof msgtok);
msgs[i] = atol(msgtok);
}
- /*
- * Do the copy
- */
+ // Do the copy
err = CtdlSaveMsgPointersInRoom(targ, msgs, num_msgs, 1, NULL, 0);
if (err != 0) {
cprintf("%d Cannot store message(s) in %s: error %d\n",
return;
}
- /* Now delete the message from the source room,
- * if this is a 'move' rather than a 'copy' operation.
- */
+ // Now delete the message from the source room, if this is a 'move' rather than a 'copy' operation.
if (is_copy == 0) {
CtdlDeleteMessages(CC->room.QRname, msgs, num_msgs, "");
}