// clientluser.cpp: implementation of the ClientLuser class.
//
//////////////////////////////////////////////////////////////////////

#include "clientluser.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

ClientLuser::ClientLuser()
{
	message = StrBuf();
}

/* This function is almost identical to the default implementation of
 * ClientUser::OutputInfo.  The only difference is that it appends to
 * a StrBuf instead of printing to stdout. */
void
ClientLuser::OutputInfo( char level, const_char *data )
{
	/* The *data pointer points at the first byte of the text.*/
	switch( level )
	{
	default:
	case '0': break;
	case '1': message.Append( "... " ); break;
	case '2': message.Append( "... ... " ); break;
	}
	message.Append( data); //Copy *data into the message StrBuf.
	message.Append("\n"); //Add a newline.
}

/* For our purposes we only really care about 500 bytes worth of
 * text, so might as well conserve memory by discarding anything
 * over that. */
void
ClientLuser::OutputText( const_char *data, int length )
{
	if (length < 500) {
		message.Append(data, length);
	} 
	else
	{
		message.Append(data, 500);
	}
	return;
}

ClientLuser::~ClientLuser()
{

}
