DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T o

⟦21515c0ad⟧ TextFile

    Length: 2371 (0x943)
    Types: TextFile
    Names: »outbound.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/doc/manual/volume2/outbound.c« 

TextFile

main (argc, argv)
int     argc;
char    **argv;
{
	sys_init (argv[0]);   /* init the channel - and find out who we are */

	dirinit();              /* get to the right directory */
#ifdef PP_DEBUG
	if (argc > 1 && strcmp (argv[1], "debug") == 0)
		debug_channel_control (argc, argv, chaninit, process, endproc);
	else
#endif
		channel_control (argc, argv, chaninit, process, endproc);
	exit (0);
}

static int chaninit (arg)
struct type_Qmgr_Channel *arg;
{
	char    *p = qb2str (arg);

	if ((mychan = ch_nm2struct (p)) == (CHAN *)0)
		err_abrt (RP_PARM, "Channel '%s' not known", p);
	exam_init (mychan);
	free (p);
	return OK;
}

static int endproc ()
{
	if (cur_host)
		exam_close (OK);
}

static struct type_Qmgr_DeliveryStatus *process (arg)
struct type_Qmgr_ProcMsg *arg;
{
	struct prm_vars prm;
	struct type_Qmgr_UserList *up;
	Q_struct        Qstruct, *qp = &Qstruct;
	int     retval;
	ADDR    *ap,
		*ad_sendr = NULLADDR,
		*ad_recip = NULLADDR,
		*alp,
		*ad_list = NULLADDR;
	int     ad_count;

	if (this_msg) free (this_msg);

	this_msg = qb2str (arg -> qid);

	PP_TRACE (("process msg %s", this_msg));

	bzero ((char *)&prm, sizeof prm);
	bzero ((char *)qp, sizeof *qp);

	(void) delivery_init (arg -> users);

	retval = rd_msg (this_msg, &prm, qp, &ad_sendr, &ad_recip, &ad_count);

	if (rp_isbad (retval)) {
		PP_LOG (LLOG_EXCEPTIONS, ("rd_msg err: %s", this_msg));
		return delivery_setall (int_Qmgr_status_messageFailure);
	}

	sender = ad_sendr -> ad_r822adr;


	for (ap = ad_recip; ap; ap = ap -> ad_next) {
		for (up = arg ->users; up; up = up -> next) {
			if (up -> RecipientId -> parm != ap -> ad_no)
				continue;

			if (chan_acheck (ap, mychan,
					 ad_list == NULL, &cur_mta) == NOTOK)
				continue;
		}
		if (up == NULL)
			continue;

		if (ad_list == NULLADDR)
			ad_list = alp = (ADDR *) calloc (1, sizeof *alp);
		else {
			alp -> ad_next = (ADDR *) calloc (1, sizeof *alp);
			alp = alp -> ad_next;
		}
		*alp = *ap;
		alp -> ad_next = NULLADDR;
	}

	if (ad_list == NULLADDR) {
		PP_LOG (LLOG_EXCEPTIONS, ("No recipients in user list"));
		rd_end ();
		return deliverystate;
	}

	deliver (ad_list, qp); /* do what is required */

	rd_end();

	return deliverystate;
}


static void dirinit()       /* Change into pp queue space */
{
	if (chdir (quedfldir) < 0)
		err_abrt (RP_LIO, "Unable to change directory to '%s'",
						quedfldir);
}