✨ Add method to send ModifyConfig request
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sun, 1 Mar 2020 09:36:04 +0000 (10:36 +0100)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sun, 1 Mar 2020 09:36:04 +0000 (10:36 +0100)
src/main/java/net/pterodactylus/fcp/highlevel/FcpClient.java

index 274852a..473fe98 100644 (file)
@@ -59,6 +59,7 @@ import net.pterodactylus.fcp.GetNode;
 import net.pterodactylus.fcp.ListPeerNotes;
 import net.pterodactylus.fcp.ListPeers;
 import net.pterodactylus.fcp.ListPersistentRequests;
+import net.pterodactylus.fcp.ModifyConfig;
 import net.pterodactylus.fcp.ModifyPeer;
 import net.pterodactylus.fcp.ModifyPeerNote;
 import net.pterodactylus.fcp.NodeData;
@@ -1174,6 +1175,22 @@ public class FcpClient implements Closeable {
                return results;
        }
 
+       public void modifyConfig(Map<String, String> options) throws IOException, FcpException {
+               new ExtendedFcpAdapter() {
+                       @Override
+                       public void run() throws IOException {
+                               ModifyConfig modifyConfig = new ModifyConfig();
+                               options.forEach(modifyConfig::setOption);
+                               sendMessage(modifyConfig);
+                       }
+
+                       @Override
+                       public void receivedConfigData(FcpConnection fcpConnection, ConfigData configData) {
+                               complete();
+                       }
+               }.execute();
+       }
+
        //
        // PRIVATE METHODS
        //