From 60c294df8efa73c24f4c7b304479f646d5d17b2a Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Thu, 8 Jul 2010 16:00:54 +0000 Subject: add accessor to test whether a client is connected --- source/QXmppClient.cpp | 8 ++++++++ source/QXmppClient.h | 1 + 2 files changed, 9 insertions(+) (limited to 'source') diff --git a/source/QXmppClient.cpp b/source/QXmppClient.cpp index bdd91cfa..3b674817 100644 --- a/source/QXmppClient.cpp +++ b/source/QXmppClient.cpp @@ -260,6 +260,14 @@ void QXmppClient::disconnect() } } +/// Returns true if the client is connected to the XMPP server. +/// + +bool QXmppClient::isConnected() const +{ + return m_stream && m_stream->isConnected(); +} + /// Returns the reference to QXmppRoster object of the client. /// \return Reference to the roster object of the connected client. Use this to /// get the list of friends in the roster and their presence information. diff --git a/source/QXmppClient.h b/source/QXmppClient.h index 9a367f90..55bd5297 100644 --- a/source/QXmppClient.h +++ b/source/QXmppClient.h @@ -101,6 +101,7 @@ public: const QXmppPresence& initialPresence = QXmppPresence()); void disconnect(); + bool isConnected() const; QXmppArchiveManager& archiveManager(); QXmppMucManager& mucManager(); -- cgit v1.2.3