mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Refactor output writers
This commit is contained in:
parent
f449a242e4
commit
48b2c7ff8a
42 changed files with 327 additions and 187 deletions
|
@ -29,15 +29,15 @@ import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
|||
public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
||||
|
||||
final Manager m;
|
||||
final PlainTextWriter writer;
|
||||
|
||||
public ReceiveMessageHandler(Manager m) {
|
||||
public ReceiveMessageHandler(Manager m, final PlainTextWriter writer) {
|
||||
this.m = m;
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, Throwable exception) {
|
||||
PlainTextWriter writer = new PlainTextWriterImpl(System.out);
|
||||
|
||||
if (envelope.hasSource()) {
|
||||
var source = envelope.getSourceAddress();
|
||||
writer.println("Envelope from: {} (device: {})", formatContact(source), envelope.getSourceDevice());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue