Commit 082c1b5e authored by rswindell's avatar rswindell
Browse files

Generate an RFC822 (generic) Message-ID header field when importing msgs

(using -i). These aren't quite as good as the IDs we can generate when we
have access to the BBS configuration (scfg_t), but it's decently unique and
identifiable.
parent 71cf01c7
......@@ -165,6 +165,32 @@ ulong lf_expand(uchar* inbuf, uchar* outbuf)
return(j);
}
char* gen_msgid(smb_t* smb, smbmsg_t* msg, char* msgid, size_t maxlen)
{
char* host = getenv(
#if defined(_WIN32)
"COMPUTERNAME"
#else
"HOSTNAME"
#endif
);
if(host == NULL)
host = getenv(
#if defined(_WIN32)
"USERNAME"
#else
"USER"
#endif
);
safe_snprintf(msgid, maxlen
,"<%08lX.%lu.%s@%s>"
,msg->hdr.when_imported.time
,smb->status.last_msg + 1
,getfname(smb->file)
,host);
return msgid;
}
/****************************************************************************/
/* Adds a new message to the message base */
/****************************************************************************/
......@@ -325,6 +351,8 @@ void postmsg(char type, char* to, char* to_number, char* to_address,
bail(1);
}
smb_hfield_str(&msg, RFC822MSGID, gen_msgid(&smb, &msg, str, sizeof(str)-1));
if(mode&NOCRC || smb.status.max_crcs==0) /* no CRC checking means no body text dupe checking */
dupechk_hashes&=~(1<<SMB_HASH_SOURCE_BODY);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment