/*
//
// File : mail_a.c
// Author : Inspiral@Tabor
// Created : 93-12-23
// Purpose : Part of the DNS mail system.
//
// Revision:
// - Modified by Turrican to be used with DW mudlib.
// Date : 17th of Januari, 1995
// - Cleaned up a bit by Turrican, 14-6-95
//
*/
#undef DEBUG
#ifdef DEBUG
#define WHO find_player("turrican")
#define TELL(x) if (WHO) tell_object(WHO, x + "\n")
#else
#define TELL(x)
#endif
#include <udp.h>
/*
// We get here when we get affirmations from muds we are sending
// mail packets to.
*/
void incoming_request(mapping info) {
int flag;
flag = 0;
if (!info["NAME"] || !info["PORTUDP"])
return;
if (info["ENDMSG"]) {
/*
// We've received an acknowledgement of an ENDMSG..meaning, they
// affirm that they got the last part of a message we sent them.
// We pop it off the stack.
*/
TELL ("MAILA: "+info["NAME"]);
if (!NETMAIL_D->pop_mud(info["NAME"])) {
/*
// Hmm..there apparently was nothing on the stack, yet we got
// affirmation of an ENDMSG...log this.
*/
log_file("mail_a", "unexpected mail_a from " + info["NAME"] + "\n");
return;
}
TELL("MAILA: Popped " + info["NAME"] + ".");
flag = 2;
}
else {
if (info["RESEND"]) {
/*
// They want us to resend the current message, because either
// too much time has passed since the last received packet, or
// some fields got messed up along the way.
*/
TELL("MAILA: Got RESEND.");
flag = 1;
}
}
/*
// Let mail_q know that we are ready to either send a new message,
// or resend the current one.
*/
(UDP_PATH+UDP_MAIL_Q)->check_for_mail(info["NAME"], flag);
}
/* EOF */