summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MUCController.cpp3
-rw-r--r--Swift/Controllers/MUCController.h2
-rw-r--r--Swift/Controllers/MainController.cpp10
-rw-r--r--Swift/Controllers/MainController.h2
4 files changed, 12 insertions, 5 deletions
diff --git a/Swift/Controllers/MUCController.cpp b/Swift/Controllers/MUCController.cpp
index 848f540..da7a9e7 100644
--- a/Swift/Controllers/MUCController.cpp
+++ b/Swift/Controllers/MUCController.cpp
@@ -21,13 +21,14 @@ MUCController::MUCController (
const JID &muc,
const String &nick,
StanzaChannel* stanzaChannel,
+ PresenceSender* presenceSender,
IQRouter* iqRouter,
ChatWindowFactory* chatWindowFactory,
TreeWidgetFactory *treeWidgetFactory,
PresenceOracle* presenceOracle,
AvatarManager* avatarManager) :
ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc, presenceOracle, avatarManager),
- muc_(new MUC(stanzaChannel, muc)),
+ muc_(new MUC(stanzaChannel, presenceSender, muc)),
nick_(nick),
treeWidgetFactory_(treeWidgetFactory) {
roster_ = new Roster(chatWindow_->getTreeWidget(), treeWidgetFactory_);
diff --git a/Swift/Controllers/MUCController.h b/Swift/Controllers/MUCController.h
index af4a23a..7ee6e81 100644
--- a/Swift/Controllers/MUCController.h
+++ b/Swift/Controllers/MUCController.h
@@ -22,7 +22,7 @@ namespace Swift {
class MUCController : public ChatControllerBase {
public:
- MUCController(const JID& self, const JID &muc, const String &nick, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory *treeWidgetFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager);
+ MUCController(const JID& self, const JID &muc, const String &nick, StanzaChannel* stanzaChannel, PresenceSender* presenceSender, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, TreeWidgetFactory *treeWidgetFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager);
~MUCController();
protected:
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index f54e0a2..22d71e5 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -26,6 +26,7 @@
#include "Swiften/Base/foreach.h"
#include "Swiften/Base/String.h"
#include "Swiften/Client/Client.h"
+#include "Swiften/Presence/PresenceSender.h"
#include "Swiften/Elements/Presence.h"
#include "Swiften/Elements/VCardUpdate.h"
#include "Swiften/Queries/Responders/SoftwareVersionResponder.h"
@@ -60,7 +61,7 @@ typedef std::pair<JID, ChatController*> JIDChatControllerPair;
typedef std::pair<JID, MUCController*> JIDMUCControllerPair;
MainController::MainController(ChatWindowFactory* chatWindowFactory, MainWindowFactory *mainWindowFactory, LoginWindowFactory *loginWindowFactory, TreeWidgetFactory *treeWidgetFactory, SettingsProvider *settings, Application* application, SystemTray* systemTray, SoundPlayer* soundPlayer)
- : timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), client_(NULL), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), treeWidgetFactory_(treeWidgetFactory), settings_(settings), xmppRosterController_(NULL), rosterController_(NULL), loginWindow_(NULL), clientVersionResponder_(NULL), nickResolver_(NULL), discoResponder_(NULL) {
+ : timerFactory_(&boostIOServiceThread_.getIOService()), idleDetector_(&idleQuerier_, &timerFactory_, 100), client_(NULL), presenceSender_(NULL), chatWindowFactory_(chatWindowFactory), mainWindowFactory_(mainWindowFactory), loginWindowFactory_(loginWindowFactory), treeWidgetFactory_(treeWidgetFactory), settings_(settings), xmppRosterController_(NULL), rosterController_(NULL), loginWindow_(NULL), clientVersionResponder_(NULL), nickResolver_(NULL), discoResponder_(NULL) {
application_ = application;
presenceOracle_ = NULL;
avatarManager_ = NULL;
@@ -114,6 +115,8 @@ void MainController::resetClient() {
clientVersionResponder_ = NULL;
delete discoResponder_;
discoResponder_ = NULL;
+ delete presenceSender_;
+ presenceSender_ = NULL;
delete client_;
client_ = NULL;
@@ -210,7 +213,7 @@ void MainController::sendPresence(boost::shared_ptr<Presence> presence) {
}
presence->addPayload(capsInfo_);
lastSentPresence_ = presence;
- client_->sendPresence(presence);
+ presenceSender_->sendPresence(presence);
if (presence->getType() == Presence::Unavailable) {
logout();
}
@@ -258,6 +261,7 @@ void MainController::handleLoginRequest(const String &username, const String &pa
void MainController::performLoginFromCachedCredentials() {
if (!client_) {
client_ = new Swift::Client(jid_, password_);
+ presenceSender_ = new PresenceSender(client_);
//client_->onDataRead.connect(&printIncomingData);
//client_->onDataWritten.connect(&printOutgoingData);
if (!certificateFile_.isEmpty()) {
@@ -368,7 +372,7 @@ void MainController::handleChatControllerJIDChanged(const JID& from, const JID&
}
void MainController::handleJoinMUCRequest(const JID &muc, const String &nick) {
- mucControllers_[muc] = new MUCController(jid_, muc, nick, client_, client_, chatWindowFactory_, treeWidgetFactory_, presenceOracle_, avatarManager_);
+ mucControllers_[muc] = new MUCController(jid_, muc, nick, client_, presenceSender_, client_, chatWindowFactory_, treeWidgetFactory_, presenceOracle_, avatarManager_);
mucControllers_[muc]->setAvailableServerFeatures(serverDiscoInfo_);
}
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 270b131..78e49a2 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -33,6 +33,7 @@ namespace Swift {
class NickResolver;
class RosterController;
class XMPPRosterController;
+ class PresenceSender;
class DiscoInfoResponder;
class AvatarManager;
class LoginWindow;
@@ -86,6 +87,7 @@ namespace Swift {
PlatformIdleQuerier idleQuerier_;
ActualIdleDetector idleDetector_;
Client* client_;
+ PresenceSender* presenceSender_;
ChatWindowFactory* chatWindowFactory_;
MainWindowFactory* mainWindowFactory_;
LoginWindowFactory* loginWindowFactory_;