Pages:<< prev 1 next >>
Fledgling

GroupMembers
Posts47
JoinedApr 1, 2006
I was thinking bout like a command, so that you can clear the history of channels. Any channel you want.
Like clear "tells" would remove all thats been said, all. giving you a nice, empty history buffer again..
Just a idea
Like clear "tells" would remove all thats been said, all. giving you a nice, empty history buffer again..
Just a idea
Fledgling

GroupMembers
Posts5
JoinedNov 13, 2006
ToadVile said:
I was thinking bout like a command, so that you can clear the history of channels. Any channel you want.
Like clear "tells" would remove all thats been said, all. giving you a nice, empty history buffer again..
Just a idea
I realize that this is an old post but it got me thinking, so I whipped up a short function to do just what was suggested.
Not sure if it's allowed so Samson feel free to remove the code if you don't want it posted. It was just easy and I wanted it for my mud and thought I'd share.
void do_clearhist ( CHAR_DATA *ch, char *argument )
{
MUD_CHANNEL *channel;
int loopa;
if ( !argument || argument[0] == '\0' )
{
send_to_char( "&GSyntax: clearhist <name>\n\r", ch );
return;
}
if ( !(channel = find_channel( argument ) ) )
{
send_to_char( "&RNo channel with that name exists.\n\r", ch );
return;
}
for( loopa = 0; loopa < MAX_CHANHISTORY; loopa++ )
{
if ( channel->history[loopa][0] )
DISPOSE( channel->history[loopa][0] );
if ( channel->history[loopa][1] )
DISPOSE( channel->history[loopa][1] );
}
ch_printf( ch, "History for channel %s cleared.\n\r", channel->name );
return;
}
-Moridian
Magician

GroupMembers
Posts117
JoinedJun 30, 2006
for( loopa = 0; loopa < MAX_CHANHISTORY; loopa++ )
{
if ( channel->history[loopa][0] )
DISPOSE( channel->history[loopa][0] );
if ( channel->history[loopa][1] )
DISPOSE( channel->history[loopa][1] );
}
IIRC DISPOSE checks for NULL so you can remove the ifchecks.
Black Hand

GroupAdministrators
Posts3,708
JoinedJan 1, 2002
We added this in the code for send_tochannel because I was lazy and didn't feel like adding a new command. If you want to use this, it's up to you to backport the C++
if( !argument || argument[0] == '\0' || !str_cmp( argument, "hpurge" ) )
{
if( !channel->flags.test( CHAN_KEEPHISTORY ) )
{
ch->printf( "%s what?\r\n", capitalize( channel->name ) );
return;
}
if( !str_cmp( argument, "hpurge" ) )
{
for( int x = 0; x < MAX_CHANHISTORY; ++x )
{
DISPOSE( channel->history[x][0] );
DISPOSE( channel->history[x][1] );
}
ch->printf( "The %s channel history has been purged.\r\n", channel->name );
return;
}
show_channel_history( ch, channel );
return;
}
Pages:<< prev 1 next >>