added previous state to state_changed_alert. #401

This commit is contained in:
Arvid Norberg 2008-12-01 00:19:05 +00:00
parent ea7715988c
commit 4b738fca7a
3 changed files with 24 additions and 3 deletions

View File

@ -4480,6 +4480,24 @@ upload or download rate performance.
};
state_changed_alert
-------------------
Generated whenever a torrent changes its state.
::
struct state_changed_alert: torrent_alert
{
// ...
torrent_status::state_t state;
torrent_status::state_t prev_state;
};
``state`` is the new state of the torrent. ``prev_state`` is the previous state.
metadata_failed_alert
---------------------

View File

@ -196,9 +196,11 @@ namespace libtorrent
struct TORRENT_EXPORT state_changed_alert: torrent_alert
{
state_changed_alert(torrent_handle const& h
, torrent_status::state_t const& state_)
, torrent_status::state_t state_
, torrent_status::state_t prev_state_)
: torrent_alert(h)
, state(state_)
, prev_state(prev_state_)
{}
virtual std::auto_ptr<alert> clone() const
@ -220,6 +222,7 @@ namespace libtorrent
virtual int category() const { return static_category; }
torrent_status::state_t state;
torrent_status::state_t prev_state;
};
struct TORRENT_EXPORT tracker_error_alert: tracker_alert

View File

@ -4600,9 +4600,9 @@ namespace libtorrent
#endif
if (m_state == s) return;
m_state = s;
if (m_ses.m_alerts.should_post<state_changed_alert>())
m_ses.m_alerts.post_alert(state_changed_alert(get_handle(), s));
m_ses.m_alerts.post_alert(state_changed_alert(get_handle(), s, m_state));
m_state = s;
}
torrent_status torrent::status() const