From msn@minnie.bell.inmet.comWed Nov 22 15:05:56 1995
Received: by greatdane.webnexus.com; (5.65/1.1.8.2/24Jan95-1133PM)
	id AA27751; Fri, 15 Sep 1995 13:47:51 -0700
Received: from minnie.bell.inmet.com by greatdane.webnexus.com; (5.65/1.1.8.2/24Jan95-1133PM)
	id AA27675; Fri, 15 Sep 1995 13:47:43 -0700
Received: by minnie.bell.inmet.com (4.1/SMI-4.1)
	id AA11750; Fri, 15 Sep 95 13:47:03 PDT
Date: Fri, 15 Sep 95 13:47:03 PDT
From: msn@minnie.bell.inmet.com (Michael Nikkel)
Message-Id: <9509152047.AA11750@minnie.bell.inmet.com>
To: merc-l@webnexus.com
Subject: DO_USERS enhancement
Sender: owner-merc-l@greatdane.webnexus.com
Precedence: bulk

I'm sure most of you have noticed that not all sockets will close when a
connection is broken.  Its easy to write a routine to either do a do_quit
on the socket (if there is a character connected and d->connected is
CON_PLAYING) or to do a close_socket on the socket (which will do a
free_char if there is a character attached to the descriptor).  However
in order to SEE all the connections you need to make a small mod to do_users
to show connections which are still at the point of asking for a name and
do not have a character attached yet.  The following is some slightly mod'ed
code to do so. Note that this uses our pager and you should change it to use
the name of your pager as appropriate.  The only real change is in the IF
statement.  Comments Appreciated.

Mike Nikkel (Ironhand)
msn@bell.inmet.com


/* ======================================================================== */
/* Show all connected user sockets                                          */
/* buf set to 256*80 (256 is max connections, 80 chars per line)            */ 
/* ======================================================================== */

void do_users( CHAR_DATA *ch, char *arg )
{
    DESCRIPTOR_DATA      *d;
    CHAR_DATA            *wch;
    char                  buf[21000];
    int                   count= 0;

    buf[0]      = '\0';

    /* Show all descriptors, even if character not assigned yet. */
    /* --------------------------------------------------------- */

    for ( d= descriptor_list; d; d= d->next )
    {
        wch = d->original ? d->original : d->character;

        if ( ( arg[0] == '\0' && ( wch == NULL || can_see( ch, wch ) ) )
        ||   ( arg[0] != '\0' &&  wch && is_name( arg, wch->name ) ) )
        {
	    count++;
            sprintf( buf + strlen(buf), "[%3d %2d] %s@%s\n\r",
                d->descriptor,
                d->connected,
                wch  ? wch->name : "(none)",
                d->host
                );
        }
    }

    /* Status messages */
    /* --------------- */

    if ( count == 0 )
    {
        sprintf( buf, "You didn't find any user with the name %s.\n\r", arg );
        send_to_char( buf, ch, 0 );
    }
    else
    {
        sprintf( buf + strlen(buf), "%d connections.\n\r", count );
        page( buf, ch );
    }
}




 =============================================================================
/   ______ _______ ____   _____   ___ __    _ ______    ____  ____   _____   /
\  |  ____|__   __|  _ \ / ____\ / _ \| \  / |  ____|  / __ \|  _ \ / ____\  \
/  | |__     | |  | |_| | |     | |_| | |\/| | |___   | |  | | |_| | |       /
/  | ___|    | |  | ___/| |   __|  _  | |  | | ____|  | |  | |  __/| |   ___ \
\  | |       | |  | |   | |___| | | | | |  | | |____  | |__| | |\ \| |___| | /
/  |_|       |_|  |_|  o \_____/|_| |_|_|  |_|______|o \____/|_| \_|\_____/  \
\                                                                            /
 ============================================================================

------------------------------------------------------------------------------
ftp://ftp.game.org/pub/mud      FTP.GAME.ORG      http://www.game.org/ftpsite/
------------------------------------------------------------------------------

 This archive came from FTP.GAME.ORG, the ultimate source for MUD resources.

------------------------------------------------------------------------------