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