mail_a.c

final_realms_fluffos_v1/lib/net/old/udp/mail_a.c · 1.7 KB

From the archive final_realms_fluffos_v1.zip

Download the archive   « Back to the archive contents

/*
//
//  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 */

Site Stats

Snippets: 1791
Codebases: 571