|
|
|
@ -103,6 +103,10 @@ char *emsi_createdat(s_emsi *emsi)
|
|
|
|
|
char *tmp = NULL;
|
|
|
|
|
char buf[100];
|
|
|
|
|
char abuf[BF_MAXADDRSTR+1];
|
|
|
|
|
char *p_order = NULL;
|
|
|
|
|
char *ord = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tmp = (char *)xstrcpy("**EMSI_DAT0000");
|
|
|
|
|
|
|
|
|
@ -179,14 +183,79 @@ char *emsi_createdat(s_emsi *emsi)
|
|
|
|
|
tmp = add_char(tmp, '}');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* compatibility_codes */
|
|
|
|
|
/* compatibility_codes (EMSI behavior as FTS-0088) */
|
|
|
|
|
tmp = add_char(tmp, '{');
|
|
|
|
|
if( emsi->compcodes.NCP ) tmp = add_str(tmp, "NCP,");
|
|
|
|
|
if( emsi->compcodes.ZMO ) tmp = add_str(tmp, "ZMO,");
|
|
|
|
|
if( emsi->compcodes.ZAP ) tmp = add_str(tmp, "ZAP,");
|
|
|
|
|
if( emsi->compcodes.DZA ) tmp = add_str(tmp, "DZA,");
|
|
|
|
|
if( emsi->compcodes.JAN ) tmp = add_str(tmp, "JAN,");
|
|
|
|
|
if( emsi->compcodes.HYD ) tmp = add_str(tmp, "HYD,");
|
|
|
|
|
|
|
|
|
|
p_order = conf_string(cf_proto_order);
|
|
|
|
|
|
|
|
|
|
if ( !p_order ) {
|
|
|
|
|
if( emsi->compcodes.HYD ) tmp = add_str(tmp, "HYD,");
|
|
|
|
|
if( emsi->compcodes.JAN ) tmp = add_str(tmp, "JAN,");
|
|
|
|
|
if( emsi->compcodes.DZA ) tmp = add_str(tmp, "DZA,");
|
|
|
|
|
if( emsi->compcodes.ZAP ) tmp = add_str(tmp, "ZAP,");
|
|
|
|
|
if( emsi->compcodes.ZMO ) tmp = add_str(tmp, "ZMO,");
|
|
|
|
|
if( emsi->compcodes.TZA ) tmp = add_str(tmp, "TZA,");
|
|
|
|
|
if( emsi->compcodes.SLK ) tmp = add_str(tmp, "SLK,");
|
|
|
|
|
if( emsi->compcodes.KER ) tmp = add_str(tmp, "KER,");
|
|
|
|
|
if( emsi->compcodes.NCP ) tmp = add_str(tmp, "NCP,");
|
|
|
|
|
} else {
|
|
|
|
|
ord = xmalloc(4);
|
|
|
|
|
DEB((D_HSHAKE,"Protocol order found: %s", p_order));
|
|
|
|
|
ord = strncpy(ord, p_order,3);
|
|
|
|
|
ord[3] = '\0';
|
|
|
|
|
DEB((D_HSHAKE,"Protocol order chunk: %s", ord));
|
|
|
|
|
if ( ord == NULL )
|
|
|
|
|
DEB((D_HSHAKE,"EMSI create order error"));
|
|
|
|
|
if ( !strcmp(ord,"HYD") )
|
|
|
|
|
if ( emsi->compcodes.HYD) tmp = add_str(tmp, "HYD,");
|
|
|
|
|
if ( !strcmp(ord,"JAN") )
|
|
|
|
|
if ( emsi->compcodes.JAN) tmp = add_str(tmp, "JAN,");
|
|
|
|
|
if ( !strcmp(ord,"DZA") )
|
|
|
|
|
if ( emsi->compcodes.DZA) tmp = add_str(tmp, "DZA,");
|
|
|
|
|
if ( !strcmp(ord,"ZAP") )
|
|
|
|
|
if ( emsi->compcodes.ZAP) tmp = add_str(tmp, "ZAP,");
|
|
|
|
|
if ( !strcmp(ord,"ZMO") )
|
|
|
|
|
if ( emsi->compcodes.ZMO) tmp = add_str(tmp, "ZMO,");
|
|
|
|
|
if ( !strcmp(ord,"TZA") )
|
|
|
|
|
if ( emsi->compcodes.TZA) tmp = add_str(tmp, "TZA,");
|
|
|
|
|
if ( !strcmp(ord,"SLK") )
|
|
|
|
|
if ( emsi->compcodes.SLK) tmp = add_str(tmp, "SLK,");
|
|
|
|
|
if ( !strcmp(ord,"KER") )
|
|
|
|
|
if ( emsi->compcodes.KER) tmp = add_str(tmp, "KER,");
|
|
|
|
|
if ( !strcmp(ord,"NCP") )
|
|
|
|
|
if ( emsi->compcodes.NCP) tmp = add_str(tmp, "NCP,");
|
|
|
|
|
p_order = strchr(p_order, ',');
|
|
|
|
|
if ( p_order ) p_order = p_order+1; /* skip ',' */
|
|
|
|
|
while ( p_order ) {
|
|
|
|
|
ord = strncpy(ord, p_order,3);
|
|
|
|
|
ord[3] = '\0';
|
|
|
|
|
DEB((D_HSHAKE,"Protocol order chunk: %s", ord));
|
|
|
|
|
if ( ord == NULL )
|
|
|
|
|
DEB((D_HSHAKE,"EMSI create order error"));
|
|
|
|
|
if ( !strcmp(ord,"HYD") )
|
|
|
|
|
if ( emsi->compcodes.HYD) tmp = add_str(tmp, "HYD,");
|
|
|
|
|
if ( !strcmp(ord,"JAN") )
|
|
|
|
|
if ( emsi->compcodes.JAN) tmp = add_str(tmp, "JAN,");
|
|
|
|
|
if ( !strcmp(ord,"DZA") )
|
|
|
|
|
if ( emsi->compcodes.DZA) tmp = add_str(tmp, "DZA,");
|
|
|
|
|
if ( !strcmp(ord,"ZAP") )
|
|
|
|
|
if ( emsi->compcodes.ZAP) tmp = add_str(tmp, "ZAP,");
|
|
|
|
|
if ( !strcmp(ord,"ZMO") )
|
|
|
|
|
if ( emsi->compcodes.ZMO) tmp = add_str(tmp, "ZMO,");
|
|
|
|
|
if ( !strcmp(ord,"TZA") )
|
|
|
|
|
if ( emsi->compcodes.TZA) tmp = add_str(tmp, "TZA,");
|
|
|
|
|
if ( !strcmp(ord,"SLK") )
|
|
|
|
|
if ( emsi->compcodes.SLK) tmp = add_str(tmp, "SLK,");
|
|
|
|
|
if ( !strcmp(ord,"KER") )
|
|
|
|
|
if ( emsi->compcodes.KER) tmp = add_str(tmp, "KER,");
|
|
|
|
|
if ( !strcmp(ord,"NCP") )
|
|
|
|
|
if ( emsi->compcodes.NCP) tmp = add_str(tmp, "NCP,");
|
|
|
|
|
p_order = strchr(p_order, ',');
|
|
|
|
|
if ( p_order ) p_order = p_order+1; /* skip ',' */
|
|
|
|
|
}
|
|
|
|
|
free(ord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( emsi->compcodes.FRQ ) tmp = add_str(tmp, "FRQ,");
|
|
|
|
|
if( emsi->compcodes.NRQ ) tmp = add_str(tmp, "NRQ,");
|
|
|
|
|
if( emsi->compcodes.ARC ) tmp = add_str(tmp, "ARC,");
|
|
|
|
@ -325,10 +394,15 @@ char *emsi_createdat(s_emsi *emsi)
|
|
|
|
|
|
|
|
|
|
tmp = add_char(tmp, '{');
|
|
|
|
|
tmp = add_char(tmp, '[');
|
|
|
|
|
sprintf(buf, "+%04d", emsi->tzutc);
|
|
|
|
|
tmp = add_str(tmp, buf);
|
|
|
|
|
/* BUGGY */
|
|
|
|
|
// sprintf(buf, "+%04d", emsi->tzutc);
|
|
|
|
|
ord = xmalloc(6);
|
|
|
|
|
ord = xstrcpy(time_string_gmtoffset(ord));
|
|
|
|
|
ord[5] = '\0';
|
|
|
|
|
tmp = add_str(tmp, ord);
|
|
|
|
|
tmp = add_char(tmp, ']');
|
|
|
|
|
tmp = add_char(tmp, '}');
|
|
|
|
|
free(ord);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* {XDATE} indentifier.. What's the fucking invention :-/
|
|
|
|
@ -450,6 +524,8 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
char *tmp, *p, *q, *n;
|
|
|
|
|
unsigned int tzh, tzm,tzn ;
|
|
|
|
|
char *tzc, *otmp;
|
|
|
|
|
|
|
|
|
|
while( (tmp=get_field(&emsi_dat, '{', '}')) != NULL )
|
|
|
|
|
{
|
|
|
|
@ -525,13 +601,64 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
|
|
|
|
/* compatibility codes */
|
|
|
|
|
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
|
|
|
|
DEB((D_HSHAKE, "parse_emsidat: compatibility codes: %s", p));
|
|
|
|
|
emsi->proto_order[0] = '\0';
|
|
|
|
|
|
|
|
|
|
for( p = strtok(p, ","); p; p=strtok(NULL, ",") )
|
|
|
|
|
{
|
|
|
|
|
if( !strcmp(p, "ZMO") ) emsi->compcodes.ZMO = 1;
|
|
|
|
|
/* if( !strcmp(p, "ZMO") ) emsi->compcodes.ZMO = 1;
|
|
|
|
|
else if( !strcmp(p, "ZAP") ) emsi->compcodes.ZAP = 1;
|
|
|
|
|
else if( !strcmp(p, "DZA") ) emsi->compcodes.DZA = 1;
|
|
|
|
|
else if( !strcmp(p, "JAN") ) emsi->compcodes.JAN = 1;
|
|
|
|
|
else if( !strcmp(p, "HYD") ) emsi->compcodes.HYD = 1;
|
|
|
|
|
*/
|
|
|
|
|
if ( !strcmp(p, "ZMO") ) {
|
|
|
|
|
emsi->compcodes.ZMO = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"ZMO,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp(p, "ZAP") ) {
|
|
|
|
|
emsi->compcodes.ZAP = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"ZAP,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp(p, "DZA") ) {
|
|
|
|
|
emsi->compcodes.DZA = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"DZA,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp(p, "JAN") ) {
|
|
|
|
|
emsi->compcodes.JAN = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"JAN,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp(p, "HYD") ) {
|
|
|
|
|
emsi->compcodes.HYD = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"HYD,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp(p, "KER") ) {
|
|
|
|
|
emsi->compcodes.KER = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"KER,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp(p, "TZA") ) {
|
|
|
|
|
emsi->compcodes.TZA = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"TZA,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if ( !strcmp(p, "SLK") ) {
|
|
|
|
|
emsi->compcodes.SLK = 1;
|
|
|
|
|
otmp = strcat(emsi->proto_order,"SLK,");
|
|
|
|
|
strcpy(emsi->proto_order, otmp);
|
|
|
|
|
DEB((D_HSHAKE,"Parse_emsidat: ordered proto added: %s", otmp));
|
|
|
|
|
}
|
|
|
|
|
else if( !strcmp(p, "NCP") ) emsi->compcodes.NCP = 1;
|
|
|
|
|
else if( !strcmp(p, "NRQ") ) emsi->compcodes.NRQ = 1;
|
|
|
|
|
else if( !strcmp(p, "ARC") ) emsi->compcodes.ARC = 1;
|
|
|
|
@ -542,6 +669,9 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
|
|
|
|
else if( !strcmp(p, "BBS") ) emsi->compcodes.BBS = 1;
|
|
|
|
|
else if( !strcmp(p, "HFR") ) emsi->compcodes.HFR = 1;
|
|
|
|
|
}
|
|
|
|
|
/* Delete last comma from order list */
|
|
|
|
|
emsi->proto_order[strlen(emsi->proto_order)-1] = '\0';
|
|
|
|
|
DEB((D_HSHAKE,"Ordered compcodes: %s",emsi->proto_order));
|
|
|
|
|
|
|
|
|
|
/* mailer information */
|
|
|
|
|
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
|
|
|
@ -646,13 +776,31 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi)
|
|
|
|
|
}
|
|
|
|
|
else if( strcmp(tmp, "TZUTC") == 0 )
|
|
|
|
|
{
|
|
|
|
|
emsi->have_tzutc = 1;
|
|
|
|
|
|
|
|
|
|
if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1);
|
|
|
|
|
if( (p=get_field(&p, '[', ']')) == NULL ) return(1);
|
|
|
|
|
/* Parse EMSI TZUTC in fmt (+|-)HHMM */
|
|
|
|
|
if( *p ) {
|
|
|
|
|
tzc = malloc(2);
|
|
|
|
|
DEB((D_HSHAKE, "Got TZUTC=%s for parsing", p));
|
|
|
|
|
tzn = sscanf( p, "%1c%02u%02u", tzc, &tzh, &tzm);
|
|
|
|
|
tzc[1] = '\0';
|
|
|
|
|
if ( tzn == 3) {
|
|
|
|
|
DEB((D_HSHAKE, "Got TZC=%s , H=%u, M=%u", tzc, tzh,tzm));
|
|
|
|
|
emsi->have_tzutc = 1;
|
|
|
|
|
if ( strcmp(tzc, "-") == 0 ) {
|
|
|
|
|
emsi->tzutc = -(tzh*60 + tzm);
|
|
|
|
|
} else {
|
|
|
|
|
emsi->tzutc = tzh*60 + tzm;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
DEB((D_HSHAKE,"TZUTC value not parsed!"));
|
|
|
|
|
}
|
|
|
|
|
free(tzc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DEB((D_HSHAKE, "Step - no known EMSI-part - got %s", tmp));
|
|
|
|
|
strnxcat(emsi->addons, "{", sizeof(emsi->addons));
|
|
|
|
|
strnxcat(emsi->addons, tmp, sizeof(emsi->addons));
|
|
|
|
|
strnxcat(emsi->addons, "}", sizeof(emsi->addons));
|
|
|
|
|