home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Src / submit / gen_probedr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  2.0 KB  |  103 lines

  1. /* gen_probedr.c: generate DRs or NDRs for probes */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Src/submit/RCS/gen_probedr.c,v 6.0 1991/12/18 20:28:02 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Src/submit/RCS/gen_probedr.c,v 6.0 1991/12/18 20:28:02 jpo Rel $
  9.  *
  10.  * $Log: gen_probedr.c,v $
  11.  * Revision 6.0  1991/12/18  20:28:02  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include "head.h"
  19. #include "q.h"
  20. #include "dr.h"
  21.  
  22. extern char             msg_fullpath[];
  23.  
  24. extern void         gen_ndr (), err_abrt();
  25. /* -- local routines -- */
  26. void            gen_probedr();
  27.  
  28.  
  29.  
  30.  
  31. /*----------------------  Begin  Routines  -------------------------------- */
  32.  
  33.  
  34.  
  35.  
  36. /* -- Generate NDRs or DRs for submitted probe -- */
  37.  
  38.  
  39. void gen_probedr(qp)
  40. Q_struct *qp;
  41. {
  42.     register ADDR           *ad,
  43.                 *sender;
  44.     int            found = FALSE;
  45.  
  46.     PP_TRACE (("submit/gen_probedr()"));
  47.  
  48.     /* -- clear reformatting for sender -- */
  49.  
  50.     for (ad = qp->Oaddress; ad != NULLADDR; ad = ad->ad_next) {
  51.         if (ad -> ad_fmtchan) { 
  52.             list_rchan_free (ad -> ad_fmtchan);
  53.             ad -> ad_fmtchan = NULLIST_RCHAN;
  54.         }
  55.     }
  56.  
  57.     /* -- First generate Non Delivery Notifications -- */
  58.  
  59.     for (ad = qp->Raddress; ad != NULLADDR; ad = ad->ad_next) {
  60.         if (ad->ad_status != AD_STAT_PEND &&
  61.             ad->ad_status != AD_STAT_DRREQUIRED)
  62.             continue;
  63.  
  64.         if (rp_isbad (ad->ad_parse_stat) ||
  65.             ad -> ad_status == AD_STAT_DRREQUIRED)
  66.             found = TRUE;
  67.  
  68.         if (ad -> ad_fmtchan) { 
  69.             list_rchan_free (ad -> ad_fmtchan);
  70.             ad -> ad_fmtchan = NULLIST_RCHAN;
  71.         }
  72.     }
  73.  
  74.  
  75.     if (found )
  76.         gen_ndr(qp);
  77.  
  78.  
  79.     /* -- Secondly Generate Delivery Notifications -- */
  80.  
  81.     sender = qp->Oaddress;
  82.     if (qp -> queuetime == NULLUTC)
  83.         qp -> queuetime = utcnow();
  84.  
  85.     for (ad=qp->Raddress, found=FALSE; ad != NULLADDR; ad = ad->ad_next) {
  86.         if (ad->ad_status != AD_STAT_PEND) 
  87.             continue;
  88.         if (ad->ad_outchan->li_chan->ch_probe)
  89.             continue;
  90.  
  91.         found = TRUE;
  92.         ad->ad_type = sender->ad_type;
  93.         ad->ad_status = AD_STAT_DRREQUIRED;
  94.         ad -> ad_reason = DRR_NO_REASON;
  95.     }
  96.         
  97.     if (found)
  98.         if (wr_q2drfile (qp, msg_fullpath, 0) != RP_OK)
  99.             err_abrt (RP_AGN, "Error writing DR");
  100.  
  101.     return;
  102. }
  103.