summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-10-31 13:00:48 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-01 11:19:59 (GMT)
commit27751e9b1a176e1169e1aa1cfc16180c559e061f (patch)
tree2b30615f869c18e84e9b9a2d1c3e17ae205b38b6 /Swiften/StreamStack
parentee7c1b0ea8bd9483add1f8b06d5b6f745f1cfe27 (diff)
downloadswift-27751e9b1a176e1169e1aa1cfc16180c559e061f.zip
swift-27751e9b1a176e1169e1aa1cfc16180c559e061f.tar.bz2
Added isActive() to WhitespacePingLayer.
Diffstat (limited to 'Swiften/StreamStack')
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.cpp4
-rw-r--r--Swiften/StreamStack/WhitespacePingLayer.h5
2 files changed, 8 insertions, 1 deletions
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<Timer>(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> timer;
};
}