Login
User Name:

Password:



Register

Forgot your password?
A Bash Startup Script
Feb 7, 2026 3:49 pm
By eldhamud
Force Skills
Jan 1, 2026 3:58 pm
By Elwood
Overland with Bitmaps
Jul 4, 2025 11:57 pm
By Samson
void nanny_get_new_race -- comm.c
Mar 13, 2025 7:08 am
By Elwood
IPv6
Jan 25, 2025 10:45 pm
By Samson
SWFotEFUSS 1.5.3
Author: Various
Submitted by: Samson
SWRFUSS 1.4.3
Author: Various
Submitted by: Samson
SmaugFUSS 1.9.8
Author: Various
Submitted by: Samson
AFKMud 2.5.2
Author: AFKMud Team
Submitted by: Samson
SmaugFUSS 1.9.7
Author: Various
Submitted by: Samson
Users Online
Anthropic, Google, Meta, Amazonbot, Baiduspider

Members: 0
Guests: 25
Stats
Files
Topics
Posts
Members
Newest Member
507
3,814
19,735
593
TerrellStr

» SmaugMuds » Codebases » AFKMud Support & Development » A New function for the channe...
Forum Rules | Mark all | Recent Posts

A New function for the channel history
< Newer Topic :: Older Topic > Might be of use :)

Pages:<< prev 1 next >>
Post is unread #1 Jul 1, 2006 12:06 am   
Go to the top of the page
Go to the bottom of the page

ToadVile
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

Post is unread #2 Nov 23, 2006 6:52 am   Last edited Nov 23, 2006 6:52 am by Moridian
Go to the top of the page
Go to the bottom of the page

Moridian
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

Post is unread #3 Nov 23, 2006 4:30 pm   Last edited Nov 23, 2006 4:30 pm by kiasyn
Go to the top of the page
Go to the bottom of the page

kiasyn
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.

Post is unread #4 Nov 23, 2006 9:41 pm   
Go to the top of the page
Go to the bottom of the page

Samson
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 >>