// ClientDirUser.cpp: implementation of the ClientDirUser class.
//
//////////////////////////////////////////////////////////////////////

#include "ClientDirUser.h"

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

void ClientDirUser::OutputInfo(char level, const_char* data)
{
	if (maxresults && (results > maxresults)) return;
	if (changeflag == TRUE)
	{
		OutputChanges(data);
		return;
	}
	/* Each line of output is a directory name; for example:
	 * //depot/foo/bar
	 * Very little needs to be done in the way of parsing. */
	StrBuf dir = StrBuf();
	dir.Append(data); //Put all the output into this StrBuf
	dirs.Append(dir); //and append it to the list.
	results++;
}

void ClientDirUser::OutputChanges(const_char * data)
{
	StrBuf change = StrBuf();
	change.Append(data);
	if (change.Length() > 78) change.SetLength(78); //Truncate output over 78 chars - space is valuable.
	change.Append("\n"); //This function is called once per line, and the data doesn't include a newline.
	changes.Append(&change); //Note that changes is a StrBuf, not a ListList.
}

ClientDirUser::ClientDirUser()
{
	results = 0;
}

ClientDirUser::~ClientDirUser()
{

}
