/
LIB3/
LIB3/D/ADMIN/
LIB3/D/ADMIN/OBJ/
LIB3/D/ADMIN/ROOM/W/
LIB3/D/HOME/
LIB3/D/HOME/CITY/ARENA/
LIB3/D/HOME/CITY/ITEMS/
LIB3/D/HOME/CITY/POSTOFFI/
LIB3/DOC/
LIB3/GLOBAL/SPECIAL/
LIB3/GLOBAL/VIRTUAL/
LIB3/NET/
LIB3/NET/CONFIG/
LIB3/NET/DAEMON/CHARS/
LIB3/NET/GOPHER/
LIB3/NET/INHERIT/
LIB3/NET/OBJ/
LIB3/NET/SAVE/
LIB3/NET/VIRTUAL/
LIB3/OBJ/B_DAY/
LIB3/OBJ/HANDLERS/TERM_TYP/
LIB3/PLAYERS/B/
LIB3/PLAYERS/N/
LIB3/ROOM/
LIB3/SAVE/
LIB3/SAVE/BOARDS/
LIB3/SAVE/ENVIRON/
LIB3/SAVE/POST/
LIB3/STD/COMMANDS/SHADOWS/
LIB3/STD/CREATOR/
LIB3/STD/DOM/
LIB3/STD/EFFECTS/
LIB3/STD/EFFECTS/HEALING/
LIB3/STD/EFFECTS/OTHER/
LIB3/STD/EFFECTS/POISONS/
LIB3/STD/ENVIRON/
LIB3/STD/GUILDS/
LIB3/STD/LIQUIDS/
LIB3/STD/ROOM/
LIB3/STD/TRIGGER/SHADOW/
LIB3/W/
LIB3/W/BANNOR/
LIB3/W/NEWSTYLE/
#include "udp.h"
#include "board.h"
void    send_message( mapping info );

/*
 * Intermud buliten boards....
 */

int     call_in_progress;
mapping getting_board;

void    create()
{
    getting_board = ([ ]);
    seteuid( getuid() );
}				/* create() */

void    incoming_message( mapping info )
{
    mapping minfo;
    int     i;
    string  key;

    if( !info[ "NAME" ] || !info[ "PORTUDP" ] )
	return;
    minfo = NAMESERVER_CD->query_mud_info( info[ "NAME" ] );
    if( minfo[ "HOSTADDRESS" ] != info[ "HOSTADDRESS" ] )
    {
	/* Forged. */
	return;
    }
    key = info[ "WIZNAME" ] + "@" + info[ "NAME" ];
    if( !getting_board[ key ] )
    {
	getting_board[ key ] = info;
	getting_board[ key ][ "TIME" ] = time();
	if( !call_in_progress )
	    call_out( "time_out", 5 * 60 );
	call_in_progress = 1;
    }
    else
	getting_board[ key ][ "NOTE" ] += info[ "NOTE" ];
    if( info[ "ENDHEADER" ] )
    {
	if( info[ "ENDHEADER" ] == getting_board[ key ][ "HEADER" ] )
	    send_message( getting_board[ key ] );
	map_delete( getting_board, key );
    }
}				/* incoming_request() */

void    time_out()
{
    int     i;
    string *the_keys;

    the_keys = keys( getting_board );
    for( i = 0; i < sizeof( the_keys ); i++ )
	if( getting_board[ the_keys[ i ] ][ "TIME" ] + 5 * 60 < time() )
	    map_delete( getting_board, the_keys[ i ] );
    if( sizeof( getting_board ) )
	call_out( "time_out", 5 * 60 );
    else
	call_in_progress = 0;
}				/* time_out() */

/*
 * This will add the message onto the correct board.
 */
void    send_message( mapping info )
{
    if( !info[ "BOARD" ] )
	info[ "BOARD" ] = "intermud";
    BOARD_HAND->add_message( info[ "BOARD" ], info[ "WIZNAME" ] + "@" + info[ "NAME" ],
			     info[ "HEADER" ], info[ "NOTE" ] );
}				/* send_message() */