/*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 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 as published by
* DownLoad Room Image (see its icon or whatever)
* If this command succeeds, it follows the same protocol as the DLAT command.
*/
-void cmd_dlri(char *cmdbuf)
-{
+void cmd_dlri(char *cmdbuf) {
if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
if (CC->room.msgnum_pic < 1) {
cprintf("%d No image found.\n", ERROR + FILE_NOT_FOUND);
/*
* UpLoad Room Image (avatar or photo or whatever)
*/
-void cmd_ulri(char *cmdbuf)
-{
+void cmd_ulri(char *cmdbuf) {
long data_length;
char mimetype[SIZ];
* DownLoad User Image (see their avatar or photo or whatever)
* If this command succeeds, it follows the same protocol as the DLAT command.
*/
-void cmd_dlui(char *cmdbuf)
-{
+void cmd_dlui(char *cmdbuf) {
struct ctdluser ruser;
char buf[SIZ];
/*
* UpLoad User Image (avatar or photo or whatever)
*/
-void cmd_ului(char *cmdbuf)
-{
+void cmd_ului(char *cmdbuf) {
long data_length;
char mimetype[SIZ];
char username[USERNAME_SIZE];
if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
- if (num_parms(cmdbuf) < 2)
- {
+ if (num_parms(cmdbuf) < 2) {
cprintf("%d Usage error\n", ERROR + ILLEGAL_VALUE);
return;
}
/*
* Import function called by import_old_userpic_files() for a single user
*/
-void import_one_userpic_file(char *username, long usernum, char *path)
-{
+void import_one_userpic_file(char *username, long usernum, char *path) {
syslog(LOG_DEBUG, "Import legacy userpic for %s, usernum=%ld, filename=%s", username, usernum, path);
FILE *fp = fopen(path, "r");
/*
* Look for old-format "userpic" files and import them into the message base
*/
-void import_old_userpic_files(void)
-{
+void import_old_userpic_files(void) {
DIR *filedir = NULL;
struct dirent *filedir_entry;
size_t d_namelen;
}
FreeStrBuf(&s.TheMessage);
- if (fromaddr)
+ if (fromaddr) {
free(fromaddr);
+ }
return ((int) response_code);
}
int should_try_now = 0;
if (attempted < submitted) { // If no attempts have been made yet, try now
should_try_now = 1;
- } else if ((attempted - submitted) <= 14400) {
+ }
+ else if ((attempted - submitted) <= 14400) {
if ((time(NULL) - attempted) > 1800) { // First four hours, retry every 30 minutes
should_try_now = 1;
}
- } else {
+ }
+ else {
if ((time(NULL) - attempted) > 14400) { // After that, retry once every 4 hours
should_try_now = 1;
}
StrBufAppendPrintf(NewInstr, "Content-type: " SPOOLMIME "\n\n");
StrBufAppendPrintf(NewInstr, "msgid|%ld\n", msgid);
StrBufAppendPrintf(NewInstr, "submitted|%ld\n", submitted);
- if (bounceto)
+ if (bounceto) {
StrBufAppendPrintf(NewInstr, "bounceto|%s\n", bounceto);
- if (envelope_from)
+ }
+ if (envelope_from) {
StrBufAppendPrintf(NewInstr, "envelope_from|%s\n", envelope_from);
-
+ }
for (i = 0; i < num_tokens(instr, '\n'); ++i) {
extract_token(cfgline, instr, i, '\n', sizeof cfgline);
if (!strncasecmp(cfgline, HKEY("remote|"))) {
"smtpclient: recp: <%s> , result: %d (%s)", recp, new_result, server_response);
if ((new_result / 100) == 2) {
++num_success;
- } else {
+ }
+ else {
if ((new_result / 100) == 5) {
++num_fail;
- } else {
+ }
+ else {
++num_delayed;
}
StrBufAppendPrintf
deletes[1] = msgid;
CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, deletes, 2, "");
FreeStrBuf(&NewInstr); // We have to free NewInstr here, no longer needed
- } else {
+ }
+ else {
// replace the old queue entry with the new one
syslog(LOG_DEBUG, "smtpclient: %ld rewriting", qmsgnum);
msg = convert_internet_message_buf(&NewInstr); // This function will free NewInstr for us
CM_Free(msg);
CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, &qmsgnum, 1, "");
}
- } else {
+ }
+ else {
syslog(LOG_DEBUG, "smtpclient: %ld retry time not reached", qmsgnum);
}
- if (bounceto != NULL)
+ if (bounceto != NULL) {
free(bounceto);
- if (envelope_from != NULL)
+ }
+ if (envelope_from != NULL) {
free(envelope_from);
+ }
free(instr);
}
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.
*/
- if (doing_smtpclient)
+ if (doing_smtpclient) {
return;
+ }
doing_smtpclient = 1;
syslog(LOG_DEBUG, "smtpclient: start queue run");
/*
* Utility functions for the Citadel SMTP implementation
*
- * Copyright (c) 1998-2020 by the citadel.org team
+ * Copyright (c) 1998-2021 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.
#include "ctdl_module.h"
#include "smtp_util.h"
-const char *smtp_get_Recipients(void)
-{
+const char *smtp_get_Recipients(void) {
struct citsmtp *sSMTP = SMTP;
if (sSMTP == NULL)
* SDB_BOUNCE_ALL Advise the sender that all deliveries have failed and will not be retried
* SDB_WARN Warn the sender about all 4XX transient delays
*/
-void smtp_do_bounce(const char *instr, int is_final)
-{
+void smtp_do_bounce(const char *instr, int is_final) {
int i;
int lines;
int status;
StrBufAppendPrintf(boundary, "%s_%04x%04x", CtdlGetConfigStr("c_fqdn"), getpid(), ++seq);
-
/* Start building our bounce message */
bmsg = (struct CtdlMessage *) malloc(sizeof(struct CtdlMessage));
StrBufAppendBufPlain(BounceMB, HKEY("\r\n"), 0);
StrBufAppendBufPlain(BounceMB, HKEY("Content-type: text/plain\r\n\r\n"), 0);
- if (is_final == SDB_BOUNCE_ALL)
- {
+ if (is_final == SDB_BOUNCE_ALL) {
StrBufAppendBufPlain(
BounceMB,
HKEY( "A message you sent could not be delivered "
"Giving up on the following addresses:\n\n"),
0);
}
- else if (is_final == SDB_BOUNCE_FATALS)
- {
+ else if (is_final == SDB_BOUNCE_FATALS) {
StrBufAppendBufPlain(
BounceMB,
HKEY( "A message you sent could not be delivered "
"The following addresses were undeliverable:\n\n"),
0);
}
- else if (is_final == SDB_WARN)
- {
+ else if (is_final == SDB_WARN) {
StrBufAppendBufPlain(
BounceMB,
HKEY("A message you sent has not been delivered "
"The following addresses were undeliverable:\n\n"),
0);
}
- else // should never get here
- {
+ else { // should never get here
StrBufAppendBufPlain(BounceMB, HKEY("This message should never occur.\n\n"), 0);
}
}
-
-
-
char *smtpcodes[][2] = {
{ "211 - System status / system help reply" },
{ "214", "Help message" },
};
-
char *smtpstatus(int code) {
int i;
return("Unknown or other SMTP status");
}
-