aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-06-04 12:44:26 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-06-04 12:44:26 +0000
commite155e5658c178bea1c01ea70f4d04539a71b9f0a (patch)
tree954547ec22adf838d3207507f72afe0f517a6059 /source
parent4d171d7900cfe892ca1eae00c65a2253f27e9252 (diff)
downloadqxmpp-e155e5658c178bea1c01ea70f4d04539a71b9f0a.tar.gz
move vCard manager out of QXmppStream
Diffstat (limited to 'source')
-rw-r--r--source/QXmppArchiveManager.h1
-rw-r--r--source/QXmppClient.cpp4
-rw-r--r--source/QXmppClient.h6
-rw-r--r--source/QXmppStream.cpp10
-rw-r--r--source/QXmppStream.h4
-rw-r--r--source/QXmppVCardManager.cpp12
-rw-r--r--source/QXmppVCardManager.h10
7 files changed, 23 insertions, 24 deletions
diff --git a/source/QXmppArchiveManager.h b/source/QXmppArchiveManager.h
index 3ee243c0..f9a544c2 100644
--- a/source/QXmppArchiveManager.h
+++ b/source/QXmppArchiveManager.h
@@ -33,6 +33,7 @@ class QXmppArchiveListIq;
class QXmppArchivePrefIq;
class QXmppStream;
+/// XEP-0136: Message Archiving
class QXmppArchiveManager : public QObject
{
Q_OBJECT
diff --git a/source/QXmppClient.cpp b/source/QXmppClient.cpp
index 58be6348..1ac82e9d 100644
--- a/source/QXmppClient.cpp
+++ b/source/QXmppClient.cpp
@@ -34,6 +34,7 @@
#include "QXmppRpcIq.h"
#include "QXmppRemoteMethod.h"
#include "QXmppUtils.h"
+#include "QXmppVCardManager.h"
/// Creates a QXmppClient object.
/// \param parent is passed to the QObject's contructor.
@@ -84,6 +85,7 @@ QXmppClient::QXmppClient(QObject *parent)
// create managers
m_roster = new QXmppRoster(m_stream);
m_archiveManager = new QXmppArchiveManager(m_stream);
+ m_vCardManager = new QXmppVCardManager(m_stream);
}
/// Destructor, destroys the QXmppClient object.
@@ -414,7 +416,7 @@ QXmppStanza::Error::Condition QXmppClient::getXmppStreamError()
QXmppVCardManager& QXmppClient::getVCardManager()
{
- return m_stream->getVCardManager();
+ return *m_vCardManager;
}
void QXmppClient::addInvokableInterface( QXmppInvokable *interface )
diff --git a/source/QXmppClient.h b/source/QXmppClient.h
index 23e8582a..dff4fbfa 100644
--- a/source/QXmppClient.h
+++ b/source/QXmppClient.h
@@ -47,6 +47,7 @@ class QXmppRemoteMethod;
struct QXmppRemoteMethodResult;
class QXmppArchiveManager;
class QXmppDiscoveryIq;
+class QXmppVCardManager;
class QXmppTransferManager;
/// \brief The QXmppClient class is the main class for using QXmpp.
@@ -208,9 +209,10 @@ private:
QXmppConfiguration m_config; ///< This object provides the configuration
///< required for connecting to the XMPP server.
QXmppPresence m_clientPresence; ///< Stores the current presence of the connected client
- QXmppArchiveManager *m_archiveManager; ///< Pointer to the archive manager
+ QXmppArchiveManager *m_archiveManager; ///< Pointer to the archive manager
QXmppReconnectionManager* m_reconnectionManager; ///< Pointer to the reconnection manager
- QXmppRoster *m_roster; ///< Pointer to the roster manager
+ QXmppRoster *m_roster; ///< Pointer to the roster manager
+ QXmppVCardManager *m_vCardManager; ///< Pointer to the vCard manager
QHash<QString,QXmppInvokable *> m_interfaces;
};
diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp
index f3c8fc9d..aabf722b 100644
--- a/source/QXmppStream.cpp
+++ b/source/QXmppStream.cpp
@@ -64,7 +64,6 @@ QXmppStream::QXmppStream(QXmppClient* client)
: QObject(client), m_client(client),
m_sessionAvaliable(false),
m_transferManager(m_client),
- m_vCardManager(m_client),
m_authStep(0)
{
// Make sure the random number generator is seeded
@@ -94,10 +93,6 @@ QXmppStream::QXmppStream(QXmppClient* client)
SLOT(socketError(QAbstractSocket::SocketError)));
Q_ASSERT(check);
- check = QObject::connect(this, SIGNAL(vCardIqReceived(const QXmppVCard&)),
- &m_vCardManager, SLOT(vCardIqReceived(const QXmppVCard&)));
- Q_ASSERT(check);
-
// XEP-0047: In-Band Bytestreams
check = QObject::connect(this, SIGNAL(iqReceived(const QXmppIq&)),
&m_transferManager, SLOT(iqReceived(const QXmppIq&)));
@@ -1091,11 +1086,6 @@ QXmppStanza::Error::Condition QXmppStream::getXmppStreamError()
return m_xmppStreamError;
}
-QXmppVCardManager& QXmppStream::getVCardManager()
-{
- return m_vCardManager;
-}
-
void QXmppStream::flushDataBuffer()
{
m_dataBuffer.clear();
diff --git a/source/QXmppStream.h b/source/QXmppStream.h
index 1fd77681..87f8dfa7 100644
--- a/source/QXmppStream.h
+++ b/source/QXmppStream.h
@@ -27,9 +27,9 @@
#include <QObject>
#include <QSslSocket>
+#include "QXmppClient.h"
#include "QXmppConfiguration.h"
#include "QXmppStanza.h"
-#include "QXmppVCardManager.h"
#include "QXmppTransferManager.h"
class QDomElement;
@@ -65,7 +65,6 @@ public:
void disconnect();
bool isConnected() const;
QXmppTransferManager& getTransferManager();
- QXmppVCardManager& getVCardManager();
bool sendPacket(const QXmppPacket&);
QAbstractSocket::SocketError getSocketError();
@@ -139,7 +138,6 @@ private:
QTimer *m_timeoutTimer;
QXmppTransferManager m_transferManager;
- QXmppVCardManager m_vCardManager;
int m_authStep;
void debug(const QString&);
diff --git a/source/QXmppVCardManager.cpp b/source/QXmppVCardManager.cpp
index c5873071..08917e3d 100644
--- a/source/QXmppVCardManager.cpp
+++ b/source/QXmppVCardManager.cpp
@@ -23,17 +23,21 @@
#include "QXmppVCardManager.h"
+#include "QXmppStream.h"
#include "QXmppUtils.h"
-QXmppVCardManager::QXmppVCardManager(QXmppClient* client) :
- QObject(client), m_client(client), m_isClientVCardReceived(false)
+QXmppVCardManager::QXmppVCardManager(QXmppStream* stream) :
+ QObject(stream), m_stream(stream), m_isClientVCardReceived(false)
{
+ bool check = QObject::connect(m_stream, SIGNAL(vCardIqReceived(const QXmppVCard&)),
+ this, SLOT(vCardIqReceived(const QXmppVCard&)));
+ Q_ASSERT(check);
}
void QXmppVCardManager::requestVCard(const QString& jid)
{
QXmppVCard vcardIq(jid);
- m_client->sendPacket(vcardIq);
+ m_stream->sendPacket(vcardIq);
}
void QXmppVCardManager::vCardIqReceived(const QXmppVCard& vcard)
@@ -60,7 +64,7 @@ void QXmppVCardManager::setClientVCard(const QXmppVCard& clientVCard)
m_clientVCard.setTo("");
m_clientVCard.setFrom("");
m_clientVCard.setType(QXmppIq::Set);
- m_client->sendPacket(m_clientVCard);
+ m_stream->sendPacket(m_clientVCard);
}
void QXmppVCardManager::requestClientVCard()
diff --git a/source/QXmppVCardManager.h b/source/QXmppVCardManager.h
index 129d478e..ed68a2ac 100644
--- a/source/QXmppVCardManager.h
+++ b/source/QXmppVCardManager.h
@@ -26,15 +26,17 @@
#define QXMPPVCARDMANAGER_H
#include <QObject>
-#include "QXmppClient.h"
+
#include "QXmppVCard.h"
+class QXmppStream;
+
class QXmppVCardManager : public QObject
{
Q_OBJECT
public:
- QXmppVCardManager(QXmppClient* client);
+ QXmppVCardManager(QXmppStream* stream);
void requestVCard(const QString& bareJid = "");
const QXmppVCard& clientVCard() const;
@@ -50,8 +52,8 @@ private slots:
void vCardIqReceived(const QXmppVCard&);
private:
- // reference to to client object (no ownership)
- QXmppClient* m_client;
+ // reference to the xmpp stream (no ownership)
+ QXmppStream* m_stream;
QXmppVCard m_clientVCard; ///< Stores the vCard of the connected client
bool m_isClientVCardReceived;