diff options
-rw-r--r-- | Swift/Controllers/ChatController.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/ChatController.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/ChatControllerBase.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/ChatControllerBase.h | 3 | ||||
-rw-r--r-- | Swift/Controllers/MUCController.cpp | 3 | ||||
-rw-r--r-- | Swift/Controllers/MUCController.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/MainController.cpp | 4 |
7 files changed, 13 insertions, 10 deletions
diff --git a/Swift/Controllers/ChatController.cpp b/Swift/Controllers/ChatController.cpp index 5fee3d2..a8b8ab1 100644 --- a/Swift/Controllers/ChatController.cpp +++ b/Swift/Controllers/ChatController.cpp @@ -1,5 +1,6 @@ #include "Swift/Controllers/ChatController.h" +#include "Swiften/Avatars/AvatarManager.h" #include "Swift/Controllers/ChatWindow.h" #include "Swift/Controllers/ChatWindowFactory.h" #include "Swift/Controllers/NickResolver.h" @@ -9,8 +10,8 @@ namespace Swift { /** * The controller does not gain ownership of the stanzaChannel, nor the factory. */ -ChatController::ChatController(StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager) - : ChatControllerBase(stanzaChannel, iqRouter, chatWindowFactory, contact, presenceOracle, avatarManager) { +ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager) + : ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, contact, presenceOracle, avatarManager) { nickResolver_ = nickResolver; } @@ -28,7 +29,7 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<Message> message } void ChatController::postSendMessage(const String& body) { - chatWindow_->addMessage(body, "me", true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel() : boost::optional<SecurityLabel>(), ""); + chatWindow_->addMessage(body, "me", true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel() : boost::optional<SecurityLabel>(), String(avatarManager_->getAvatarPath(selfJID_).string())); } String ChatController::senderDisplayNameFromMessage(const JID& from) { diff --git a/Swift/Controllers/ChatController.h b/Swift/Controllers/ChatController.h index 8168510..ea870b7 100644 --- a/Swift/Controllers/ChatController.h +++ b/Swift/Controllers/ChatController.h @@ -8,7 +8,7 @@ namespace Swift { class NickResolver; class ChatController : public ChatControllerBase { public: - ChatController(StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager*); + ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager*); //boost::signal<void (const JID&, const JID&)> onJIDChanged; diff --git a/Swift/Controllers/ChatControllerBase.cpp b/Swift/Controllers/ChatControllerBase.cpp index 91d088e..cab2361 100644 --- a/Swift/Controllers/ChatControllerBase.cpp +++ b/Swift/Controllers/ChatControllerBase.cpp @@ -12,7 +12,7 @@ namespace Swift { -ChatControllerBase::ChatControllerBase(StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager) : stanzaChannel_(stanzaChannel), iqRouter_(iqRouter), chatWindowFactory_(chatWindowFactory), toJID_(toJID), labelsEnabled_(false), presenceOracle_(presenceOracle), avatarManager_(avatarManager) { +ChatControllerBase::ChatControllerBase(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager) : selfJID_(self), stanzaChannel_(stanzaChannel), iqRouter_(iqRouter), chatWindowFactory_(chatWindowFactory), toJID_(toJID), labelsEnabled_(false), presenceOracle_(presenceOracle), avatarManager_(avatarManager) { chatWindow_ = chatWindowFactory_->createChatWindow(toJID); chatWindow_->onAllMessagesRead.connect(boost::bind(&ChatControllerBase::handleAllMessagesRead, this)); chatWindow_->onSendMessageRequest.connect(boost::bind(&ChatControllerBase::handleSendMessageRequest, this, _1)); diff --git a/Swift/Controllers/ChatControllerBase.h b/Swift/Controllers/ChatControllerBase.h index 5a322d2..b849c2b 100644 --- a/Swift/Controllers/ChatControllerBase.h +++ b/Swift/Controllers/ChatControllerBase.h @@ -30,7 +30,7 @@ namespace Swift { void handleIncomingMessage(boost::shared_ptr<MessageEvent> message); protected: - ChatControllerBase(StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager); + ChatControllerBase(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager); virtual void postSendMessage(const String&) {}; virtual String senderDisplayNameFromMessage(const JID& from) = 0; @@ -47,6 +47,7 @@ namespace Swift { String getErrorMessage(boost::shared_ptr<Error>); protected: + JID selfJID_; std::vector<boost::shared_ptr<MessageEvent> > unreadMessages_; StanzaChannel* stanzaChannel_; IQRouter* iqRouter_; diff --git a/Swift/Controllers/MUCController.cpp b/Swift/Controllers/MUCController.cpp index e3615d9..37389a2 100644 --- a/Swift/Controllers/MUCController.cpp +++ b/Swift/Controllers/MUCController.cpp @@ -17,6 +17,7 @@ namespace Swift { * The controller does not gain ownership of the stanzaChannel, nor the factory. */ MUCController::MUCController ( + const JID& self, const JID &muc, const String &nick, StanzaChannel* stanzaChannel, @@ -25,7 +26,7 @@ MUCController::MUCController ( TreeWidgetFactory *treeWidgetFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager) : - ChatControllerBase(stanzaChannel, iqRouter, chatWindowFactory, muc, presenceOracle, avatarManager), + ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, muc, presenceOracle, avatarManager), muc_(new MUC(stanzaChannel, muc)), nick_(nick), treeWidgetFactory_(treeWidgetFactory) { diff --git a/Swift/Controllers/MUCController.h b/Swift/Controllers/MUCController.h index 77335da..af4a23a 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 &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, 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 6f1e02b..63b55af 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -248,7 +248,7 @@ ChatController* MainController::getChatController(const JID &contact) { lookupContact = JID(contact.toBare()); } if (chatControllers_.find(lookupContact) == chatControllers_.end()) { - chatControllers_[contact] = new ChatController(client_, client_, chatWindowFactory_, contact, nickResolver_, presenceOracle_, avatarManager_); + chatControllers_[contact] = new ChatController(jid_, client_, client_, chatWindowFactory_, contact, nickResolver_, presenceOracle_, avatarManager_); chatControllers_[contact]->setAvailableServerFeatures(serverDiscoInfo_); lookupContact = contact; } @@ -261,7 +261,7 @@ void MainController::handleChatControllerJIDChanged(const JID& from, const JID& } void MainController::handleJoinMUCRequest(const JID &muc, const String &nick) { - mucControllers_[muc] = new MUCController(muc, nick, client_, client_, chatWindowFactory_, treeWidgetFactory_, presenceOracle_, avatarManager_); + mucControllers_[muc] = new MUCController(jid_, muc, nick, client_, client_, chatWindowFactory_, treeWidgetFactory_, presenceOracle_, avatarManager_); mucControllers_[muc]->setAvailableServerFeatures(serverDiscoInfo_); } |