Refactor ReceiveCommand in dbus mode and remove ExtendedDbusCommand

This commit is contained in:
AsamK 2021-11-06 21:09:06 +01:00
parent eec7aec069
commit 32818a8608
16 changed files with 301 additions and 261 deletions

View file

@ -2,14 +2,12 @@ package org.asamk.signal.json;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.asamk.Signal;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.UntrustedIdentityException;
import org.asamk.signal.manager.api.InvalidNumberException;
import org.asamk.signal.manager.api.MessageEnvelope;
import org.asamk.signal.manager.api.RecipientIdentifier;
import java.util.List;
import java.util.UUID;
public record JsonMessageEnvelope(
@ -78,47 +76,4 @@ public record JsonMessageEnvelope(
receiptMessage,
typingMessage);
}
public static JsonMessageEnvelope from(Signal.MessageReceived messageReceived) {
return new JsonMessageEnvelope(messageReceived.getSource(),
null,
null,
null,
null,
messageReceived.getTimestamp(),
JsonDataMessage.from(messageReceived),
null,
null,
null,
null);
}
public static JsonMessageEnvelope from(Signal.ReceiptReceived receiptReceived) {
return new JsonMessageEnvelope(receiptReceived.getSender(),
null,
null,
null,
null,
receiptReceived.getTimestamp(),
null,
null,
null,
JsonReceiptMessage.deliveryReceipt(receiptReceived.getTimestamp(),
List.of(receiptReceived.getTimestamp())),
null);
}
public static JsonMessageEnvelope from(Signal.SyncMessageReceived messageReceived) {
return new JsonMessageEnvelope(messageReceived.getSource(),
null,
null,
null,
null,
messageReceived.getTimestamp(),
null,
JsonSyncMessage.from(messageReceived),
null,
null,
null);
}
}

View file

@ -14,8 +14,4 @@ record JsonReceiptMessage(long when, boolean isDelivery, boolean isRead, boolean
final var timestamps = receiptMessage.timestamps();
return new JsonReceiptMessage(when, isDelivery, isRead, isViewed, timestamps);
}
static JsonReceiptMessage deliveryReceipt(final long when, final List<Long> timestamps) {
return new JsonReceiptMessage(when, true, false, false, timestamps);
}
}

View file

@ -2,7 +2,6 @@ package org.asamk.signal.json;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import org.asamk.Signal;
import org.asamk.signal.manager.api.MessageEnvelope;
import java.util.UUID;
@ -26,11 +25,4 @@ record JsonSyncDataMessage(
return new JsonSyncDataMessage(null, null, null, JsonDataMessage.from(transcriptMessage.message()));
}
}
static JsonSyncDataMessage from(Signal.SyncMessageReceived messageReceived) {
return new JsonSyncDataMessage(messageReceived.getDestination(),
null,
null,
JsonDataMessage.from(messageReceived));
}
}

View file

@ -2,7 +2,6 @@ package org.asamk.signal.json;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.asamk.Signal;
import org.asamk.signal.manager.api.MessageEnvelope;
import org.asamk.signal.manager.groups.GroupId;
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
@ -77,8 +76,4 @@ record JsonSyncMessage(
}
return new JsonSyncMessage(sentMessage, blockedNumbers, blockedGroupIds, readMessages, type);
}
static JsonSyncMessage from(Signal.SyncMessageReceived messageReceived) {
return new JsonSyncMessage(JsonSyncDataMessage.from(messageReceived), null, null, null, null);
}
}