From 45caf5bae192991e8d931926ccb76f28d22b2277 Mon Sep 17 00:00:00 2001 From: Olli Salli Date: Thu, 25 Aug 2011 15:04:01 +0300 Subject: StreamTubeClient: Add isRegistered() for verifying registration was successful Also fixes trying to unregister non-registered handlers on destruction --- qt4/TelepathyQt4/stream-tube-client.cpp | 7 ++++++- qt4/TelepathyQt4/stream-tube-client.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'qt4') diff --git a/qt4/TelepathyQt4/stream-tube-client.cpp b/qt4/TelepathyQt4/stream-tube-client.cpp index 64e41cc9e..78eb86164 100644 --- a/qt4/TelepathyQt4/stream-tube-client.cpp +++ b/qt4/TelepathyQt4/stream-tube-client.cpp @@ -255,7 +255,7 @@ StreamTubeClient::StreamTubeClient( */ StreamTubeClient::~StreamTubeClient() { - if (!clientName().isNull()) { + if (isRegistered()) { mPriv->registrar->unregisterClient(mPriv->handler); } @@ -274,6 +274,11 @@ QString StreamTubeClient::clientName() const return mPriv->clientName; } +bool StreamTubeClient::isRegistered() const +{ + return mPriv->isRegistered; +} + bool StreamTubeClient::monitorsConnections() const { return mPriv->handler->monitorsConnections(); diff --git a/qt4/TelepathyQt4/stream-tube-client.h b/qt4/TelepathyQt4/stream-tube-client.h index 04aa18105..1f77c3456 100644 --- a/qt4/TelepathyQt4/stream-tube-client.h +++ b/qt4/TelepathyQt4/stream-tube-client.h @@ -116,6 +116,7 @@ public: ClientRegistrarPtr registrar() const; QString clientName() const; + bool isRegistered() const; bool monitorsConnections() const; bool acceptsAsTcp() const; // if setToAcceptAsTCP has been used last -- cgit v1.2.3