From 27751e9b1a176e1169e1aa1cfc16180c559e061f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 31 Oct 2009 14:00:48 +0100 Subject: Added isActive() to WhitespacePingLayer. diff --git a/Swiften/StreamStack/WhitespacePingLayer.cpp b/Swiften/StreamStack/WhitespacePingLayer.cpp index 25e4436..939c4fa 100644 --- a/Swiften/StreamStack/WhitespacePingLayer.cpp +++ b/Swiften/StreamStack/WhitespacePingLayer.cpp @@ -8,7 +8,7 @@ namespace Swift { static const int TIMEOUT_MILLISECONDS = 60000; -WhitespacePingLayer::WhitespacePingLayer() { +WhitespacePingLayer::WhitespacePingLayer() : isActive(false) { // FIXME: Create a BoostTimerFactory. timer = boost::shared_ptr(new Timer(TIMEOUT_MILLISECONDS, &MainBoostIOServiceThread::getInstance().getIOService())); timer->onTick.connect(boost::bind(&WhitespacePingLayer::handleTimerTick, this)); @@ -27,11 +27,13 @@ void WhitespacePingLayer::handleTimerTick() { } void WhitespacePingLayer::setActive() { + isActive = true; timer->start(); } void WhitespacePingLayer::setInactive() { timer->stop(); + isActive = false; } } diff --git a/Swiften/StreamStack/WhitespacePingLayer.h b/Swiften/StreamStack/WhitespacePingLayer.h index de6013b..9d6957b 100644 --- a/Swiften/StreamStack/WhitespacePingLayer.h +++ b/Swiften/StreamStack/WhitespacePingLayer.h @@ -17,10 +17,15 @@ namespace Swift { void writeData(const ByteArray& data); void handleDataRead(const ByteArray& data); + bool getIsActive() const { + return isActive; + } + private: void handleTimerTick(); private: + bool isActive; boost::shared_ptr timer; }; } -- cgit v0.10.2-6-g49f6