// DWBS ------------------------------------------------------------------ DWBS
//
// PLATFORM		: ALL
// PRODUCT		: BIT_DEMON
// VISIBILITY	: PUBLIC
//
// DWBS ------------------------------------------------------------------ DWBS

#include <bdLobby/bdFriends/bdGetGroupedFriendsResult.h>

bdGetGroupedFriendsResult::bdGetGroupedFriendsResult()
{
}

bdGetGroupedFriendsResult::~bdGetGroupedFriendsResult()
{
	m_friends.clear();
}

bdBool bdGetGroupedFriendsResult::handleResult(const bdUInt numResults, bdBitBufferRef buffer)
{
	bdBool ok = true;

	for(bdUInt i=0; ok && (i < numResults); i++)
	{
		bdGetGroupedFriendsResult::bdGroupedFriend f;

		ok = buffer->readUInt64(f.m_userID);
		ok = ok && buffer->readString(f.m_userName, BD_MAX_USERNAME_LENGTH);
		ok = ok && buffer->readBool(f.m_isOnline);
		ok = ok && buffer->readUByte8(f.m_groupID);

		if(ok)
		{
			m_friends.pushBack(f);
		}
	}

	m_numResults = m_friends.getSize();
	return ok;
}
