The Sendinfo BUG for EmberMUD
                      Fix Sheet 1.0 by Rindar (Ron Cole)
                       Fix 1.0 by Raven (Laurie Zenner)


NOTE:  You will need the code from SENDFIX.TXT installed for this to 
work properly.

The Bug:  Recently, the MUD I was on was experiencing a number of 
crashes when people used the AFK command and (to a much lesser 
extent) add2last.  Looking into the add2last code, Raven (the coder
of this fix) finally got fed up with it and re-wrote most of it to her 
liking.  Included are the new add2last and add2last_imm functions
that she wrote.

The Install:  Because there are now so many versions of EmberMUD out
there and ours has become so modified, I've decided not to include
the "step by step" on how to fix the bug.  Instead, just install 
the function at the bottom of this file as follows:

        1)  Open act_comm.c
        2)  Find the function "void add2last"
        3)  Delete it.
        4)  Replace it with the function at the bottom of the page. 
        5)  Repeat steps 2-4 with add2last_imm.
        6)  Recompile.  You are done.


-= Rindar
clogar@concentric.net


** Note:  This function is provided "as is" and may be used so long as 
1)  The author's name is kept at the top of the function (if requested) and
2)  all other previous licensing aggreements are abided by.  The author 
assumes no responsibility for problems that occur through use or install-
ation, including lost wages, bugs, deletions, downtimes, etc...  Use at 
your own risk.  All new code is copyrighted by its author and may be used
in all "free" MUDs.


New add2last & add2last_imm functions (act_comm.c):

void add2last( char *argument, CHAR_DATA *ch )
{
        static int last_length = 0;
        LAST_DATA *  tmp;
        
        if ( last_length == MAX_LAST_LENGTH )
        {
                tmp = flast;
                flast = tmp->next;
                last_list->next = tmp;
                last_list = tmp;
                if (last_list->msg != NULL && strlen(last_list->msg) > 0) 
                        free_string(last_list->msg);
                if (last_list->sender != NULL && strlen(last_list->sender) > 0) 
                        free_string(last_list->sender);
        }
        else
        {
                tmp = alloc_mem(sizeof( LAST_DATA ));
                if ( last_list != NULL ) 
                        last_list->next = tmp;
                last_list = tmp;
                if ( flast == NULL )
                        flast = tmp;
                last_length++;
        }
        last_list->next = NULL;
        last_list->msg  = str_dup( argument );
        if ( ch != NULL )
        {
                last_list->sender = str_dup(ch->name);
                last_list->level  = ch->invis_level;
                last_list->hidden = (IS_SET(ch->act,PLR_WIZINVIS)) ? TRUE : FALSE;
        }
        else
        {
                last_list->sender = str_dup( " " );
                last_list->level  = 0;
                last_list->hidden = FALSE;
        }
        return;
}


void add2last_imm( char *argument, CHAR_DATA *ch)
{
        static int last_imm_length = 0;
        LAST_DATA *  tmp;
        
        if ( last_imm_length == MAX_LAST_LENGTH )
        {
                tmp = flast_imm;
                flast_imm = tmp->next;
                last_imm->next = tmp;
                last_imm = tmp;
                if (last_imm->msg != NULL && strlen( last_imm->msg ) > 0)
                        free_string( last_imm->msg );
                if (last_imm->sender != NULL && strlen( last_imm->sender ) > 0)
                        free_string( last_imm->sender );
        }
        else
        {
                tmp = alloc_mem(sizeof(LAST_DATA));
                if ( last_imm != NULL )
                        last_imm->next = tmp;
                last_imm = tmp;
                if ( flast_imm == NULL )
                        flast_imm = last_imm;
                ++last_imm_length;
        }
        last_imm->next   = NULL;
        last_imm->msg    = str_dup(argument);
        last_imm->sender = str_dup(ch->name);
        last_imm->level  = ch->invis_level;
        last_imm->hidden = (IS_SET(ch->act,PLR_WIZINVIS)) ? TRUE : FALSE;
        return;
}




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

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

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

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