diff options
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 11 | ||||
-rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferController.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferController.h | 4 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/ChatWindow.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/UnitTest/MockChatWindow.h | 4 |
5 files changed, 19 insertions, 10 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index d1cd1fe..9cef9fc 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -13,6 +13,7 @@ #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/Algorithm.h> #include <Swiften/Base/Log.h> +#include <Swiften/Base/Path.h> #include <Swiften/Base/format.h> #include <Swiften/Chat/ChatStateNotifier.h> #include <Swiften/Chat/ChatStateTracker.h> @@ -368,7 +369,15 @@ void ChatController::setOnline(bool online) { void ChatController::handleNewFileTransferController(FileTransferController* ftc) { std::string nick = senderDisplayNameFromMessage(ftc->getOtherParty()); - std::string ftID = ftc->setChatWindow(chatWindow_, nick); + std::string avatarPath; + if (ftc->isIncoming()) { + avatarPath = pathToString(avatarManager_->getAvatarPath(ftc->getOtherParty())); + } + else { + avatarPath = pathToString(avatarManager_->getAvatarPath(selfJID_)); + } + + std::string ftID = ftc->setChatWindow(chatWindow_, nick, avatarPath); ftControllers[ftID] = ftc; lastWasPresence_ = false; diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index 65c2892..27e9dbf 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -47,12 +47,12 @@ const JID &FileTransferController::getOtherParty() const { return otherParty; } -std::string FileTransferController::setChatWindow(ChatWindow* wnd, std::string nickname) { +std::string FileTransferController::setChatWindow(ChatWindow* wnd, const std::string& nickname, const std::string& avatarPath) { chatWindow = wnd; if (sending) { - uiID = wnd->addFileTransfer(QT_TRANSLATE_NOOP("", "me"), true, filename, boost::filesystem::file_size(boost::filesystem::path(filename)), ""); + uiID = wnd->addFileTransfer(QT_TRANSLATE_NOOP("", "me"), avatarPath, true, filename, boost::filesystem::file_size(boost::filesystem::path(filename)), ""); } else { - uiID = wnd->addFileTransfer(nickname, false, filename, transfer->getFileSizeInBytes(), transfer->getDescription()); + uiID = wnd->addFileTransfer(nickname, avatarPath, false, filename, transfer->getFileSizeInBytes(), transfer->getDescription()); } return uiID; } diff --git a/Swift/Controllers/FileTransfer/FileTransferController.h b/Swift/Controllers/FileTransfer/FileTransferController.h index 38dde0e..e36cac8 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.h +++ b/Swift/Controllers/FileTransfer/FileTransferController.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2015-2016 Isode Limited. + * Copyright (c) 2015-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -43,7 +43,7 @@ public: FileTransferController(IncomingFileTransfer::ref transfer); ~FileTransferController(); - std::string setChatWindow(ChatWindow*, std::string nickname); + std::string setChatWindow(ChatWindow*, const std::string& nickname, const std::string& avatarPath); void setReceipient(const JID& otherParty); void start(std::string& description); diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index 7aaa90e..f9c4164 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -180,7 +180,7 @@ namespace Swift { virtual void replaceWithAction(const ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time) = 0; // File transfer related stuff - virtual std::string addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) = 0; + virtual std::string addFileTransfer(const std::string& senderName, const std::string& avatarPath, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes, const std::string& description) = 0; virtual void setFileTransferProgress(std::string, const int percentageDone) = 0; virtual void setFileTransferStatus(std::string, const FileTransferState state, const std::string& msg = "") = 0; virtual void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct = true, bool isImpromptu = false, bool isContinuation = false) = 0; diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index 76e5194..84c86fc 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2016 Isode Limited. + * Copyright (c) 2010-2017 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -53,7 +53,7 @@ namespace Swift { } // File transfer related stuff - virtual std::string addFileTransfer(const std::string& /*senderName*/, bool /*senderIsSelf*/,const std::string& /*filename*/, const boost::uintmax_t /*sizeInBytes*/, const std::string& /*description*/) { return nullptr; } + virtual std::string addFileTransfer(const std::string& /*senderName*/, const std::string& /*avatarPath*/, bool /*senderIsSelf*/,const std::string& /*filename*/, const boost::uintmax_t /*sizeInBytes*/, const std::string& /*description*/) { return nullptr; } virtual void setFileTransferProgress(std::string /*id*/, const int /*alreadyTransferedBytes*/) { } virtual void setFileTransferStatus(std::string /*id*/, const FileTransferState /*state*/, const std::string& /*msg*/) { } |