//
// Copyright (c) 1987-2024 by the citadel.org team
//
-// This program is open source software. Use, duplication, or disclosure
-// is subject to the terms of the GNU General Public License, version 3.
+// This program is open source software. Use, duplication, or disclosure is subject to the GNU General Public License version 3.
#include "sysdep.h"
#include <stdlib.h>
struct recptypes *recp;
int i;
- recp = validate_recipients(addr, NULL, 0);
+ recp = validate_recipients(addr, 0);
if (recp == NULL) return(0);
if (recp->num_local == 0) {
//
// Caller needs to free the result using free_recipients()
//
-struct recptypes *validate_recipients(char *supplied_recipients, const char *RemoteIdentifier, int Flags) {
+struct recptypes *validate_recipients(char *recipients_in, int Flags) {
struct recptypes *ret;
- char *recipients = NULL;
char append[SIZ];
long len;
int mailtype;
if (ret == NULL) return(NULL);
memset(ret, 0, sizeof(struct recptypes)); // set all values to null/zero
- if (supplied_recipients == NULL) {
- recipients = strdup("");
- }
- else {
- recipients = strdup(supplied_recipients);
- }
-
- len = strlen(recipients) + 1024; // allocate memory
+ len = strlen(recipients_in) + 1024; // allocate memory
ret->errormsg = malloc(len);
ret->recp_local = malloc(len);
ret->recp_internet = malloc(len);
ret->display_recp[0] = 0;
ret->recptypes_magic = RECPTYPES_MAGIC;
- Array *recp_array = split_recps(supplied_recipients, NULL);
+ Array *recp_array = split_recps(recipients_in, NULL);
char *aliases = CtdlGetSysConfig(GLOBAL_ALIASES); // First hit the Global Alias Table
strncpy(this_recp, org_recp, sizeof this_recp);
int i;
- for (i=0; i<3; ++i) { // pass three times through the aliaser
+ for (i=0; i<3; ++i) { // pass three times through the aliaser
mailtype = expand_aliases(this_recp, aliases);
// If an alias expanded to multiple recipients, strip off those recipients and append them
ret->num_local, ret->num_room, ret->num_internet, ret->num_error
);
- free(recipients);
if (recp_array) {
array_free(recp_array);
}
*FieldEnd = pFieldEnd;
// convert non-space whitespace to spaces, and remove double blanks
- for (sField = *field = pField;
- sField < pFieldEnd;
- pField++, sField++)
- {
- if ((*sField=='\r') || (*sField=='\n'))
- {
+ for (sField = *field = pField; sField < pFieldEnd; pField++, sField++) {
+ if ((*sField=='\r') || (*sField=='\n')) {
int offset = 1;
while ( ( (*(sField + offset) == '\r') || (*(sField + offset) == '\n' )) && (sField + offset < pFieldEnd) ) {
offset ++;
pField++;
sField++;
- while ((sField < pFieldEnd) &&
- isspace(*sField))
+ while ((sField < pFieldEnd) && isspace(*sField))
sField++;
*pField = *sField;
}
processed = 1;
}
-
-
// Clean up and move on.
free(key); // Don't free 'value', it's actually the same buffer
return processed;
}
++pos;
-
}
// At this point we have a field. Are we interested in it?
alldone = 1;
}
StrBufAppendBufPlain(OtherHeaders, HKEY("\n"), 0);
- if (pos < totalend)
+ if (pos < totalend) {
StrBufAppendBufPlain(OtherHeaders, pos, totalend - pos, 0);
+ }
FreeStrBuf(rfc822);
CM_SetAsFieldSB(msg, eMessageText, &OtherHeaders);
}
-// Harvest any email addresses that someone might want to have in their
-// "collected addresses" book.
+// Harvest any email addresses that someone might want to have in their "collected addresses" book.
char *harvest_collected_addresses(struct CtdlMessage *msg) {
char *coll = NULL;
char addr[256];