Add useful methods
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 13 Jul 2015 17:33:14 +0000 (19:33 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Mon, 13 Jul 2015 17:33:14 +0000 (19:33 +0200)
src/main/java/net/pterodactylus/fcp/ModifyPeer.java

index 8c911b8..f1905e7 100644 (file)
@@ -36,14 +36,34 @@ public class ModifyPeer extends FcpMessage {
                super("ModifyPeer");
                setField("NodeIdentifier", nodeIdentifier);
                if (allowLocalAddresses != null) {
-                       setField("AllowLocalAddresses", String.valueOf(allowLocalAddresses));
+                       setAllowLocalAddresses(allowLocalAddresses);
                }
                if (disabled != null) {
-                       setField("IsDisabled", String.valueOf(disabled));
+                       setEnabled(!disabled);
                }
                if (listenOnly != null) {
-                       setField("IsListenOnly", String.valueOf(listenOnly));
+                       setListenOnly(listenOnly);
                }
        }
 
+       public void setAllowLocalAddresses(boolean allowLocalAddresses) {
+               setField("AllowLocalAddresses", String.valueOf(allowLocalAddresses));
+       }
+
+       public void setEnabled(boolean enabled) {
+               setField("IsDisabled", String.valueOf(!enabled));
+       }
+
+       public void setListenOnly(boolean listenOnly) {
+               setField("IsListenOnly", String.valueOf(listenOnly));
+       }
+
+       public void setBurstOnly(boolean burstOnly) {
+               setField("IsBurstOnly", String.valueOf(burstOnly));
+       }
+
+       public void setIgnoreSource(boolean ignoreSource) {
+               setField("IgnoreSourcePort", String.valueOf(ignoreSource));
+       }
+
 }