Skip to content

Commit

Permalink
Fix bug in tracker message feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Jun 7, 2020
1 parent b08bb9a commit 5f5f237
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion QbtManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@ public static void Main(string[] args)
}
}

private static bool TrackerMsgIsDeletable( Torrent task, Tracker trackerSettings )
{
if (task.trackers == null || trackerSettings.deleteMessages == null )
return false;

var filterMsgs = trackerSettings.deleteMessages;

var torrentMsgs = task.trackers.Where(x => !String.IsNullOrEmpty(x.msg)).Select(x => x.msg);

if (torrentMsgs.Any(x => filterMsgs.Contains(x, StringComparer.OrdinalIgnoreCase)))
return true;

return false;
}

private static void ProcessTorrents(qbtService service, IList<Torrent> tasks, Settings settings )
{
Utils.Log("Processing torrent list...");
Expand All @@ -142,7 +157,7 @@ private static void ProcessTorrents(qbtService service, IList<Torrent> tasks, Se
if (IsDeletable(task, tracker))
keepTask = false;

if (task.trackers != null && task.trackers.Any(x => tracker.deleteMessages.Contains(x.msg, StringComparer.OrdinalIgnoreCase)))
if( TrackerMsgIsDeletable( task, tracker ) )
keepTask = false;
}

Expand Down

0 comments on commit 5f5f237

Please sign in to comment.