implemented storing and loading of message settings
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user