aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-06-04 11:55:51 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-06-04 11:55:51 +0000
commitfd81b0d61e00f085bfb813959e24aa523ac143f9 (patch)
tree3e0fea4e97e47956ed1b880ef08833933e0154f9 /source
parentcbae731d07f9240214304078075c237661c2c54b (diff)
downloadqxmpp-fd81b0d61e00f085bfb813959e24aa523ac143f9.tar.gz
move roster ownership to QXmppClient, so that a QXmppStream can be created without a roster manager
Diffstat (limited to 'source')
-rw-r--r--source/QXmppClient.cpp3
-rw-r--r--source/QXmppClient.h1
-rw-r--r--source/QXmppRoster.cpp6
-rw-r--r--source/QXmppStream.cpp20
-rw-r--r--source/QXmppStream.h2
5 files changed, 15 insertions, 17 deletions
diff --git a/source/QXmppClient.cpp b/source/QXmppClient.cpp
index 13c89d21..eac98eda 100644
--- a/source/QXmppClient.cpp
+++ b/source/QXmppClient.cpp
@@ -43,6 +43,7 @@ QXmppClient::QXmppClient(QObject *parent)
{
m_logger = QXmppLogger::getLogger();
m_stream = new QXmppStream(this);
+ m_roster = new QXmppRoster(m_stream);
bool check = connect(m_stream, SIGNAL(messageReceived(const QXmppMessage&)),
this, SIGNAL(messageReceived(const QXmppMessage&)));
@@ -243,7 +244,7 @@ void QXmppClient::disconnect()
QXmppRoster& QXmppClient::getRoster()
{
- return m_stream->getRoster();
+ return *m_roster;
}
/// Utility function to send message to all the resources associated with the
diff --git a/source/QXmppClient.h b/source/QXmppClient.h
index 6f52e4ca..6732d048 100644
--- a/source/QXmppClient.h
+++ b/source/QXmppClient.h
@@ -209,6 +209,7 @@ private:
///< required for connecting to the XMPP server.
QXmppPresence m_clientPresence; ///< Stores the current presence of the connected client
QXmppReconnectionManager* m_reconnectionManager; ///< Pointer to the reconnection manager
+ QXmppRoster *m_roster; ///< Pointer to the roster manager
QHash<QString,QXmppInvokable *> m_interfaces;
};
diff --git a/source/QXmppRoster.cpp b/source/QXmppRoster.cpp
index a7c98efd..51d877e2 100644
--- a/source/QXmppRoster.cpp
+++ b/source/QXmppRoster.cpp
@@ -29,8 +29,10 @@
#include "QXmppPresence.h"
#include "QXmppStream.h"
-QXmppRoster::QXmppRoster(QXmppStream* stream) : m_stream(stream),
- m_isRosterReceived(false)
+QXmppRoster::QXmppRoster(QXmppStream* stream)
+ : QObject(stream),
+ m_stream(stream),
+ m_isRosterReceived(false)
{
bool check = QObject::connect(m_stream, SIGNAL(xmppConnected()),
this, SLOT(connected()));
diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp
index 1f99fdfb..7d6a0190 100644
--- a/source/QXmppStream.cpp
+++ b/source/QXmppStream.cpp
@@ -26,26 +26,27 @@
#include "QXmppPacket.h"
#include "QXmppUtils.h"
#include "QXmppClient.h"
-#include "QXmppRoster.h"
#include "QXmppPresence.h"
#include "QXmppIq.h"
#include "QXmppBind.h"
#include "QXmppSession.h"
-#include "QXmppRosterIq.h"
#include "QXmppMessage.h"
#include "QXmppConstants.h"
#include "QXmppVCard.h"
#include "QXmppNonSASLAuth.h"
#include "QXmppInformationRequestResult.h"
-#include "QXmppIbbIq.h"
-#include "QXmppRpcIq.h"
+#include "QXmppTransferManager.h"
+
+// IQ types
#include "QXmppArchiveIq.h"
#include "QXmppByteStreamIq.h"
#include "QXmppDiscoveryIq.h"
-#include "QXmppPingIq.h"
+#include "QXmppIbbIq.h"
#include "QXmppLogger.h"
+#include "QXmppPingIq.h"
+#include "QXmppRpcIq.h"
+#include "QXmppRosterIq.h"
#include "QXmppStreamInitiationIq.h"
-#include "QXmppTransferManager.h"
#include "QXmppVersionIq.h"
#include <QCoreApplication>
@@ -60,7 +61,7 @@ static const QByteArray streamRootElementStart = "<?xml version=\"1.0\"?><stream
static const QByteArray streamRootElementEnd = "</stream:stream>";
QXmppStream::QXmppStream(QXmppClient* client)
- : QObject(client), m_client(client), m_roster(this),
+ : QObject(client), m_client(client),
m_sessionAvaliable(false),
m_archiveManager(m_client),
m_transferManager(m_client),
@@ -989,11 +990,6 @@ bool QXmppStream::isConnected() const
return m_socket.state() == QAbstractSocket::ConnectedState;
}
-QXmppRoster& QXmppStream::getRoster()
-{
- return m_roster;
-}
-
bool QXmppStream::sendPacket(const QXmppPacket& packet)
{
// prepare packet
diff --git a/source/QXmppStream.h b/source/QXmppStream.h
index 79121812..60738a62 100644
--- a/source/QXmppStream.h
+++ b/source/QXmppStream.h
@@ -28,7 +28,6 @@
#include <QObject>
#include <QSslSocket>
#include "QXmppConfiguration.h"
-#include "QXmppRoster.h"
#include "QXmppStanza.h"
#include "QXmppVCardManager.h"
#include "QXmppArchiveManager.h"
@@ -130,7 +129,6 @@ private slots:
private:
QXmppClient* m_client; // reverse pointer
- QXmppRoster m_roster;
QString m_sessionId;
QString m_bindId;
QByteArray m_dataBuffer;