From 446ff20087d5159ab26afefc4117a034690e21bf Mon Sep 17 00:00:00 2001 From: Alon Albert Date: Tue, 2 Jan 2018 10:03:43 +0200 Subject: [PATCH] Force recheck --- .../daemon/Deluge/DelugeDirectAdapter.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/transdroid/daemon/Deluge/DelugeDirectAdapter.java b/app/src/main/java/org/transdroid/daemon/Deluge/DelugeDirectAdapter.java index dbc1a6bb..b7c8a01c 100644 --- a/app/src/main/java/org/transdroid/daemon/Deluge/DelugeDirectAdapter.java +++ b/app/src/main/java/org/transdroid/daemon/Deluge/DelugeDirectAdapter.java @@ -66,6 +66,7 @@ import org.transdroid.daemon.task.DaemonTask; import org.transdroid.daemon.task.DaemonTaskFailureResult; import org.transdroid.daemon.task.DaemonTaskResult; import org.transdroid.daemon.task.DaemonTaskSuccessResult; +import org.transdroid.daemon.task.ForceRecheckTask; import org.transdroid.daemon.task.GetFileListTask; import org.transdroid.daemon.task.GetFileListTaskSuccessResult; import org.transdroid.daemon.task.GetTorrentDetailsTask; @@ -221,12 +222,8 @@ public class DelugeDirectAdapter implements IDaemonAdapter { return doGetTorrentDetails((GetTorrentDetailsTask) task); case SetTrackers: return doSetTrackers((SetTrackersTask) task); - case SetAlternativeMode: - return notSupported(task); - case GetStats: - return notSupported(task); case ForceRecheck: - return notSupported(task); + return doForceRecheck((ForceRecheckTask) task); default: return notSupported(task); } @@ -374,6 +371,12 @@ public class DelugeDirectAdapter implements IDaemonAdapter { return new DaemonTaskSuccessResult(task); } + @NonNull + private DaemonTaskResult doForceRecheck(ForceRecheckTask task) throws DaemonException { + sendRequest(RPC_METHOD_FORCERECHECK, getTorrentIdsArg(task)); + return new DaemonTaskSuccessResult(task); + } + @NonNull private List getTorrents() throws DaemonException { final Map response = (Map) sendRequest( @@ -734,8 +737,9 @@ public class DelugeDirectAdapter implements IDaemonAdapter { return (int) o; } + // Return an Object so it doesn't confuse our varargs sendRequest methods. @NonNull - private String[] getTorrentIdsArg(DaemonTask task) { + private Object getTorrentIdsArg(DaemonTask task) { return new String[]{task.getTargetTorrent().getUniqueID()}; }