|
|
|
@ -35,27 +35,6 @@
@@ -35,27 +35,6 @@
|
|
|
|
|
|
|
|
|
|
namespace |
|
|
|
|
{ |
|
|
|
|
void handleAddTorrentAlert([[maybe_unused]] const lt::add_torrent_alert *alert) |
|
|
|
|
{ |
|
|
|
|
#ifndef QBT_USES_LIBTORRENT2 |
|
|
|
|
if (alert->error) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
// libtorrent < 2.0.7 has a bug that add_torrent_alert is posted too early
|
|
|
|
|
// (before torrent is fully initialized and torrent extensions are created)
|
|
|
|
|
// so we have to fill "extension data" in add_torrent_alert handler
|
|
|
|
|
|
|
|
|
|
// NOTE: `data` may not exist if a torrent is added behind the scenes to download metadata
|
|
|
|
|
auto *data = static_cast<ExtensionData *>(alert->params.userdata); |
|
|
|
|
if (data) |
|
|
|
|
{ |
|
|
|
|
data->status = alert->handle.status({}); |
|
|
|
|
data->trackers = alert->handle.trackers(); |
|
|
|
|
data->urlSeeds = alert->handle.url_seeds(); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void handleFastresumeRejectedAlert(const lt::fastresume_rejected_alert *alert) |
|
|
|
|
{ |
|
|
|
|
alert->handle.unset_flags(lt::torrent_flags::auto_managed); |
|
|
|
@ -91,9 +70,6 @@ void NativeSessionExtension::on_alert(const lt::alert *alert)
@@ -91,9 +70,6 @@ void NativeSessionExtension::on_alert(const lt::alert *alert)
|
|
|
|
|
case lt::session_stats_alert::alert_type: |
|
|
|
|
handleSessionStatsAlert(static_cast<const lt::session_stats_alert *>(alert)); |
|
|
|
|
break; |
|
|
|
|
case lt::add_torrent_alert::alert_type: |
|
|
|
|
handleAddTorrentAlert(static_cast<const lt::add_torrent_alert *>(alert)); |
|
|
|
|
break; |
|
|
|
|
case lt::fastresume_rejected_alert::alert_type: |
|
|
|
|
handleFastresumeRejectedAlert(static_cast<const lt::fastresume_rejected_alert *>(alert)); |
|
|
|
|
break; |
|
|
|
|