i2pd/Event.cpp

33 lines
457 B
C++
Raw Normal View History

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