X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fserver%2FTorrentSession.cpp;h=531cd8371bfdfef7a9b1b1b39002a28bcfed34b9;hb=fdb78d7880be7bc82544e66efd5acb3da74a617a;hp=6158452812359ac08010a600a0c851ae37911327;hpb=f291a99270f6f9ac0f2bd89880a9c27a267a8716;p=qtrapids diff --git a/src/server/TorrentSession.cpp b/src/server/TorrentSession.cpp index 6158452..531cd83 100644 --- a/src/server/TorrentSession.cpp +++ b/src/server/TorrentSession.cpp @@ -58,7 +58,7 @@ namespace qtrapids TorrentState state; state.hash = Hash2QStr(handle.hash()); - state.is_new = false; + state.action = TorrentState::action_update; state.state = handle.state(); state.progress = handle.progress() * torrent_progress_max; state.down_rate = handle.downloadRate(); @@ -83,7 +83,7 @@ namespace qtrapids state.hash = hash; state.name = handle->name(); - state.is_new = true; + state.action = TorrentState::action_add; state.state = handle->state(); state.progress = handle->progress() * torrent_progress_max; state.down_rate = handle->downloadRate(); @@ -123,7 +123,7 @@ namespace qtrapids state.hash = hash; state.name = handle->name(); - state.is_new = true; + state.action = TorrentState::action_add; state.state = handle->state(); state.progress = handle->progress() * torrent_progress_max; state.down_rate = handle->downloadRate(); @@ -140,6 +140,7 @@ namespace qtrapids void TorrentSession::removeTorrent(const QString &hash) { torrents_t::iterator p = torrents_.find(hash); + if (p == torrents_.end()) { qDebug() << "Invalid request to remove torrent with hash " << hash; return; @@ -151,6 +152,12 @@ namespace qtrapids "exception catched" ; } + + TorrentState state; + state.hash = hash; + state.action = TorrentState::action_remove; + emit alert(state, ParamsMap_t()); + torrents_.erase(p); }