//
// QPerforce is a gui interface to the perforce revision control
// system. It is based on the qt library, and should be easily portable
// across any platform that has this toolkit available.
//
// Copyright (C) 2002 Jacob Gladish
//
// TODO: find legit copyright.
//
#include "User.h"
#include "ConfigOptions.h"
#include <stdio.h>
#include "P4Client.h"
namespace Perforce {
User::UserListCache User::_userListCache;
const UserList& User::getUsers()
{
// qDebug( "User::getUsers()" );
_userListCache.updateCacheIfNecessary();
return _userListCache.getCache();
}
void User::UserListCache::OutputStat( StrDict *varList )
{
ASSERT( varList != NULL );
// DumpDict( varList );
User* u = new User();
u->_name = varList->GetVar("User")->Text();
u->_fullName = varList->GetVar("FullName")->Text();
u->_email = varList->GetVar("Email")->Text();
QString temp = varList->GetVar("Access")->Text();
u->_date.setTime_t( temp.toInt() );
_cache.append( u );
}
void User::UserListCache::HandleError( Error* err )
{
qDebug ("Error reading user list!");
}
void User::UserListCache::updateCache()
{
// qDebug ("User::UserListCache::updateCache()");
char* p[] = { "" };
RunP4Command( 0, p, "users", this );
}
} // end namespace