kget: fix build with libtorrent older than v1.2.0

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-02 13:55:20 +03:00
parent 4ebc0e2473
commit 811d387b31

View file

@ -28,12 +28,15 @@
#include <boost/make_shared.hpp>
#include <libtorrent/add_torrent_params.hpp>
#include <libtorrent/write_resume_data.hpp>
#include <libtorrent/alert_types.hpp>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/announce_entry.hpp>
#include <libtorrent/magnet_uri.hpp>
#if LIBTORRENT_VERSION_MAJOR >= 1 && LIBTORRENT_VERSION_MINOR >= 2
# include <libtorrent/write_resume_data.hpp>
#endif
// NOTE: error_code comparison is bogus and breaks translatelterror() too,
// possibly silently fixed via:
// https://github.com/boostorg/system/commit/2fa0a00583a3a791092568d2ade793314181926e
@ -897,10 +900,12 @@ void TransferTorrent::timerEvent(QTimerEvent *event)
} else if (lt::alert_cast<lt::save_resume_data_alert>(ltalert)) {
kDebug(5001) << "save resume data alert";
#if LIBTORRENT_VERSION_MAJOR >= 1 && LIBTORRENT_VERSION_MINOR >= 2
const lt::save_resume_data_alert* ltresumealert = lt::alert_cast<lt::save_resume_data_alert>(ltalert);
if (ltresumealert) {
m_ltresumedata = lt::write_resume_data_buf(ltresumealert->params);
}
#endif
} else if (lt::alert_cast<lt::torrent_error_alert>(ltalert)) {
kError(5001) << ltalert->message().c_str();