diff options
author | Tobias Markmann <tm@ayena.de> | 2015-11-30 08:02:15 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2015-12-17 18:41:04 (GMT) |
commit | 523dbfb769069663eda19e381ad35f466b1ef27c (patch) | |
tree | 0fb00c1655274b8734de517bd1761931eddb5b49 /Swiften | |
parent | 359799239fe61fae51a3a005e588af03a18d8a10 (diff) | |
download | swift-523dbfb769069663eda19e381ad35f466b1ef27c.zip swift-523dbfb769069663eda19e381ad35f466b1ef27c.tar.bz2 |
Show file-transfer description if provided
Test-Information:
Tested by transferring a file between two Swift instances.
Tested in WebKit chat views and in plain chat views.
Change-Id: Ie46cbd7bac8a36478f64b4557cf55926e6d4af37
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/FileTransfer/FileTransfer.cpp | 3 | ||||
-rw-r--r-- | Swiften/FileTransfer/FileTransfer.h | 7 | ||||
-rw-r--r-- | Swiften/FileTransfer/IncomingJingleFileTransfer.cpp | 2 | ||||
-rw-r--r-- | Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp | 2 |
4 files changed, 10 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/FileTransfer.cpp b/Swiften/FileTransfer/FileTransfer.cpp index f63a4e8..4782d39 100644 --- a/Swiften/FileTransfer/FileTransfer.cpp +++ b/Swiften/FileTransfer/FileTransfer.cpp @@ -19,7 +19,8 @@ void FileTransfer::setState(const State& state) { onStateChanged(state); } -void FileTransfer::setFileInfo(const std::string& name, boost::uintmax_t size) { +void FileTransfer::setFileInfo(const std::string& name, boost::uintmax_t size, const std::string& description) { filename_ = name; fileSizeInBytes_ = size; + description_ = description; } diff --git a/Swiften/FileTransfer/FileTransfer.h b/Swiften/FileTransfer/FileTransfer.h index afb3f7b..ab8e806 100644 --- a/Swiften/FileTransfer/FileTransfer.h +++ b/Swiften/FileTransfer/FileTransfer.h @@ -66,6 +66,10 @@ namespace Swift { return state_; } + const std::string& getDescription() const { + return description_; + } + public: boost::signal<void (size_t /* proccessedBytes */)> onProcessedBytes; boost::signal<void (const State&)> onStateChanged; @@ -73,11 +77,12 @@ namespace Swift { protected: void setState(const State& state); - void setFileInfo(const std::string& name, boost::uintmax_t size); + void setFileInfo(const std::string& name, boost::uintmax_t size, const std::string& description); private: boost::uintmax_t fileSizeInBytes_; std::string filename_; + std::string description_; State state_; }; } diff --git a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp index 39da46f..01bed78 100644 --- a/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp +++ b/Swiften/FileTransfer/IncomingJingleFileTransfer.cpp @@ -47,7 +47,7 @@ IncomingJingleFileTransfer::IncomingJingleFileTransfer( description = initialContent->getDescription<JingleFileTransferDescription>(); assert(description); JingleFileTransferFileInfo fileInfo = description->getFileInfo(); - setFileInfo(fileInfo.getName(), fileInfo.getSize()); + setFileInfo(fileInfo.getName(), fileInfo.getSize(), fileInfo.getDescription()); hashes = fileInfo.getHashes(); waitOnHashTimer = timerFactory->createTimer(5000); diff --git a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp index 6369581..b8e848c 100644 --- a/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp +++ b/Swiften/FileTransfer/OutgoingJingleFileTransfer.cpp @@ -62,7 +62,7 @@ OutgoingJingleFileTransfer::OutgoingJingleFileTransfer( state(Initial), candidateAcknowledged(false) { - setFileInfo(fileInfo.getName(), fileInfo.getSize()); + setFileInfo(fileInfo.getName(), fileInfo.getSize(), fileInfo.getDescription()); // calculate both, MD5 and SHA-1 since we don't know which one the other side supports hashCalculator = new IncrementalBytestreamHashCalculator(true, true, crypto); |