added info_hash to torrent_deleted_alert

This commit is contained in:
Arvid Norberg 2010-01-23 16:56:00 +00:00
parent a046850130
commit 2b86528e50
4 changed files with 30 additions and 3 deletions

View File

@ -96,6 +96,7 @@
* improved fallocate support * improved fallocate support
* fixed magnet link issue when using resume data * fixed magnet link issue when using resume data
* support disk I/O priority settings * support disk I/O priority settings
* added info_hash to torrent_deleted_alert
release 0.14.9 release 0.14.9

View File

@ -173,7 +173,9 @@ void bind_alert()
class_<torrent_deleted_alert, bases<torrent_alert>, noncopyable>( class_<torrent_deleted_alert, bases<torrent_alert>, noncopyable>(
"torrent_deleted_alert", no_init "torrent_deleted_alert", no_init
); )
.def_readonly("info_hash", &torrent_deleted_alert::info_hash)
;
class_<torrent_paused_alert, bases<torrent_alert>, noncopyable>( class_<torrent_paused_alert, bases<torrent_alert>, noncopyable>(
"torrent_paused_alert", no_init "torrent_paused_alert", no_init

View File

@ -483,7 +483,8 @@ the tracker that we've stopped participating in the swarm. The optional second a
``options`` can be used to delete all the files downloaded by this torrent. To do this, pass ``options`` can be used to delete all the files downloaded by this torrent. To do this, pass
in the value ``session::delete_files``. The removal of the torrent is asyncronous, there is in the value ``session::delete_files``. The removal of the torrent is asyncronous, there is
no guarantee that adding the same torrent immediately after it was removed will not throw no guarantee that adding the same torrent immediately after it was removed will not throw
a libtorrent_exception_ exception. a libtorrent_exception_ exception. Once the torrent is deleted, a torrent_deleted_alert_
is posted.
find_torrent() get_torrents() find_torrent() get_torrents()
----------------------------- -----------------------------
@ -5547,6 +5548,27 @@ The ``error_code`` tells you why it failed.
error_code error; error_code error;
}; };
torrent_deleted_alert
---------------------
This alert is generated when a request to delete the files of a torrent complete.
The ``info_hash`` is the info-hash of the torrent that was just deleted. Most of
the time the torrent_handle in the torrent_alert_ will be invalid by the time
this alert arrives, since the torrent is being deleted. The ``info_hash`` member
is hence the main way of identifying which torrent just completed the delete.
This alert is posted in the ``storage_notification`` category, and that bit
needs to be set in the alert mask.
::
struct torrent_deleted_alert: torrent_alert
{
// ...
sha1_hash info_hash;
};
torrent_finished_alert torrent_finished_alert
---------------------- ----------------------

View File

@ -669,13 +669,15 @@ namespace libtorrent
{ {
torrent_deleted_alert(torrent_handle const& h) torrent_deleted_alert(torrent_handle const& h)
: torrent_alert(h) : torrent_alert(h)
{} { info_hash = h.info_hash(); }
TORRENT_DEFINE_ALERT(torrent_deleted_alert); TORRENT_DEFINE_ALERT(torrent_deleted_alert);
const static int static_category = alert::storage_notification; const static int static_category = alert::storage_notification;
virtual std::string message() const virtual std::string message() const
{ return torrent_alert::message() + " deleted"; } { return torrent_alert::message() + " deleted"; }
sha1_hash info_hash;
}; };
struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert