2 * jFCPlib - SubscribeUSK.java - Copyright © 2008–2016 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.fcp;
21 * With a “SubscribeUSK” a client requests to be notified if the edition number
24 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
26 public class SubscribeUSK extends FcpMessage implements Identifiable {
28 public SubscribeUSK(String identifier) {
29 super("SubscribeUSK");
30 setField("Identifier", identifier);
33 public SubscribeUSK(String uri, String identifier) {
39 public String getIdentifier() {
40 return getField("Identifier");
43 public String getUri() {
44 return getField("URI");
47 public void setUri(String uri) {
51 public boolean isActive() {
52 return !Boolean.parseBoolean(getField("DontPoll"));
56 * Sets whether updates for the USK are actively searched.
59 * <code>true</code> to actively search for newer editions,
60 * <code>false</code> to only watch for newer editions that are
61 * found from other requests
63 public void setActive(boolean active) {
64 setField("DontPoll", String.valueOf(!active));
67 public boolean isSparse() {
68 return Boolean.valueOf(getField("SparsePoll"));
71 public void setSparse(boolean sparse) {
72 setField("SparsePoll", String.valueOf(sparse));
75 public Priority getPriority() {
76 String priorityClass = getField("PriorityClass");
77 if (priorityClass != null) {
78 return Priority.valueOf(priorityClass);
80 return Priority.bulkSplitfile;
83 public void setPriority(Priority priority) {
84 setField("PriorityClass", priority.toString());
87 public Priority getActivePriority() {
88 String priorityClass = getField("PriorityClassProgress");
89 if (priorityClass != null) {
90 return Priority.valueOf(priorityClass);
92 return Priority.update;
95 public void setActivePriority(Priority activePriority) {
96 setField("PriorityClassProgress", activePriority.toString());
99 public boolean isRealTime() {
100 return Boolean.valueOf(getField("RealTimeFlag"));
103 public void setRealTime(boolean realTime) {
104 setField("RealTimeFlag", String.valueOf(realTime));
107 public boolean isIgnoreDateHints() {
108 return Boolean.valueOf(getField("IgnoreUSKDatehints"));
111 public void setIgnoreDateHints(boolean ignoreDateHints) {
112 setField("IgnoreUSKDatehints", String.valueOf(ignoreDateHints));