#include "activate_msg_1.h"

// Author: Steve Talbot

activate_msg_1:: activate_msg_1(){
}

activate_msg_1:: ~activate_msg_1(){
}

bool activate_msg_1:: activate_msg( Data* data_ ){

	AccountInfo* accountInfo = data_->getCurrentAccountInfo();

	// update “accountInfo” to make sure it is “active” ..
	if( accountInfo->getIsActive() == false )
		accountInfo->setIsActive( true );

	int id = accountInfo->getID();

	int pin = accountInfo->getPN();

	cout << (* data_->getMessage( data_->_messageIds->ACTIVATE ) );

	cout << " - id: " << id << ", pin: " << pin << endl;

	// indicate that this change to the "account info" object means
	// that this object needs to be written to file during the logout
	// operation ..
	if ( data_->getNeedsToBeFlushedToFile( accountInfo->getID() ) == false )
		data_->setNeedsToBeFlushedToFile( accountInfo->getID(), true );

	// reset "tempPin" ..
	data_->setTempPin( -1 );

	return true;

}
