Commit 1105fad7 authored by rswindell's avatar rswindell
Browse files

Created function to generate RFC822 message IDs: gen_msgid().

parent e4425969
......@@ -781,6 +781,7 @@ extern "C" {
DLLEXPORT size_t DLLCALL strip_invalid_attr(char *str);
DLLEXPORT ushort DLLCALL subject_crc(char *subj);
DLLEXPORT char * DLLCALL ftn_msgid(sub_t* sub, smbmsg_t* msg);
DLLEXPORT char * DLLCALL gen_msgid(scfg_t* cfg, uint subnum, smbmsg_t* msg);
/* date_str.c */
DLLEXPORT char * DLLCALL zonestr(short zone);
......
......@@ -336,7 +336,7 @@ static ulong msgid_serialno(smbmsg_t* msg)
}
/****************************************************************************/
/* Returns a FidoNet FTS-9 compliant message-ID */
/* Returns a FidoNet (FTS-9) message-ID */
/****************************************************************************/
char* DLLCALL ftn_msgid(sub_t *sub, smbmsg_t* msg)
{
......@@ -354,6 +354,30 @@ char* DLLCALL ftn_msgid(sub_t *sub, smbmsg_t* msg)
return(msgid);
}
/****************************************************************************/
/* Return a general purpose (RFC-822) message-ID */
/****************************************************************************/
char* DLLCALL gen_msgid(scfg_t* cfg, uint subnum, smbmsg_t* msg)
{
static char msgid[256];
if(subnum>=cfg->total_subs)
snprintf(msgid,sizeof(msgid)
,"<%08lX.%lu@%s>"
,msg->idx.time
,msg->idx.number
,cfg->sys_inetaddr);
else
snprintf(msgid,sizeof(msgid)
,"<%08lX.%lu.%s@%s>"
,msg->idx.time
,msg->idx.number
,cfg->sub[subnum]->code
,cfg->sys_inetaddr);
return(msgid);
}
/****************************************************************************/
/* Returns string for 2 digit hex+ numbers up to 575 */
/****************************************************************************/
......
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