import net.pterodactylus.util.thread.NamedThreadFactory;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
/** The start time. */
private final long startupTime = System.currentTimeMillis();
+ private final DebugInformation debugInformation = new DebugInformation();
+
/** The preferences. */
private final Preferences preferences;
return startupTime;
}
+ @Nonnull
+ public DebugInformation getDebugInformation() {
+ return debugInformation;
+ }
+
/**
* Returns the options used by the core.
*
* The text of the post
* @return The created post
*/
- public Post createPost(Sone sone, Optional<Sone> recipient, String text) {
+ public Post createPost(Sone sone, @Nullable Sone recipient, String text) {
checkNotNull(text, "text must not be null");
checkArgument(text.trim().length() > 0, "text must not be empty");
if (!sone.isLocal()) {
}
PostBuilder postBuilder = database.newPostBuilder();
postBuilder.from(sone.getId()).randomId().currentTime().withText(text.trim());
- if (recipient.isPresent()) {
- postBuilder.to(recipient.get().getId());
+ if (recipient != null) {
+ postBuilder.to(recipient.getId());
}
final Post post = postBuilder.build();
database.storePost(post);
configuration.getStringValue(sonePrefix + "/Options/ShowCustomAvatars").setValue(sone.getOptions().getShowCustomAvatars().name());
configuration.getStringValue(sonePrefix + "/Options/LoadLinkedImages").setValue(sone.getOptions().getLoadLinkedImages().name());
- configuration.save();
-
webOfTrustUpdater.setProperty((OwnIdentity) sone.getIdentity(), "Sone.LatestEdition", String.valueOf(sone.getLatestEdition()));
logger.log(Level.INFO, String.format("Sone %s saved.", sone));
*/
@Subscribe
public void imageInsertFinished(ImageInsertFinishedEvent imageInsertFinishedEvent) {
- logger.log(Level.WARNING, String.format("Image insert finished for %s: %s", imageInsertFinishedEvent.image(), imageInsertFinishedEvent.resultingUri()));
- imageInsertFinishedEvent.image().modify().setKey(imageInsertFinishedEvent.resultingUri().toString()).update();
- deleteTemporaryImage(imageInsertFinishedEvent.image().getId());
+ logger.log(Level.WARNING, String.format("Image insert finished for %s: %s", imageInsertFinishedEvent.getImage(), imageInsertFinishedEvent.getResultingUri()));
+ imageInsertFinishedEvent.getImage().modify().setKey(imageInsertFinishedEvent.getResultingUri().toString()).update();
+ deleteTemporaryImage(imageInsertFinishedEvent.getImage().getId());
touchConfiguration();
}