|
|
@ -2144,77 +2144,79 @@ void QBtSession::readAlerts() { |
|
|
|
|
|
|
|
|
|
|
|
void QBtSession::handleAlert(libtorrent::alert* a) { |
|
|
|
void QBtSession::handleAlert(libtorrent::alert* a) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (torrent_finished_alert* p = dynamic_cast<torrent_finished_alert*>(a)) { |
|
|
|
switch (a->type()) { |
|
|
|
handleTorrentFinishedAlert(p); |
|
|
|
case torrent_finished_alert::alert_type: |
|
|
|
} |
|
|
|
handleTorrentFinishedAlert(static_cast<torrent_finished_alert*>(a)); |
|
|
|
else if (save_resume_data_alert* p = dynamic_cast<save_resume_data_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleSaveResumeDataAlert(p); |
|
|
|
case save_resume_data_alert::alert_type: |
|
|
|
} |
|
|
|
handleSaveResumeDataAlert(static_cast<save_resume_data_alert*>(a)); |
|
|
|
else if (file_renamed_alert* p = dynamic_cast<file_renamed_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleFileRenamedAlert(p); |
|
|
|
case file_renamed_alert::alert_type: |
|
|
|
} |
|
|
|
handleFileRenamedAlert(static_cast<file_renamed_alert*>(a)); |
|
|
|
else if (torrent_deleted_alert* p = dynamic_cast<torrent_deleted_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleTorrentDeletedAlert(p); |
|
|
|
case torrent_deleted_alert::alert_type: |
|
|
|
} |
|
|
|
handleTorrentDeletedAlert(static_cast<torrent_deleted_alert*>(a)); |
|
|
|
else if (storage_moved_alert* p = dynamic_cast<storage_moved_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleStorageMovedAlert(p); |
|
|
|
case storage_moved_alert::alert_type: |
|
|
|
} |
|
|
|
handleStorageMovedAlert(static_cast<storage_moved_alert*>(a)); |
|
|
|
else if (metadata_received_alert* p = dynamic_cast<metadata_received_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleMetadataReceivedAlert(p); |
|
|
|
case metadata_received_alert::alert_type: |
|
|
|
} |
|
|
|
handleMetadataReceivedAlert(static_cast<metadata_received_alert*>(a)); |
|
|
|
else if (file_error_alert* p = dynamic_cast<file_error_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleFileErrorAlert(p); |
|
|
|
case file_error_alert::alert_type: |
|
|
|
} |
|
|
|
handleFileErrorAlert(static_cast<file_error_alert*>(a)); |
|
|
|
else if (file_completed_alert* p = dynamic_cast<file_completed_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleFileCompletedAlert(p); |
|
|
|
case file_completed_alert::alert_type: |
|
|
|
} |
|
|
|
handleFileCompletedAlert(static_cast<file_completed_alert*>(a)); |
|
|
|
else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleTorrentPausedAlert(p); |
|
|
|
case torrent_paused_alert::alert_type: |
|
|
|
} |
|
|
|
handleTorrentPausedAlert(static_cast<torrent_paused_alert*>(a)); |
|
|
|
else if (tracker_error_alert* p = dynamic_cast<tracker_error_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleTrackerErrorAlert(p); |
|
|
|
case tracker_error_alert::alert_type: |
|
|
|
} |
|
|
|
handleTrackerErrorAlert(static_cast<tracker_error_alert*>(a)); |
|
|
|
else if (tracker_reply_alert* p = dynamic_cast<tracker_reply_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleTrackerReplyAlert(p); |
|
|
|
case tracker_reply_alert::alert_type: |
|
|
|
} |
|
|
|
handleTrackerReplyAlert(static_cast<tracker_reply_alert*>(a)); |
|
|
|
else if (tracker_warning_alert* p = dynamic_cast<tracker_warning_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleTrackerWarningAlert(p); |
|
|
|
case tracker_warning_alert::alert_type: |
|
|
|
} |
|
|
|
handleTrackerWarningAlert(static_cast<tracker_warning_alert*>(a)); |
|
|
|
else if (portmap_error_alert* p = dynamic_cast<portmap_error_alert*>(a)) { |
|
|
|
break; |
|
|
|
handlePortmapWarningAlert(p); |
|
|
|
case portmap_error_alert::alert_type: |
|
|
|
} |
|
|
|
handlePortmapWarningAlert(static_cast<portmap_error_alert*>(a)); |
|
|
|
else if (portmap_alert* p = dynamic_cast<portmap_alert*>(a)) { |
|
|
|
break; |
|
|
|
handlePortmapAlert(p); |
|
|
|
case portmap_alert::alert_type: |
|
|
|
} |
|
|
|
handlePortmapAlert(static_cast<portmap_alert*>(a)); |
|
|
|
else if (peer_blocked_alert* p = dynamic_cast<peer_blocked_alert*>(a)) { |
|
|
|
break; |
|
|
|
handlePeerBlockedAlert(p); |
|
|
|
case peer_blocked_alert::alert_type: |
|
|
|
} |
|
|
|
handlePeerBlockedAlert(static_cast<peer_blocked_alert*>(a)); |
|
|
|
else if (peer_ban_alert* p = dynamic_cast<peer_ban_alert*>(a)) { |
|
|
|
break; |
|
|
|
handlePeerBanAlert(p); |
|
|
|
case peer_ban_alert::alert_type: |
|
|
|
} |
|
|
|
handlePeerBanAlert(static_cast<peer_ban_alert*>(a)); |
|
|
|
else if (fastresume_rejected_alert* p = dynamic_cast<fastresume_rejected_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleFastResumeRejectedAlert(p); |
|
|
|
case fastresume_rejected_alert::alert_type: |
|
|
|
} |
|
|
|
handleFastResumeRejectedAlert(static_cast<fastresume_rejected_alert*>(a)); |
|
|
|
else if (url_seed_alert* p = dynamic_cast<url_seed_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleUrlSeedAlert(p); |
|
|
|
case url_seed_alert::alert_type: |
|
|
|
} |
|
|
|
handleUrlSeedAlert(static_cast<url_seed_alert*>(a)); |
|
|
|
else if (listen_succeeded_alert *p = dynamic_cast<listen_succeeded_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleListenSucceededAlert(p); |
|
|
|
case listen_succeeded_alert::alert_type: |
|
|
|
} |
|
|
|
handleListenSucceededAlert(static_cast<listen_succeeded_alert*>(a)); |
|
|
|
else if (listen_failed_alert *p = dynamic_cast<listen_failed_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleListenFailedAlert(p); |
|
|
|
case listen_failed_alert::alert_type: |
|
|
|
} |
|
|
|
handleListenFailedAlert(static_cast<listen_failed_alert*>(a)); |
|
|
|
else if (torrent_checked_alert* p = dynamic_cast<torrent_checked_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleTorrentCheckedAlert(p); |
|
|
|
case torrent_checked_alert::alert_type: |
|
|
|
} |
|
|
|
handleTorrentCheckedAlert(static_cast<torrent_checked_alert*>(a)); |
|
|
|
else if (external_ip_alert *p = dynamic_cast<external_ip_alert*>(a)) { |
|
|
|
break; |
|
|
|
handleExternalIPAlert(p); |
|
|
|
case external_ip_alert::alert_type: |
|
|
|
} |
|
|
|
handleExternalIPAlert(static_cast<external_ip_alert*>(a)); |
|
|
|
else if (state_update_alert *p = dynamic_cast<state_update_alert *>(a)) { |
|
|
|
break; |
|
|
|
handleStateUpdateAlert(p); |
|
|
|
case state_update_alert::alert_type: |
|
|
|
} |
|
|
|
handleStateUpdateAlert(static_cast<state_update_alert*>(a)); |
|
|
|
else if (stats_alert *p = dynamic_cast<stats_alert *>(a)) { |
|
|
|
break; |
|
|
|
handleStatsAlert(p); |
|
|
|
case stats_alert::alert_type: |
|
|
|
|
|
|
|
handleStatsAlert(static_cast<stats_alert*>(a)); |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (const std::exception& e) { |
|
|
|
} catch (const std::exception& e) { |
|
|
|
qWarning() << "Caught exception in readAlerts(): " << e.what(); |
|
|
|
qWarning() << "Caught exception in readAlerts(): " << e.what(); |
|
|
|