From 3ea075f169d0dc201a330ca5c02b4f96a374e4ee Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 8 Jun 2008 05:14:40 +0000 Subject: [PATCH] Add torrent_resumed alert --- bindings/python/src/alert.cpp | 4 ++++ include/libtorrent/alert_types.hpp | 9 +++++++++ src/torrent.cpp | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index 397071e21..85a4fae2f 100755 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -271,4 +271,8 @@ void bind_alert() ) .def_readonly("name", &file_renamed_alert::name) ; + + class_, noncopyable>( + "torrent_resumed_alert", no_init + ); } diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 042ec1683..1fc8116ff 100755 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -544,6 +544,15 @@ namespace libtorrent { return std::auto_ptr(new peer_blocked_alert(*this)); } }; + struct TORRENT_EXPORT torrent_resumed_alert: torrent_alert + { + torrent_resumed_alert(torrent_handle const& h, std::string const& msg) + : torrent_alert(h, alert::warning, msg) + {} + + virtual std::auto_ptr clone() const + { return std::auto_ptr(new torrent_resumed_alert(*this)); } + }; } diff --git a/src/torrent.cpp b/src/torrent.cpp index e5a5d721b..8980879cb 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3686,6 +3686,11 @@ namespace libtorrent m_started = time_now(); m_error.clear(); + if (alerts().should_post(alert::warning)) + { + alerts().post_alert(torrent_resumed_alert(get_handle(), "torrent resumed")); + } + // tell the tracker that we're back m_event = tracker_request::started; force_tracker_request();