// Message-related protocol commands for Citadel clients
//
-// Copyright (c) 1987-2023 by the citadel.org team
+// Copyright (c) 1987-2024 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 distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// This program is open source software. Use, duplication, or disclosure
+// is subject to the terms of the GNU General Public License version 3.
#include <stdio.h>
#include <libcitadel.h>
if (with_template == 1) {
memset(buf, 0, 5);
unbuffer_output();
- cprintf("%d Send template then receive message list\n",
- START_CHAT_MODE);
- template = (struct CtdlMessage *)
- malloc(sizeof(struct CtdlMessage));
+ cprintf("%d Send template then receive message list\n", START_CHAT_MODE);
+ template = (struct CtdlMessage *) malloc(sizeof(struct CtdlMessage));
memset(template, 0, sizeof(struct CtdlMessage));
template->cm_magic = CTDLMESSAGE_MAGIC;
template->cm_anon_type = MES_NORMAL;
long tValueLen;
tValueLen = extract_token(tfield, buf, 0, '|', sizeof tfield);
- if ((tValueLen == 4) && GetFieldFromMnemonic(&f, tfield))
- {
+ if ((tValueLen == 4) && GetFieldFromMnemonic(&f, tfield)) {
tValueLen = extract_token(tvalue, buf, 1, '|', sizeof tvalue);
if (tValueLen >= 0) {
CM_SetField(template, f, tvalue);
while(client_getln(buf, sizeof buf) >= 0 && strcmp(buf,"000")) {
eMsgField f;
- if (GetFieldFromMnemonic(&f, buf))
- {
+ if (GetFieldFromMnemonic(&f, buf)) {
Put(filt.Filter, LKEY(i), (void*)f, reference_free_handler);
i++;
}
}
-/*
- * display a message (mode 0 - Citadel proprietary)
- */
-void cmd_msg0(char *cmdbuf)
-{
+// display a message (mode 0 - Citadel proprietary)
+void cmd_msg0(char *cmdbuf) {
long msgid;
int headers_only = HEADERS_ALL;
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_DOWNLOAD, 0, 1, 1, NULL, 0, NULL, NULL, NULL);
}
if (*ptr == '!') *ptr = '|';
}
- /* first check to make sure the request is valid. */
+ // first check to make sure the request is valid.
err = CtdlDoIHavePermissionToPostInThisRoom(
errmsg,
return;
}
- /* Check some other permission type things. */
+ // Check some other permission type things.
if (IsEmptyStr(newusername)) {
strcpy(newusername, CC->user.fullname);
cprintf("%d You don't have permission to author messages as '%s'.\n",
ERROR + HIGHER_ACCESS_REQUIRED,
newuseremail
- );
+ );
return;
}
if (valid_to->num_internet + valid_cc->num_internet + valid_bcc->num_internet > 0) {
if (CtdlCheckInternetMailPermission(&CC->user)==0) {
- cprintf("%d You do not have permission "
- "to send Internet mail.\n",
+ cprintf("%d You do not have permission to send Internet mail.\n",
ERROR + HIGHER_ACCESS_REQUIRED);
free_recipients(valid_to);
free_recipients(valid_cc);
&& (valid_to->num_internet + valid_cc->num_internet + valid_bcc->num_internet > 0)
&& ((CC->user.flags & US_INTERNET) == 0)
&& (!CC->internal_pgm)) {
- cprintf("%d You don't have access to Internet mail.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
+ cprintf("%d You don't have access to Internet mail.\n", ERROR + HIGHER_ACCESS_REQUIRED);
free_recipients(valid_to);
free_recipients(valid_cc);
free_recipients(valid_bcc);
if (!CM_IsEmpty(msg, eExclusiveID)) {
cprintf("%s\n", msg->cm_fields[eExclusiveID]);
- } else {
+ }
+ else {
cprintf("\n");
}
cprintf("000\n");
}
if (CtdlDoIHavePermissionToDeleteMessagesFromThisRoom() == 0) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
+ cprintf("%d Higher access required.\n", ERROR + HIGHER_ACCESS_REQUIRED);
return;
}
free(msgs);
if (num_deleted) {
- cprintf("%d %d message%s deleted.\n", CIT_OK,
- num_deleted, ((num_deleted != 1) ? "s" : ""));
- } else {
+ cprintf("%d %d message%s deleted.\n", CIT_OK, num_deleted, ((num_deleted != 1) ? "s" : ""));
+ }
+ else {
cprintf("%d Message not found.\n", ERROR + MESSAGE_NOT_FOUND);
}
}
if (!(ra & UA_KNOWN)) permit = 0;
if (!permit) {
- cprintf("%d Higher access required.\n",
- ERROR + HIGHER_ACCESS_REQUIRED);
+ cprintf("%d Higher access required.\n", ERROR + HIGHER_ACCESS_REQUIRED);
return;
}
// 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",
- err, targ, err);
+ cprintf("%d Cannot store message(s) in %s: error %d\n", err, targ, err);
free(msgs);
return;
}