clientluser.cpp #1

  • //
  • guest/
  • sam_stafford/
  • p4hl/
  • src/
  • dlls/
  • clientluser.cpp
  • View
  • Commits
  • Open Download .zip Download (1 KB)
// 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()
{

}
# Change User Description Committed
#2 1689 Sam Stafford Integrate 02.1 API and code cleanup to P4HL.
 Lots of work.  Phew.
#1 937 Sam Stafford Renaming my guest directory to the more conventional
sam_stafford.
//guest/samwise/p4hl/src/dlls/clientluser.cpp
#1 936 Sam Stafford Adding P4HL to the public depot.
 See relnotes.txt for
installation instructions; all relevant files are under
p4hl/dist.

Source code is under p4hl/src in the form of a VC++ project.