Implement json output for receive

This commit is contained in:
AsamK 2017-06-15 23:45:14 +02:00
parent a1f0d74a99
commit 8717665d1d
9 changed files with 225 additions and 2 deletions

View file

@ -0,0 +1,24 @@
package org.asamk.signal;
import org.whispersystems.signalservice.api.messages.multidevice.ReadMessage;
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
import java.util.List;
class JsonSyncMessage {
JsonDataMessage sentMessage;
List<String> blockedNumbers;
List<ReadMessage> readMessages;
JsonSyncMessage(SignalServiceSyncMessage syncMessage) {
if (syncMessage.getSent().isPresent()) {
this.sentMessage = new JsonDataMessage(syncMessage.getSent().get().getMessage());
}
if (syncMessage.getBlockedList().isPresent()) {
this.blockedNumbers = syncMessage.getBlockedList().get().getNumbers();
}
if (syncMessage.getRead().isPresent()) {
this.readMessages = syncMessage.getRead().get();
}
}
}