implemented storing and loading of message settings

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-01-17 18:27:38 +01:00
parent ea30907bfe
commit b176cd1f6b
6 changed files with 51 additions and 7 deletions
@@ -114,6 +114,7 @@ public class MessageSystem extends BaseHandler implements PostBox, EventListener
var head = path.pop();
return switch (head){
case null -> listMessages(ex,user.get());
case SETTINGS -> getSettings(ex,user.get());
default -> super.doGet(path,ex);
};
} catch (NumberFormatException e){
@@ -142,6 +143,10 @@ public class MessageSystem extends BaseHandler implements PostBox, EventListener
}
}
private boolean getSettings(HttpExchange ex, UmbrellaUser user) throws IOException {
return sendContent(ex,db.getSettings(user));
}
private boolean listMessages(HttpExchange ex, UmbrellaUser user) throws IOException {
var messages = queue.stream().filter(e -> e.isFor(user)).map(e -> summary(e, user.language())).toList();
return sendContent(ex,messages);