ID's instead of the conventional Citadel style.
$Log$
+Revision 1.481 2000/03/10 21:40:04 ajc
+* Changes to message base and networker to support Internet-style message
+ ID's instead of the conventional Citadel style.
+
Revision 1.480 2000/03/08 03:36:37 ajc
* Shut off hostname resolution when dealing with Unix domain sockets
* Cleaned up the 'citmail' MDA tool
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
+
/****************************************************************************/
-struct recentmsg {
- char RMnodename[10];
- long RMnum; /* Number or time of message */
- };
-
-
-/****************************************************************************
- *
+/*
* Floor record. The floor number is implicit in its location in the file.
*/
struct floor {
#define SPOOLMIME "application/x-citadel-delivery-list"
#define INTERNETCFG "application/x-citadel-internet-config"
-/*
- * This structure is used to hold all of the fields of a message
- * during conversion, processing, or whatever.
- */
-struct minfo {
- char A[512];
- char B[512];
- char C[512];
- char D[512];
- char E[512];
- char G[512];
- char H[512];
- long I;
- char N[512];
- char O[512];
- char P[512];
- char R[512];
- char S[512];
- long T;
- char U[512];
- char Z[512];
- char nexthop[512];
- };
-
#define TRACE lprintf(9, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
processed = 1;
}
+ else if (!strcasecmp(key, "Message-ID")) {
+ if (msg->cm_fields['I'] != NULL) {
+ lprintf(5, "duplicate message id\n");
+ }
+
+ if (msg->cm_fields['I'] == NULL) {
+ msg->cm_fields['I'] = strdoop(value);
+
+ /* Strip angle brackets */
+ if ((haschar(msg->cm_fields['I'], '<') == 1)
+ && (haschar(msg->cm_fields['I'], '>') == 1)) {
+ while ((strlen(msg->cm_fields['I']) > 0)
+ && (msg->cm_fields['I'][0] != '<')) {
+ strcpy(&msg->cm_fields['I'][0],
+ &msg->cm_fields['I'][1]);
+ }
+ strcpy(&msg->cm_fields['I'][0],
+ &msg->cm_fields['I'][1]);
+ for (i = 0; i<strlen(msg->cm_fields['I']); ++i)
+ if (msg->cm_fields['I'][i] == '>')
+ msg->cm_fields['I'][i] = 0;
+ }
+ }
+
+ if (msg->cm_fields['I'] != NULL) {
+ TRACE;
+ lprintf(9, "Converted message id <%s>\n",
+ msg->cm_fields['I'] );
+ }
+ processed = 1;
+ }
+
/* Clean up and move on. */
phree(key); /* Don't free 'value', it's actually the same buffer */
return(processed);
while (!done) {
+ TRACE; lprintf(9, "I field is %s\n", msg->cm_fields['I']);
/* Locate beginning and end of field, keeping in mind that
* some fields might be multiline
*/
}
/* Follow-up sanity checks... */
+ TRACE; lprintf(9, "I field is %s\n", msg->cm_fields['I']);
/* If there's no timestamp on this message, set it to now. */
if (msg->cm_fields['T'] == NULL) {
msg->cm_fields['T'] = strdoop(buf);
}
+ TRACE; lprintf(9, "I field is %s\n", msg->cm_fields['I']);
lprintf(9, "RFC822 length remaining after conversion = %d\n",
strlen(rfc822));
return msg;
if (!strcasecmp(snode, NODENAME)) {
strcpy(snode, FQDN);
}
- cprintf("Message-ID: <%s@%s>%s", mid, snode, nl);
+
+ /* Construct a fun message id */
+ cprintf("Message-ID: <%s", mid);
+ if (strchr(mid, '@')==NULL) {
+ cprintf("@%s", snode);
+ }
+ cprintf(">%s", nl);
+
PerformUserHooks(luser, (-1L), EVT_OUTPUTMSG);
if (strlen(fuser) > 0) {
*
*/
long send_message(struct CtdlMessage *msg, /* pointer to buffer */
- int generate_id, /* generate 'I' field? */
FILE *save_a_copy) /* save a copy to disk? */
{
long newmsgid;
long retval;
- char msgidbuf[32];
+ char msgidbuf[256];
struct ser_ret smr;
/* Get a new message number */
newmsgid = get_new_message_number();
- sprintf(msgidbuf, "%ld", newmsgid);
+ sprintf(msgidbuf, "%ld@%s", newmsgid, config.c_fqdn);
- if (generate_id) {
+ /* Generate an ID if we don't have one already */
+ if (msg->cm_fields['I']==NULL) {
msg->cm_fields['I'] = strdoop(msgidbuf);
}
long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */
char *rec, /* Recipient (mail) */
char *force, /* force a particular room? */
- int supplied_mailtype, /* local or remote type */
- int generate_id) /* 1 = generate 'I' field */
+ int supplied_mailtype) /* local or remote type */
{
char aaa[100];
char hold_rm[ROOMNAMELEN];
/* Save it to disk */
lprintf(9, "Saving to disk\n");
- newmsgid = send_message(msg, generate_id, network_fp);
+ newmsgid = send_message(msg, network_fp);
if (network_fp != NULL) {
fclose(network_fp);
system("exec nohup ./netproc -i >/dev/null 2>&1 &");
imsg->cm_format_type = FMT_RFC822;
imsg->cm_fields['A'] = strdoop("Citadel");
imsg->cm_fields['M'] = instr;
- CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
+ CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL);
CtdlFreeMessage(imsg);
}
msg->cm_fields['R'] = strdoop(to);
msg->cm_fields['M'] = strdoop(text);
- CtdlSaveMsg(msg, "", room, MES_LOCAL, 1);
+ CtdlSaveMsg(msg, "", room, MES_LOCAL);
CtdlFreeMessage(msg);
syslog(LOG_NOTICE, text);
}
CC->quickroom.QRname, b, e, format_type, "");
if (msg != NULL)
- CtdlSaveMsg(msg, buf, (mtsflag ? AIDEROOM : ""), e, 1);
+ CtdlSaveMsg(msg, buf, (mtsflag ? AIDEROOM : ""), e);
CtdlFreeMessage(msg);
CC->fake_postname[0] = '\0';
return;
}
msg->cm_flags = CM_SKIP_HOOKS;
- if (valid_msg) CtdlSaveMsg(msg, recp, "", e, 0);
+ if (valid_msg) CtdlSaveMsg(msg, recp, "", e);
CtdlFreeMessage(msg);
phree(tempbuf);
}
CtdlDeleteMessages(roomname, 0L, content_type));
}
/* Now write the data */
- CtdlSaveMsg(msg, "", roomname, MES_LOCAL, 1);
+ CtdlSaveMsg(msg, "", roomname, MES_LOCAL);
CtdlFreeMessage(msg);
}
void cmd_msg3 (char *cmdbuf);
void cmd_msg4 (char *cmdbuf);
void cmd_opna (char *cmdbuf);
-long send_message (struct CtdlMessage *, int, FILE *);
+long send_message (struct CtdlMessage *, FILE *);
void loadtroom (void);
-long CtdlSaveMsg(struct CtdlMessage *, char *, char *, int, int);
+long CtdlSaveMsg(struct CtdlMessage *, char *, char *, int);
void quickie_message (char *, char *, char *, char *);
struct CtdlMessage *make_message (struct usersupp *, char *,
char *, int, int, int, char *);
};
+
+/*
+ * This structure is used to hold all of the fields of a message
+ * during conversion, processing, or whatever.
+ */
+struct minfo {
+ char A[512];
+ char B[512];
+ char C[512];
+ char D[512];
+ char E[512];
+ char G[512];
+ char H[512];
+ char I[512];
+ char N[512];
+ char O[512];
+ char P[512];
+ char R[512];
+ char S[512];
+ long T;
+ char U[512];
+ char Z[512];
+ char nexthop[512];
+ };
+
+
+
void attach_to_server(int argc, char **argv);
void serv_read(char *buf, int bytes);
void serv_write(char *buf, int nbytes);
if (b == 'T')
buffer->T = atol(bbb);
if (b == 'I')
- buffer->I = atol(bbb);
+ strcpy(buffer->I, bbb);
if (b == 'H')
strcpy(buffer->H, bbb);
if (b == 'B')
END:
- /* NOTE: we used to use the following two lines of code to assign
- * the timestamp as a message-ID if there was no message-ID already
- * in the message. We don't do this anymore because it screws up
- * the loopzapper.
- *
- if (buffer->I == 0L)
- buffer->I = buffer->T;
- */
}
void strmsgid(char *buf, struct minfo *msginfo) {
int i;
- sprintf(buf, "%ld@%s", msginfo->I, msginfo->N);
+ strcpy(buf, msginfo->I);
+ if (strchr(buf, '@') == NULL) {
+ strcat(buf, "@");
+ strcat(buf, msginfo->N);
+ }
+
for (i=0; i<strlen(buf); ++i) {
if (isspace(buf[i])) {
strcpy(&buf[i], &buf[i+1]);
int retval = 0;
/* We can't check for dups on a zero msgid, so just pass them through */
- if ((msginfo->I)==0L) {
+ if (strlen(msginfo->I)==0) {
return 0;
}
{
FILE *fp, *message, *testfp, *ls, *duplist;
static struct minfo minfo;
- struct recentmsg recentmsg;
char tname[128], aaa[1024], iname[256], sfilename[256], pfilename[256];
int a, b;
int FieldID;
/* process the individual mesage */
msgfind(tname, &minfo);
- strncpy(recentmsg.RMnodename, minfo.N, 9);
- recentmsg.RMnodename[9] = 0;
- recentmsg.RMnum = minfo.I;
syslog(LOG_NOTICE, "#%ld fm <%s> in <%s> @ <%s>",
minfo.I, minfo.A, minfo.O, minfo.N);
if (strlen(minfo.R) > 0) {
/* Check the use table; reject message if it's been here before */
if (already_received(use_table, &minfo)) {
syslog(LOG_NOTICE, "rejected duplicate message");
- fprintf(duplist, "#%ld fm <%s> in <%s> @ <%s>\n",
+ fprintf(duplist, "#<%s> fm <%s> in <%s> @ <%s>\n",
minfo.I, minfo.A, minfo.O, minfo.N);
}
phonenum US6093461224
gdom NJ
humannode JACS
-lastcontact 952138912 Fri Mar 3 22:01:52 2000
+lastcontact 952634224 Thu Mar 9 15:37:04 2000
dogpound2
use uncnsrd
phonenum netproc[4026]: Adding non-neighbor system <sbn> to map
gdom or system <sbn> to map
humannode Dog Pound BBS II
-lastcontact 952349824 Mon Mar 6 08:37:04 2000
+lastcontact 952724225 Fri Mar 10 16:37:05 2000
sbn
use uncnsrd
phonenum US (609) 953 8159
gdom NJ
humannode The Amiga Zone
-lastcontact 952138913 Fri Mar 3 22:01:53 2000
+lastcontact 952720625 Fri Mar 10 15:37:05 2000
cbbs
use uncnsrd
phonenum netproc[4026]: Adding non-neighbor system <tesseract> to map
gdom or system <tesseract> to map
humannode PixelBBS
-lastcontact 952573025 Wed Mar 8 22:37:05 2000
+lastcontact 952706223 Fri Mar 10 11:37:03 2000
tesseract
bin Mail
phonenum US 800 555 1212
humannode Tesseract Project
-lastcontact 952573026 Wed Mar 8 22:37:06 2000
+lastcontact 952724226 Fri Mar 10 16:37:06 2000
tux
bin Mail
bin Mail
phonenum US 914 244 3252
humannode Uncensored
-lastcontact 952565824 Wed Mar 8 20:37:04 2000
+lastcontact 952720625 Fri Mar 10 15:37:05 2000
internet
uum %s
humannode Internet Gateway
-lastcontact 952573026 Wed Mar 8 22:37:06 2000
+lastcontact 952724225 Fri Mar 10 16:37:05 2000
bccs
use uncnsrd
phonenum netproc[7145]: Adding non-neighbor system <internet> to map
gdom or system <internet> to map
humannode BCCS
-lastcontact 952569423 Wed Mar 8 21:37:03 2000
+lastcontact 952648629 Thu Mar 9 19:37:09 2000
ctestsys
use uncnsrd
phonenum US 612 470 9635
gdom MN
humannode C-86 Test System
-lastcontact 952375033 Mon Mar 6 15:37:13 2000
+lastcontact 952673825 Fri Mar 10 02:37:05 2000
msgid = CtdlSaveMsg(msg,
"",
SMTP_SPOOLOUT_ROOM,
- MES_LOCAL,
- 1);
+ MES_LOCAL);
++successful_saves;
instr = mallok(1024);
imsg->cm_anon_type = MES_NORMAL;
imsg->cm_format_type = FMT_RFC822;
imsg->cm_fields['M'] = instr;
- CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
+ CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL);
CtdlFreeMessage(imsg);
}
else {
bounce_msgid = CtdlSaveMsg(bmsg,
bounceto,
- "", mes_type, 1);
+ "", mes_type);
}
/* Otherwise, go to the Aide> room */
lprintf(9, "bounce to room?\n");
if (bounce_msgid < 0L) bounce_msgid = CtdlSaveMsg(bmsg,
"", AIDEROOM,
- MES_LOCAL, 1);
+ MES_LOCAL);
}
CtdlFreeMessage(bmsg);
"Content-type: %s\n\n%s\nattempted|%ld\n",
SPOOLMIME, instr, time(NULL) );
phree(instr);
- CtdlSaveMsg(msg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
+ CtdlSaveMsg(msg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL);
CtdlFreeMessage(msg);
}
/*
* Go ahead and run the queue
*/
- lprintf(5, "SMTP: processing outbound queue\n");
+ lprintf(7, "SMTP: processing outbound queue\n");
if (getroom(&CC->quickroom, SMTP_SPOOLOUT_ROOM) != 0) {
lprintf(3, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
}
CtdlForEachMessage(MSGS_ALL, 0L, SPOOLMIME, NULL, smtp_do_procmsg);
- lprintf(5, "SMTP: queue run completed\n");
+ lprintf(7, "SMTP: queue run completed\n");
doing_queue = 0;
}
msg->cm_fields['S'] = strdoop("CANCEL");
- CtdlSaveMsg(msg, "", ADDRESS_BOOK_ROOM, MES_LOCAL, 1);
+ CtdlSaveMsg(msg, "", ADDRESS_BOOK_ROOM, MES_LOCAL);
CtdlFreeMessage(msg);
/* Start a netproc run in the background, so the "purge" message