#include "StdAfx.h"
#include "buddyevent.h"
#include "buddypopuplist.h"
#include "ATLComTime.h"

LocationEvent::LocationEvent()
{
	item = NULL;
}

LocationEvent::~LocationEvent(void)
{
}

// these things change due to time 
void LocationEvent::ShallowRefresh()
{
	// update the associated item's style
	if(item){
		if(record.Private){ //private event
			item->Set(LocationPopupList::PrivateEvent);
		} else { // public event
			item->Set(LocationPopupList::PublicEvent);
		}
		item->Redraw();
	}
}

void LocationEvent::DeepRefresh(int eventId)
{
	if(!db.GetCachedEvent(eventId,record))
		print(L"Unknown event in the event list!\n");

	ShallowRefresh();
}

void LocationEvent::OnCustomNotify(int id, Notification& n)
{
	switch(id){
	case bcEvent:
		switch(n.reason){
		case bcModified:
			db.GetCachedEvent(record.EventId,record);
			ShallowRefresh();
			break;
		}
		break;
	}

}
