/** The configuration. */
private Configuration configuration;
+ /** Whether we’re currently saving the configuration. */
+ private boolean storingConfiguration = false;
+
/** The identity manager. */
private final IdentityManager identityManager;
/**
* Saves the current options.
*/
- public synchronized void saveConfiguration() {
+ public void saveConfiguration() {
+ synchronized (configuration) {
+ if (storingConfiguration) {
+ logger.log(Level.FINE, "Already storing configuration…");
+ return;
+ }
+ storingConfiguration = true;
+ }
+
/* store the options first. */
try {
configuration.getIntValue("Option/InsertionDelay").setValue(options.getIntegerOption("InsertionDelay").getReal());
} catch (ConfigurationException ce1) {
logger.log(Level.SEVERE, "Could not store configuration!", ce1);
+ } finally {
+ synchronized (configuration) {
+ storingConfiguration = false;
+ }
}
}
@Override
protected void processTemplate(Request request, Template template) throws RedirectException {
super.processTemplate(request, template);
- Sone sone = getCurrentSone(request.getToadletContext());
+ Sone currentSone = getCurrentSone(request.getToadletContext());
List<Post> allPosts = new ArrayList<Post>();
- allPosts.addAll(sone.getPosts());
- for (String friendSoneId : sone.getFriends()) {
+ allPosts.addAll(currentSone.getPosts());
+ for (String friendSoneId : currentSone.getFriends()) {
if (!webInterface.getCore().hasSone(friendSoneId)) {
continue;
}
allPosts.addAll(webInterface.getCore().getSone(friendSoneId).getPosts());
}
+ for (Sone sone : webInterface.getCore().getSones()) {
+ for (Post post : sone.getPosts()) {
+ if (currentSone.equals(post.getRecipient()) && !allPosts.contains(post)) {
+ allPosts.add(post);
+ }
+ }
+ }
Collections.sort(allPosts, Post.TIME_COMPARATOR);
template.set("posts", allPosts);
}
getTranslation("WebInterface.DefaultText.StatusUpdate", function(defaultText) {
registerInputTextareaSwap("#sone #update-status .status-input", defaultText, "text", false, false);
$("#sone #update-status").submit(function() {
+ if ($(this).find(":input").hasClass("default")) {
+ return false;
+ }
text = $(this).find(":input:enabled").val();
$.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "text": text }, function(data, textStatus) {
if ((data != null) && data.success) {