untermud/DOC/
untermud/DOC/U/
untermud/DOC/U/U-examples/
untermud/DOC/internals/
untermud/DOC/wizard/
untermud/MISC/
untermud/MISC/dbchk/
untermud/RWHO/
untermud/RWHO/rwhod/
How to link the client code into your MUD, whatever it may be:
--------------------------------------------------------------

	First off, compile clilib.c and make sure it's more or less
correct. It should compile without errors/warnings. If it does, let
someone know!

	Then, insert the appropriate calls into your MUD to handle
initializing and submitting rwho information. The things you need to
do are as follows:

	1) When the MUD first becomes active for play, send the rwho
	   server a "this mud is up" packet. That is done with a call

	rwhocli_setup(server,serverpw,myname,comment);
	char	*server;
	char	*serverpw;
	char	*myname;
	char	*comment;

	   in which "server" is the internet address, in text form
	   or "dot" notation of your rwho server. "serverpw" is the
	   password you have agreed upon with the server's keeper.
	   "myname" is the name of your MUD, and should be UNIQUE
	   and reasonably short. "comment" is typically a short (20 char)
	   description of the MUD and version. (EG: "UnterMUD V1.0a")

	   Typically, the above call should go someplace in the main()
	   function of the MUD, someplace before the main loop is started,
	   and after everything else is set up.

	NONE OF THESE VALUES CAN CONTAIN TABS OR BE NULL. TABS ARE A
	SPECIAL DELIMITER USED BY THE RWHO SERVER.


	2) At the point in which a player's login is validated, insert
	   a call to send the "player has logged in" message to the rwho
	   server. The format is:

	rwhocli_userlogin(uid,name);
	char	*uid;
	char	*name;

	   in which "uid" is a UNIQUE (within your MUD) specifier of th
	   user's identity, and the "name" is a longer-form of ID. This
	   is designed primarily with UnterMUD in mind, since it is quite
	   possible to have 2 player objects from different MUDs logged
	   into the same server, with the same name. The "uid" is unique.
	   If your MUD has no similar concept, send the "uid" and an empty
	   string for "name".


	3) At the point in which a player is logged out, insert a call to
	   send the "player has logged out" message to the rwho server:

	rwhocli_userlogout(uid);
	char	*uid;

	   in which "uid" is the unique identifier of your local player who
	   has logged out.


	4) At some interval, your MUD should do an update to the server of
	   everyone that is on. This consists of the MUD server doing a
	   "ping!" option, which informs the rwho server that th MUD is
	   still running, followed with a list of all the logged in users.

	rwhocli_pingalive(); 	/* first send the ping. */

	   In UnterMUD, this looks like the following:
	
	io_rstnxtwho();
	rwhocli_pingalive();
	while((xx = io_nxtwho()) != (char *)0)
		rwhocli_userlogin(xx,ut_name(xx));

	   where "io_nxtwho()" gives the unique object ID of each logged
	   in player, and we pass the "uid" and player "name" to the rwho
	   server. This operation should be performed as often as the
	   rwho server "expires" its tables, (default is 5 minutes, so
	   you should do this every 4 minutes or so). Doing this loop is
	   very computationally inexpensive, since the data is all just
	   flung out in UDP packets.


	5) Last but not least, at the point in your code where the MUD
	   shuts down, send a "this mud is down" message to the rwho
	   server:

	rwhocli_shutdown();

	   which says "goodbye", closes sockets, and frees memory. If
	   for some reason your MUD crashes and CANNOT send this information,
	   the rwho server will eventually time your MUD out of its tables,
	   which effectively marks it as down.

mjr.

---------------------------------------------------------------------------
/*
	Copyright (C) 1991, Marcus J. Ranum. All rights reserved.
*/

/*
this is an example of how to handle updating rwho information from
within a MUD, specifically UnterMUD.

first off, we assume the client layer has already been initialized (a
safe bet) and then we send a 'mud-is-still-up' message, and then walk
our list of who is on, and send the information about each player as
a "plyer-is-logged-in" message
*/

#ifndef	lint
static	char	RCSid[] = "$Header: /usr/users/mjr/hacks/umud/RWHO/RCS/HOW_TO,v 1.1 91/07/04 17:32:40 mjr Rel $";
#endif

#include	<sys/types.h>

/* configure all options BEFORE including system stuff. */
#include	"config.h"


#include	"mud.h"

update_rwho()
{
	char	*xx;
	time_t	tv;

	io_rstnxtwho();
	rwhocli_pingalive();
	while((xx = io_nxtwho(&tv)) != (char *)0)
		rwhocli_userlogin(xx,ut_name(xx),tv);
	return(0);
}