summaryrefslogtreecommitdiff
path: root/server/src/event_subscription_repeated.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/event_subscription_repeated.cpp')
-rw-r--r--server/src/event_subscription_repeated.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/server/src/event_subscription_repeated.cpp b/server/src/event_subscription_repeated.cpp
index 4291dfa..04c0944 100644
--- a/server/src/event_subscription_repeated.cpp
+++ b/server/src/event_subscription_repeated.cpp
@@ -22,14 +22,16 @@
#include "event_subscription_repeated.h"
#include <boost/bind.hpp>
+#include "client.h"
+
extern boost::asio::io_service io_service_server;
event_subscription_repeated::event_subscription_repeated(client_event_subscription_request *req) : event_subscription_base(req)
{
- subtype = EVENT_SUBTYPE_REPEATED;
+ subtype = EVENT_MODE_REPEATED;
timer = new deadline_timer(io_service_server, boost::posix_time::milliseconds(req->interval()));
- timer->async_wait(boost::bind(&event_subscription_repeated::timer_handler, this, _1));
+
}
event_subscription_repeated::~event_subscription_repeated()
@@ -40,8 +42,9 @@ event_subscription_repeated::~event_subscription_repeated()
void event_subscription_repeated::timer_handler(const boost::system::error_code &e)
{
- if(!e)
+ if(!e && this->owner)
{
+ this->owner->fire_event(&subscription_request);
//TODO: fire event
if(!subscription_request.one_time())
{
@@ -61,3 +64,19 @@ void event_subscription_repeated::timer_handler(const boost::system::error_code
delete this;
}
}
+
+void event_subscription_repeated::start()
+{
+ timer->async_wait(boost::bind(&event_subscription_repeated::timer_handler, this, _1));
+}
+
+const client* event_subscription_repeated::get_owner()
+{
+ return owner;
+}
+
+void event_subscription_repeated::set_owner(client* c)
+{
+ owner = c;
+}
+