From 3d09f579d0bbee01994ef80474d1680bfe652d26 Mon Sep 17 00:00:00 2001 From: "Vladimir Golovnev (Glassez)" Date: Wed, 17 Jun 2015 11:21:41 +0300 Subject: [PATCH] Fix torrent creation date loss. --- src/core/bittorrent/torrenthandle.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/core/bittorrent/torrenthandle.cpp b/src/core/bittorrent/torrenthandle.cpp index 4911e7f95..7337431fe 100644 --- a/src/core/bittorrent/torrenthandle.cpp +++ b/src/core/bittorrent/torrenthandle.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #ifdef Q_OS_WIN @@ -1258,15 +1259,8 @@ bool TorrentHandle::saveTorrentFile(const QString &path) { if (!m_torrentInfo.isValid()) return false; - // TODO: Use libtorrent::create_torrent() here! - - libt::entry meta = libt::bdecode(m_torrentInfo.metadata().data(), - m_torrentInfo.metadata().data() + m_torrentInfo.metadata().size()); - libt::entry torrentEntry(libt::entry::dictionary_t); - torrentEntry["info"] = meta; - QList trackers = m_torrentInfo.trackers(); - if (!trackers.isEmpty()) - torrentEntry["announce"] = trackers.first().nativeEntry().url; + libt::create_torrent torrentCreator(*(m_torrentInfo.nativeInfo())); + libt::entry torrentEntry = torrentCreator.generate(); QVector out; libt::bencode(std::back_inserter(out), torrentEntry);