forked from premiere/premiere-libtorrent
added previous state to state_changed_alert. #401
This commit is contained in:
parent
ea7715988c
commit
4b738fca7a
|
@ -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
|
metadata_failed_alert
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -196,9 +196,11 @@ namespace libtorrent
|
||||||
struct TORRENT_EXPORT state_changed_alert: torrent_alert
|
struct TORRENT_EXPORT state_changed_alert: torrent_alert
|
||||||
{
|
{
|
||||||
state_changed_alert(torrent_handle const& h
|
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)
|
: torrent_alert(h)
|
||||||
, state(state_)
|
, state(state_)
|
||||||
|
, prev_state(prev_state_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual std::auto_ptr<alert> clone() const
|
virtual std::auto_ptr<alert> clone() const
|
||||||
|
@ -220,6 +222,7 @@ namespace libtorrent
|
||||||
virtual int category() const { return static_category; }
|
virtual int category() const { return static_category; }
|
||||||
|
|
||||||
torrent_status::state_t state;
|
torrent_status::state_t state;
|
||||||
|
torrent_status::state_t prev_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TORRENT_EXPORT tracker_error_alert: tracker_alert
|
struct TORRENT_EXPORT tracker_error_alert: tracker_alert
|
||||||
|
|
|
@ -4600,9 +4600,9 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_state == s) return;
|
if (m_state == s) return;
|
||||||
m_state = s;
|
|
||||||
if (m_ses.m_alerts.should_post<state_changed_alert>())
|
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
|
torrent_status torrent::status() const
|
||||||
|
|
Loading…
Reference in New Issue