while (*ptr!=(char *)0) {
FILE *qfile;
- (void) rou_alert(0,"%s fame=<%s>",OPEP,*ptr);
+ (void) rou_alert(5,"%s fame=<%s>",OPEP,*ptr);
if ((qfile=eml_openqfile(*ptr,(const char *)0))!=(FILE *)0) {
trans=eml_scanqfile(trans,qfile);
(void) eml_closeqfile(qfile);
*/
/********************************************************/
/* */
+/* Procedure to send the whole email transaction */
+/* */
+/********************************************************/
+static void sending_email(char *domain,char *sessid,TRATYP **tra)
+
+{
+#define OPEP "lvleml.c:sending_email,"
+
+time_t isnow;
+MXTYP **mxs;
+
+isnow=time((time_t *)0);
+mxs=dns_getmx(domain);
+while (*tra!=(TRATYP *)0) {
+ if (((*tra)->date+(*tra)->delay)<=isnow) {
+ int phase;
+ _Bool proceed;
+
+ phase=0;
+ proceed=true;
+ while (proceed==true) {
+ switch (phase) {
+ case 0 : //is connection open?
+ break;
+ case 1 : //do we need to reset connection
+ break;
+ case 2 : //listing recipient
+ switch ((*tra)->code) {
+ case 'R' : //local email (MX is local)
+ (void) rou_alert(0,"%s JMPDBG sending to recipient=<%s>",
+ OPEP,(*tra)->rcptto);
+ break;
+ default : //Unexpected remote? email??
+ (void) rou_alert(0,"%s Directive is not! remote email (Bug?)",OPEP);
+ (void) rou_alert(0,"%s TRA=<%cs %lu %04u %s %s %s",OPEP,
+ (*tra)->code,
+ (*tra)->date,
+ (*tra)->delay,
+ (*tra)->sessid,
+ (*tra)->mailfrom,
+ (*tra)->rcptto);
+ break;
+ }
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+ }
+ (void) eml_add_delay(isnow,*tra);
+ tra++;
+ }
+mxs=dns_freemxlist(mxs);
+#undef OPEP
+}
+/*
+^L
+*/
+/********************************************************/
+/* */
/* Procedure to proceed with peer exchange */
/* 5 return values: */
/* 1 exiting via "quit" */
{
#define OPEP "lvleml.c:eml_remote_email,"
-(void) rou_alert(0,"%s JMPDBG foreground='%d'",OPEP,foreground);
+char *domain;
+char *sessid;
+int phase;
+_Bool proceed;
+
+domain=(char *)0;
+sessid=(char *)0;
+phase=0;
+proceed=true;
+while (proceed==true) {
+ switch (phase) {
+ case 0 : //Check if we have tra
+ if (tra==(TRATYP **)0) {
+ (void) rou_alert(0,"%s Transaction pointer is NULL (Bug?)",OPEP);
+ phase=999;
+ }
+ break;
+ case 1 : //detecting remote domain
+ if ((domain=strrchr((*tra)->rcptto,'@'))!=(char *)0)
+ domain++;
+ if (domain==(char *)0) {
+ (void) rou_alert(0,"%s Recipient address <%s> without domain? (Bug?)",
+ OPEP,(*tra)->rcptto);
+ phase=999;
+ }
+ break;
+ case 2 : //checking if we have a session ID
+ sessid=(*tra)->sessid;
+ if (sessid==(char *)0) {
+ (void) rou_alert(0,"%s Session ID is NULL (Bug?)",OPEP);
+ phase=999;
+ }
+ break;
+ case 3 : //sending the whole transaction to remote server
+ (void) sending_email(domain,sessid,tra);
+ break;
+ default : //SAFE Guard
+ proceed=false;
+ break;
+ }
+ phase++;
+ }
+
#undef OPEP
}
continue; //extension not found
if ((strlen(ptr)!=taille)&&(*(ptr-1)!='.'))
continue; //Not the right extension
- (void) rou_alert(0,"%s JMPDBG got <%s>",OPEP,data->d_name);
+ (void) rou_alert(6,"%s got <%s>",OPEP,data->d_name);
dnames=(char **)rou_addlist((void **)dnames,(void *)strdup(data->d_name));
}
break;