From 2bc91fba3e7e73d4e95cdbd29f9ca20dd3edcb65 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Fri, 28 Jun 2019 20:22:14 +0800 Subject: [PATCH] Use newer libtorrent API --- src/base/bittorrent/torrenthandle.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 986c6dae2..f65b3b0c7 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -45,6 +45,10 @@ #include #include +#if (LIBTORRENT_VERSION_NUM >= 10200) +#include +#endif + #include #include #include @@ -1689,10 +1693,17 @@ void TorrentHandle::handleTorrentResumedAlert(const lt::torrent_resumed_alert *p void TorrentHandle::handleSaveResumeDataAlert(const lt::save_resume_data_alert *p) { +#if (LIBTORRENT_VERSION_NUM < 10200) const bool useDummyResumeData = !(p && p->resume_data); lt::entry dummyEntry; lt::entry &resumeData = useDummyResumeData ? dummyEntry : *(p->resume_data); +#else + const bool useDummyResumeData = !p; + + lt::entry resumeData = useDummyResumeData ? lt::entry() : lt::write_resume_data(p->params); +#endif + if (useDummyResumeData) { resumeData["qBt-magnetUri"] = toMagnetUri().toStdString(); resumeData["qBt-paused"] = isPaused();