Print text styles in plain text output

This commit is contained in:
AsamK 2023-01-27 21:46:39 +01:00
parent a4f7632981
commit 15da210de7
3 changed files with 58 additions and 3 deletions

View file

@ -177,6 +177,12 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
printMention(writer, mention);
}
}
if (message.textStyles().size() > 0) {
writer.println("Text styles:");
for (var textStyle : message.textStyles()) {
printTextStyle(writer, textStyle);
}
}
if (message.attachments().size() > 0) {
writer.println("Attachments:");
for (var attachment : message.attachments()) {
@ -555,6 +561,12 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
writer.println("- {}: {} (length: {})", formatContact(mention.recipient()), mention.start(), mention.length());
}
private void printTextStyle(
PlainTextWriter writer, MessageEnvelope.Data.TextStyle textStyle
) {
writer.println("- {}: {} (length: {})", textStyle.style().name(), textStyle.start(), textStyle.length());
}
private void printAttachment(PlainTextWriter writer, MessageEnvelope.Data.Attachment attachment) {
writer.println("Content-Type: {}", attachment.contentType());
writer.println("Type: {}", attachment.id().isPresent() ? "Pointer" : "Stream");

View file

@ -778,6 +778,7 @@ public class DbusManagerImpl implements Manager {
Optional.empty(),
List.of(),
List.of(),
List.of(),
List.of())),
Optional.empty(),
Optional.empty(),
@ -852,6 +853,7 @@ public class DbusManagerImpl implements Manager {
Optional.empty(),
List.of(),
List.of(),
List.of(),
List.of())),
Optional.empty())),
Optional.empty(),