♻️ Use URI creator in inserter
[Sone.git] / src / main / java / net / pterodactylus / sone / core / Core.java
index 0228951..ce5daa2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - Core.java - Copyright © 2010–2019 David Roden
+ * Sone - Core.java - Copyright © 2010–2020 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -180,24 +180,10 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
        private final MetricRegistry metricRegistry;
        private final Histogram configurationSaveTimeHistogram;
 
-       /**
-        * Creates a new core.
-        *
-        * @param configuration
-        *            The configuration of the core
-        * @param freenetInterface
-        *            The freenet interface
-        * @param identityManager
-        *            The identity manager
-        * @param webOfTrustUpdater
-        *            The WebOfTrust updater
-        * @param eventBus
-        *            The event bus
-        * @param database
-        *            The database
-        */
+       private final SoneUriCreator soneUriCreator;
+
        @Inject
-       public Core(Configuration configuration, FreenetInterface freenetInterface, IdentityManager identityManager, SoneDownloader soneDownloader, ImageInserter imageInserter, UpdateChecker updateChecker, WebOfTrustUpdater webOfTrustUpdater, EventBus eventBus, Database database, MetricRegistry metricRegistry) {
+       public Core(Configuration configuration, FreenetInterface freenetInterface, IdentityManager identityManager, SoneDownloader soneDownloader, ImageInserter imageInserter, UpdateChecker updateChecker, WebOfTrustUpdater webOfTrustUpdater, EventBus eventBus, Database database, MetricRegistry metricRegistry, SoneUriCreator soneUriCreator) {
                super("Sone Core");
                this.configuration = configuration;
                this.freenetInterface = freenetInterface;
@@ -209,6 +195,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                this.eventBus = eventBus;
                this.database = database;
                this.metricRegistry = metricRegistry;
+               this.soneUriCreator = soneUriCreator;
                preferences = new Preferences(eventBus);
                this.configurationSaveTimeHistogram = metricRegistry.histogram("configuration.save.duration", () -> new Histogram(new ExponentiallyDecayingReservoir(3000, 0)));
        }
@@ -626,7 +613,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                sone.setLatestEdition(fromNullable(tryParse(property)).or(0L));
                sone.setClient(new Client("Sone", SonePlugin.getPluginVersion()));
                sone.setKnown(true);
-               SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, metricRegistry, ownIdentity.getId());
+               SoneInserter soneInserter = new SoneInserter(this, eventBus, freenetInterface, metricRegistry, soneUriCreator, ownIdentity.getId());
                soneInserter.insertionDelayChanged(new InsertionDelayChangedEvent(preferences.getInsertionDelay()));
                eventBus.register(soneInserter);
                synchronized (soneInserters) {