From 2c35fe433d8f11fc0bb6a359e3daa42143e88856 Mon Sep 17 00:00:00 2001 From: Stojce Slavkovski Date: Thu, 24 Apr 2014 22:44:52 +0200 Subject: [PATCH] Try to load past messages with QXmppArchiveManager --- interface/src/XmppClient.cpp | 8 ++++++-- interface/src/XmppClient.h | 3 +++ interface/src/ui/ChatWindow.cpp | 2 ++ interface/src/ui/ChatWindow.h | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/interface/src/XmppClient.cpp b/interface/src/XmppClient.cpp index d930c16b53..955d66c807 100644 --- a/interface/src/XmppClient.cpp +++ b/interface/src/XmppClient.cpp @@ -20,11 +20,15 @@ const QString DEFAULT_CHAT_ROOM = "public@public-chat.highfidelity.io"; XmppClient::XmppClient() : _xmppClient(), - _xmppMUCManager() -{ + _xmppMUCManager(), + _archiveManager() +{ AccountManager& accountManager = AccountManager::getInstance(); connect(&accountManager, SIGNAL(accessTokenChanged()), this, SLOT(connectToServer())); connect(&accountManager, SIGNAL(logoutComplete()), this, SLOT(disconnectFromServer())); + + _archiveManager = new QXmppArchiveManager; + _xmppClient.addExtension(_archiveManager); } XmppClient& XmppClient::getInstance() { diff --git a/interface/src/XmppClient.h b/interface/src/XmppClient.h index 8af3204377..27ca4b9759 100644 --- a/interface/src/XmppClient.h +++ b/interface/src/XmppClient.h @@ -17,6 +17,7 @@ #include #include #include +#include "QXmppArchiveManager.h" /// Generalized threaded processor for handling received inbound packets. class XmppClient : public QObject { @@ -27,6 +28,7 @@ public: QXmppClient& getXMPPClient() { return _xmppClient; } const QXmppMucRoom* getPublicChatRoom() const { return _publicChatRoom; } + QXmppArchiveManager* getArchiveManager() const { return _archiveManager; } private slots: void xmppConnected(); @@ -43,6 +45,7 @@ private: QXmppClient _xmppClient; QXmppMucManager _xmppMUCManager; QXmppMucRoom* _publicChatRoom; + QXmppArchiveManager* _archiveManager; }; #endif // __interface__XmppClient__ diff --git a/interface/src/ui/ChatWindow.cpp b/interface/src/ui/ChatWindow.cpp index 635f1f3d10..ae8d481efb 100644 --- a/interface/src/ui/ChatWindow.cpp +++ b/interface/src/ui/ChatWindow.cpp @@ -74,6 +74,7 @@ ChatWindow::ChatWindow() : connect(&xmppClient, SIGNAL(connected()), this, SLOT(connected())); } connect(&xmppClient, SIGNAL(messageReceived(QXmppMessage)), this, SLOT(messageReceived(QXmppMessage))); + #endif } @@ -213,6 +214,7 @@ void ChatWindow::connected() { #ifdef HAVE_QXMPP const QXmppMucRoom* publicChatRoom = XmppClient::getInstance().getPublicChatRoom(); connect(publicChatRoom, SIGNAL(participantsChanged()), this, SLOT(participantsChanged())); + #endif startTimerForTimeStamps(); } diff --git a/interface/src/ui/ChatWindow.h b/interface/src/ui/ChatWindow.h index 6a807f9b81..5c81d3a1f2 100644 --- a/interface/src/ui/ChatWindow.h +++ b/interface/src/ui/ChatWindow.h @@ -23,6 +23,10 @@ #include #include +class QXmppArchiveChat; +class QXmppArchiveManager; +class QXmppResultSetReply; + #endif namespace Ui { @@ -70,6 +74,7 @@ private slots: void error(QXmppClient::Error error); void participantsChanged(); void messageReceived(const QXmppMessage& message); + #endif };