Expose torrent_paused and torrent_checked alerts.

This commit is contained in:
Andrew Resch 2008-02-17 23:46:44 +00:00
parent 5ca14dbfba
commit b3950faf9b
1 changed files with 32 additions and 1 deletions

View File

@ -95,6 +95,8 @@ using namespace libtorrent;
#define EVENT_BLOCK_FINISHED 17 #define EVENT_BLOCK_FINISHED 17
#define EVENT_PEER_BLOCKED 18 #define EVENT_PEER_BLOCKED 18
#define EVENT_LISTEN_FAILED 19 #define EVENT_LISTEN_FAILED 19
#define EVENT_FINISHED_CHECKING 20
#define EVENT_TORRENT_PAUSED 21
#define STATE_QUEUED 0 #define STATE_QUEUED 0
#define STATE_CHECKING 1 #define STATE_CHECKING 1
@ -1602,8 +1604,37 @@ std::cout << asctime(timeinfo) << " torrent_pop_event()" << std::endl;
"message", a->msg().c_str()); "message", a->msg().c_str());
else else
{ Py_INCREF(Py_None); return Py_None; } { Py_INCREF(Py_None); return Py_None; }
} } else if (dynamic_cast<torrent_checked_alert*>(popped_alert))
{
torrent_handle handle = (dynamic_cast<torrent_checked_alert*>(popped_alert))->handle;
long index = get_torrent_index(handle);
if (PyErr_Occurred())
return NULL;
if (handle_exists(handle))
return Py_BuildValue("{s:i,s:i,s:s}",
"event_type", EVENT_FINISHED_CHECKING,
"unique_ID", M_torrents->at(index).unique_ID,
"message", a->msg().c_str());
else
{ Py_INCREF(Py_None); return Py_None; }
} else if (dynamic_cast<torrent_paused_alert*>(popped_alert))
{
torrent_handle handle = (dynamic_cast<torrent_paused_alert*>(popped_alert))->handle;
long index = get_torrent_index(handle);
if (PyErr_Occurred())
return NULL;
if (handle_exists(handle))
return Py_BuildValue("{s:i,s:i,s:s}",
"event_type", EVENT_TORRENT_PAUSED,
"unique_ID", M_torrents->at(index).unique_ID,
"message", a->msg().c_str());
else
{ Py_INCREF(Py_None); return Py_None; }
}
return Py_BuildValue("{s:i,s:s}", "event_type", EVENT_OTHER, return Py_BuildValue("{s:i,s:s}", "event_type", EVENT_OTHER,
"message", a->msg().c_str() ); "message", a->msg().c_str() );
} }