2016-10-20 09:12:15 -04:00
|
|
|
#include "Event.h"
|
|
|
|
#include "Log.h"
|
|
|
|
|
|
|
|
namespace i2p
|
|
|
|
{
|
2016-11-01 10:26:40 -04:00
|
|
|
namespace event
|
|
|
|
{
|
2016-11-01 13:57:25 -04:00
|
|
|
#ifdef WITH_EVENTS
|
2016-11-01 10:26:40 -04:00
|
|
|
EventCore core;
|
2016-11-01 13:57:25 -04:00
|
|
|
#endif
|
2016-10-20 09:12:15 -04:00
|
|
|
|
2016-11-01 10:26:40 -04:00
|
|
|
void EventCore::SetListener(EventListener * l)
|
|
|
|
{
|
|
|
|
m_listener = l;
|
|
|
|
LogPrint(eLogInfo, "Event: listener set");
|
|
|
|
}
|
2016-10-20 09:12:15 -04:00
|
|
|
|
2016-11-01 10:26:40 -04:00
|
|
|
void EventCore::QueueEvent(const EventType & ev)
|
|
|
|
{
|
|
|
|
if(m_listener)
|
|
|
|
m_listener->HandleEvent(ev);
|
|
|
|
}
|
|
|
|
}
|
2016-10-20 09:12:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void EmitEvent(const EventType & e)
|
|
|
|
{
|
2016-11-01 10:26:40 -04:00
|
|
|
#ifdef WITH_EVENTS
|
|
|
|
i2p::event::core.QueueEvent(e);
|
|
|
|
#endif
|
2016-10-20 09:12:15 -04:00
|
|
|
}
|
|
|
|
|