-/* $Id$ */
+/*
+ * $Id$
+ *
+ * Implements the message store.
+ *
+ */
#include "sysdep.h"
#include <stdlib.h>
{
int i;
- for (i = 0; i < strlen(name); ++i)
+stov: for (i = 0; i < strlen(name); ++i) {
if (name[i] == '@') {
if (i > 0)
if (isspace(name[i - 1])) {
strcpy(&name[i - 1], &name[i]);
- i = 0;
+ goto stov; /* start over */
}
while (isspace(name[i + 1])) {
strcpy(&name[i + 1], &name[i + 2]);
}
}
+ }
}
int a, b;
char aaa[300], bbb[300];
- TRACE;
remove_any_whitespace_to_the_left_or_right_of_at_symbol(name);
- TRACE;
fp = fopen("network/mail.aliases", "r");
if (fp == NULL)
fp = fopen("/dev/null", "r");
if (fp == NULL)
return (MES_ERROR);
- TRACE;
strcpy(aaa, "");
strcpy(bbb, "");
while (fgets(aaa, sizeof aaa, fp) != NULL) {
if (!strcasecmp(name, aaa))
strcpy(name, bbb);
}
- TRACE;
fclose(fp);
lprintf(7, "Mail is being forwarded to %s\n", name);
}
/* determine local or remote type, see citadel.h */
- TRACE;
for (a = 0; a < strlen(name); ++a)
if (name[a] == '!')
return (MES_INTERNET);
- TRACE;
for (a = 0; a < strlen(name); ++a)
if (name[a] == '@')
for (b = a; b < strlen(name); ++b)
if (name[b] == '.')
return (MES_INTERNET);
b = 0;
- TRACE;
for (a = 0; a < strlen(name); ++a)
if (name[a] == '@')
++b;
GETSN: do {
a = getstring(fp, aaa);
} while ((a >= 0) && (strcasecmp(aaa, bbb)));
- TRACE;
a = getstring(fp, aaa);
if (!strncmp(aaa, "use ", 4)) {
strcpy(bbb, &aaa[4]);
goto GETSN;
}
fclose(fp);
- TRACE;
if (!strncmp(aaa, "uum", 3)) {
strcpy(bbb, name);
for (a = 0; a < strlen(bbb); ++a) {
}
return (MES_ERROR);
}
- TRACE;
lprintf(9, "returning MES_LOCAL\n");
return (MES_LOCAL);
}
-void simple_listing(long msgnum)
+void simple_listing(long msgnum, void *userdata)
{
cprintf("%ld\n", msgnum);
}
int moderation_level,
char *content_type,
struct CtdlMessage *compare,
- void (*CallBack) (long msgnum))
+ void (*CallBack) (long, void *),
+ void *userdata)
{
int a;
|| ((mode == MSGS_EQ) && (thismsg == ref))
)
) {
- if (CallBack) CallBack(thismsg);
+ if (CallBack) CallBack(thismsg, userdata);
++num_processed;
}
}
CtdlForEachMessage(mode, cm_ref,
CC->usersupp.moderation_filter,
- NULL, template, simple_listing);
+ NULL, template, simple_listing, NULL);
if (template != NULL) CtdlFreeMessage(template);
cprintf("000\n");
}
else if (i == 'R')
cprintf("To: %s%s", mptr, nl);
else if (i == 'T') {
- generate_rfc822_datestamp(datestamp,
- atol(mptr) );
+ datestring(datestamp, atol(mptr),
+ DATESTRING_RFC822 );
cprintf("Date: %s%s", datestamp, nl);
}
}
{
long msgid;
- CtdlAllocUserData(SYM_DESIRED_SECTION, 64);
+ CtdlAllocUserData(SYM_DESIRED_SECTION, 256);
msgid = extract_long(cmdbuf, 0);
extract(desired_section, cmdbuf, 1);
/*
* Back end for the ReplicationChecks() function
*/
-void check_repl(long msgnum) {
+void check_repl(long msgnum, void *userdata) {
struct CtdlMessage *msg;
time_t timestamp = (-1L);
memset(template, 0, sizeof(struct CtdlMessage));
template->cm_fields['E'] = strdoop(msg->cm_fields['E']);
- CtdlForEachMessage(MSGS_ALL, 0L, (-127), NULL, template, check_repl);
+ CtdlForEachMessage(MSGS_ALL, 0L, (-127), NULL, template,
+ check_repl, NULL);
/* If a newer message exists with the same Extended ID, abort
* this save.
-void CtdlGetSysConfigBackend(long msgnum) {
+void CtdlGetSysConfigBackend(long msgnum, void *userdata) {
config_msgnum = msgnum;
}
begin_critical_section(S_CONFIG);
config_msgnum = (-1L);
CtdlForEachMessage(MSGS_LAST, 1, (-127), sysconfname, NULL,
- CtdlGetSysConfigBackend);
+ CtdlGetSysConfigBackend, NULL);
msgnum = config_msgnum;
end_critical_section(S_CONFIG);