summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2008-02-17 23:46:44 +0000
committerAndrew Resch <andrewresch@gmail.com>2008-02-17 23:46:44 +0000
commitb3950faf9b7f354df44b7272e5380c82034ffddb (patch)
tree84505da6daf215235938ff12174d3a1c42dbd49d
parent5ca14dbfba6267e6dee2f064354395e3f1f44f9d (diff)
downloaddeluge-b3950faf9b7f354df44b7272e5380c82034ffddb.tar.gz
deluge-b3950faf9b7f354df44b7272e5380c82034ffddb.tar.bz2
deluge-b3950faf9b7f354df44b7272e5380c82034ffddb.zip
Expose torrent_paused and torrent_checked alerts.
-rw-r--r--src/deluge_core.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp
index c10298c7f..3373b3283 100644
--- a/src/deluge_core.cpp
+++ b/src/deluge_core.cpp
@@ -95,6 +95,8 @@ using namespace libtorrent;
#define EVENT_BLOCK_FINISHED 17
#define EVENT_PEER_BLOCKED 18
#define EVENT_LISTEN_FAILED 19
+#define EVENT_FINISHED_CHECKING 20
+#define EVENT_TORRENT_PAUSED 21
#define STATE_QUEUED 0
#define STATE_CHECKING 1
@@ -1602,8 +1604,37 @@ std::cout << asctime(timeinfo) << " torrent_pop_event()" << std::endl;
"message", a->msg().c_str());
else
{ 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,
"message", a->msg().c_str() );
}