mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-05-27 14:44:16 +00:00
Compare commits
39 Commits
e710efd173
...
6b6151188c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b6151188c | ||
|
|
d0ee90dbbc | ||
|
|
398faa50b0 | ||
|
|
e9eabbeeb5 | ||
|
|
132dfb95dc | ||
|
|
2651823d4d | ||
|
|
4709cfacc7 | ||
|
|
7773a3fd83 | ||
|
|
30f1464092 | ||
|
|
52543fbc5e | ||
|
|
c633f478c2 | ||
|
|
dd1d41c798 | ||
|
|
ed6f41c691 | ||
|
|
b4d5da7bf0 | ||
|
|
1702266b75 | ||
|
|
da0d67a2db | ||
|
|
14b48e4784 | ||
|
|
cafced7a67 | ||
|
|
11ee28a2e1 | ||
|
|
6810877b4d | ||
|
|
afc3c458a9 | ||
|
|
b6e895b47e | ||
|
|
0f83b784e9 | ||
|
|
8376d1f477 | ||
|
|
d7c0c7000f | ||
|
|
c6ac4b2692 | ||
|
|
6135dae301 | ||
|
|
1b3c898415 | ||
|
|
a215294c68 | ||
|
|
5f9fb1da88 | ||
|
|
b6b8276fd6 | ||
|
|
cde6fff336 | ||
|
|
3f15de0946 | ||
|
|
a38b7edbdf | ||
|
|
04b7b1e47d | ||
|
|
9580ab0777 | ||
|
|
cab77e0c08 | ||
|
|
a65c228c9b | ||
|
|
d271a2db3d |
10
README.md
10
README.md
@ -148,6 +148,16 @@ version installed, you can replace `./gradlew` with `gradle` in the following st
|
|||||||
./gradlew run --args="--help"
|
./gradlew run --args="--help"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### JSON Schemas for the JSON-RPC mode
|
||||||
|
|
||||||
|
1. Generate [JSON Schema](https://json-schema.org/) files for all the JSON-RPC data classes (`src/main/java/org/asamk/signal/json`):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./gradlew jsonSchemas
|
||||||
|
```
|
||||||
|
|
||||||
|
2. The generated files can be found in the `build/generated/META-INF/schemas` folder.
|
||||||
|
|
||||||
### Building a native binary with GraalVM (EXPERIMENTAL)
|
### Building a native binary with GraalVM (EXPERIMENTAL)
|
||||||
|
|
||||||
It is possible to build a native binary with [GraalVM](https://www.graalvm.org). This is still experimental and will not
|
It is possible to build a native binary with [GraalVM](https://www.graalvm.org). This is still experimental and will not
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import groovy.json.JsonOutput
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
application
|
application
|
||||||
@ -72,6 +74,11 @@ val excludePatterns = mapOf(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val schemaAnnotationProcessor by configurations.creating {
|
||||||
|
isCanBeConsumed = false
|
||||||
|
isCanBeResolved = true
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
registerTransform(JarFileExcluder::class) {
|
registerTransform(JarFileExcluder::class) {
|
||||||
from.attribute(minified, false).attribute(artifactType, "jar")
|
from.attribute(minified, false).attribute(artifactType, "jar")
|
||||||
@ -82,6 +89,8 @@ dependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
schemaAnnotationProcessor(libs.micronaut.json.schema.processor)
|
||||||
|
schemaAnnotationProcessor(libs.micronaut.inject.java)
|
||||||
implementation(libs.bouncycastle)
|
implementation(libs.bouncycastle)
|
||||||
implementation(libs.jackson.databind)
|
implementation(libs.jackson.databind)
|
||||||
implementation(libs.argparse4j)
|
implementation(libs.argparse4j)
|
||||||
@ -90,6 +99,10 @@ dependencies {
|
|||||||
implementation(libs.slf4j.jul)
|
implementation(libs.slf4j.jul)
|
||||||
implementation(libs.logback)
|
implementation(libs.logback)
|
||||||
implementation(libs.zxing)
|
implementation(libs.zxing)
|
||||||
|
implementation(libs.micronaut.json.schema.annotations)
|
||||||
|
if (gradle.startParameter.taskNames.any { it.contains("jsonSchemas") }) {
|
||||||
|
implementation(libs.micronaut.json.schema.generator)
|
||||||
|
}
|
||||||
implementation(project(":libsignal-cli"))
|
implementation(project(":libsignal-cli"))
|
||||||
|
|
||||||
testImplementation(libs.junit.jupiter)
|
testImplementation(libs.junit.jupiter)
|
||||||
@ -160,3 +173,30 @@ tasks.register("writeLibsignalVersion") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register<JavaCompile>("jsonSchemas") {
|
||||||
|
dependsOn(tasks.compileJava)
|
||||||
|
val schemaBaseUri = "http://localhost:8080/schemas/"
|
||||||
|
source = sourceSets.main.get().java
|
||||||
|
include("org/asamk/signal/json/**/*.java")
|
||||||
|
classpath = sourceSets.main.get().compileClasspath + files(sourceSets.main.get().java.destinationDirectory)
|
||||||
|
destinationDirectory.set(layout.buildDirectory.dir("generated"))
|
||||||
|
options.annotationProcessorPath = schemaAnnotationProcessor
|
||||||
|
options.compilerArgs.addAll(
|
||||||
|
listOf(
|
||||||
|
"-Amicronaut.processing.group=org.asamk",
|
||||||
|
"-Amicronaut.processing.module=signal-cli",
|
||||||
|
"-Amicronaut.processing.annotations=org.asamk.signal.json.*",
|
||||||
|
"-Amicronaut.jsonschema.baseUri=$schemaBaseUri",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
doLast {
|
||||||
|
fileTree(destinationDirectory.get().dir("META-INF/schemas").asFile) {
|
||||||
|
include("*.schema.json")
|
||||||
|
}.forEach { schemaFile ->
|
||||||
|
val normalized = schemaFile.readText().replace("\"$schemaBaseUri/", "\"")
|
||||||
|
val prettyJson = JsonOutput.prettyPrint(normalized)
|
||||||
|
schemaFile.writeText("$prettyJson\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
[versions]
|
[versions]
|
||||||
slf4j = "2.0.17"
|
slf4j = "2.0.17"
|
||||||
junit = "6.0.2"
|
junit = "6.0.2"
|
||||||
|
micronaut-json-schema = "2.0.0-M6"
|
||||||
|
micronaut-core = "4.9.3"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.83"
|
bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.83"
|
||||||
@ -8,6 +10,10 @@ jackson-databind = "com.fasterxml.jackson.core:jackson-databind:2.20.2"
|
|||||||
argparse4j = "net.sourceforge.argparse4j:argparse4j:0.9.0"
|
argparse4j = "net.sourceforge.argparse4j:argparse4j:0.9.0"
|
||||||
dbusjava = "com.github.hypfvieh:dbus-java-transport-native-unixsocket:5.0.0"
|
dbusjava = "com.github.hypfvieh:dbus-java-transport-native-unixsocket:5.0.0"
|
||||||
zxing = "com.google.zxing:core:3.5.4"
|
zxing = "com.google.zxing:core:3.5.4"
|
||||||
|
micronaut-json-schema-annotations = { module = "io.micronaut.jsonschema:micronaut-json-schema-annotations", version.ref = "micronaut-json-schema" }
|
||||||
|
micronaut-json-schema-processor = { module = "io.micronaut.jsonschema:micronaut-json-schema-processor", version.ref = "micronaut-json-schema" }
|
||||||
|
micronaut-json-schema-generator = { module = "io.micronaut.jsonschema:micronaut-json-schema-generator", version.ref = "micronaut-json-schema" }
|
||||||
|
micronaut-inject-java = { module = "io.micronaut:micronaut-inject-java", version.ref = "micronaut-core" }
|
||||||
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
||||||
slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
|
slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
|
||||||
logback = "ch.qos.logback:logback-classic:1.5.32"
|
logback = "ch.qos.logback:logback-classic:1.5.32"
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package org.asamk.signal.manager.api;
|
package org.asamk.signal.manager.api;
|
||||||
|
|
||||||
public record CallOffer(
|
public record CallOffer(
|
||||||
long callId,
|
long callId, Type type, byte[] opaque
|
||||||
Type type,
|
|
||||||
byte[] opaque
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
|
|||||||
@ -268,19 +268,19 @@ public record MessageEnvelope(
|
|||||||
quote.getMentions() == null
|
quote.getMentions() == null
|
||||||
? List.of()
|
? List.of()
|
||||||
: quote.getMentions()
|
: quote.getMentions()
|
||||||
.stream()
|
.stream()
|
||||||
.map(m -> Mention.from(m, recipientResolver, addressResolver))
|
.map(m -> Mention.from(m, recipientResolver, addressResolver))
|
||||||
.toList(),
|
.toList(),
|
||||||
quote.getAttachments() == null
|
quote.getAttachments() == null
|
||||||
? List.of()
|
? List.of()
|
||||||
: quote.getAttachments().stream().map(a -> Attachment.from(a, fileProvider)).toList(),
|
: quote.getAttachments().stream().map(a -> Attachment.from(a, fileProvider)).toList(),
|
||||||
quote.getBodyRanges() == null
|
quote.getBodyRanges() == null
|
||||||
? List.of()
|
? List.of()
|
||||||
: quote.getBodyRanges()
|
: quote.getBodyRanges()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(r -> r.style != null)
|
.filter(r -> r.style != null)
|
||||||
.map(TextStyle::from)
|
.map(TextStyle::from)
|
||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,7 +599,7 @@ public record MessageEnvelope(
|
|||||||
Boolean.TRUE.equals(pinnedMessage.getForever())
|
Boolean.TRUE.equals(pinnedMessage.getForever())
|
||||||
? -1
|
? -1
|
||||||
: pinnedMessage.getPinDurationInSeconds() == null
|
: pinnedMessage.getPinDurationInSeconds() == null
|
||||||
? 0
|
? 0
|
||||||
: pinnedMessage.getPinDurationInSeconds());
|
: pinnedMessage.getPinDurationInSeconds());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1032,14 +1032,14 @@ public record MessageEnvelope(
|
|||||||
final var source = !envelope.isUnidentifiedSender() && serviceId != null
|
final var source = !envelope.isUnidentifiedSender() && serviceId != null
|
||||||
? recipientResolver.resolveRecipient(serviceId)
|
? recipientResolver.resolveRecipient(serviceId)
|
||||||
: envelope.isUnidentifiedSender() && content != null
|
: envelope.isUnidentifiedSender() && content != null
|
||||||
? recipientResolver.resolveRecipient(content.getSender())
|
? recipientResolver.resolveRecipient(content.getSender())
|
||||||
: exception instanceof ProtocolException e
|
: exception instanceof ProtocolException e
|
||||||
? recipientResolver.resolveRecipient(e.getSender())
|
? recipientResolver.resolveRecipient(e.getSender())
|
||||||
: null;
|
: null;
|
||||||
final var sourceDevice = envelope.hasSourceDevice()
|
final var sourceDevice = envelope.hasSourceDevice()
|
||||||
? envelope.getSourceDevice()
|
? envelope.getSourceDevice()
|
||||||
: content != null
|
: content != null
|
||||||
? content.getSenderDevice()
|
? content.getSenderDevice()
|
||||||
: exception instanceof ProtocolException e ? e.getSenderDevice() : 0;
|
: exception instanceof ProtocolException e ? e.getSenderDevice() : 0;
|
||||||
|
|
||||||
Optional<Receipt> receipt;
|
Optional<Receipt> receipt;
|
||||||
|
|||||||
@ -1,3 +1,9 @@
|
|||||||
package org.asamk.signal.manager.api;
|
package org.asamk.signal.manager.api;
|
||||||
|
|
||||||
public record ReceiveConfig(boolean ignoreAttachments, boolean ignoreStories, boolean ignoreAvatars, boolean ignoreStickers, boolean sendReadReceipts) {}
|
public record ReceiveConfig(
|
||||||
|
boolean ignoreAttachments,
|
||||||
|
boolean ignoreStories,
|
||||||
|
boolean ignoreAvatars,
|
||||||
|
boolean ignoreStickers,
|
||||||
|
boolean sendReadReceipts
|
||||||
|
) {}
|
||||||
|
|||||||
@ -3,8 +3,5 @@ package org.asamk.signal.manager.api;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public record TurnServer(
|
public record TurnServer(
|
||||||
String username,
|
String username, String password, List<String> urls
|
||||||
String password,
|
) {}
|
||||||
List<String> urls
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ public class ContactHelper {
|
|||||||
final var version = contact == null
|
final var version = contact == null
|
||||||
? 1
|
? 1
|
||||||
: contact.messageExpirationTimeVersion() == Integer.MAX_VALUE
|
: contact.messageExpirationTimeVersion() == Integer.MAX_VALUE
|
||||||
? Integer.MAX_VALUE
|
? Integer.MAX_VALUE
|
||||||
: contact.messageExpirationTimeVersion() + 1;
|
: contact.messageExpirationTimeVersion() + 1;
|
||||||
account.getContactStore()
|
account.getContactStore()
|
||||||
.storeContact(recipientId,
|
.storeContact(recipientId,
|
||||||
|
|||||||
@ -726,7 +726,7 @@ public class GroupHelper {
|
|||||||
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
||||||
}
|
}
|
||||||
final var newMembers = new HashSet<>(members);
|
final var newMembers = new HashSet<>(members);
|
||||||
newMembers.removeAll(group.getMembers());
|
newMembers.removeAll(group.getMemberRecipientIds());
|
||||||
newMembers.removeAll(group.getRequestingMembers());
|
newMembers.removeAll(group.getRequestingMembers());
|
||||||
if (!newMembers.isEmpty()) {
|
if (!newMembers.isEmpty()) {
|
||||||
var groupGroupChangePair = groupV2Helper.addMembers(group, newMembers);
|
var groupGroupChangePair = groupV2Helper.addMembers(group, newMembers);
|
||||||
@ -768,12 +768,8 @@ public class GroupHelper {
|
|||||||
newAdmins.retainAll(group.getMemberRecipientIds());
|
newAdmins.retainAll(group.getMemberRecipientIds());
|
||||||
newAdmins.removeAll(group.getAdminMemberRecipientIds());
|
newAdmins.removeAll(group.getAdminMemberRecipientIds());
|
||||||
if (!newAdmins.isEmpty()) {
|
if (!newAdmins.isEmpty()) {
|
||||||
for (var admin : newAdmins) {
|
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, newAdmins, true);
|
||||||
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, admin, true);
|
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
||||||
result = sendUpdateGroupV2Message(group,
|
|
||||||
groupGroupChangePair.first(),
|
|
||||||
groupGroupChangePair.second());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,12 +777,8 @@ public class GroupHelper {
|
|||||||
final var existingRemoveAdmins = new HashSet<>(removeAdmins);
|
final var existingRemoveAdmins = new HashSet<>(removeAdmins);
|
||||||
existingRemoveAdmins.retainAll(group.getAdminMemberRecipientIds());
|
existingRemoveAdmins.retainAll(group.getAdminMemberRecipientIds());
|
||||||
if (!existingRemoveAdmins.isEmpty()) {
|
if (!existingRemoveAdmins.isEmpty()) {
|
||||||
for (var admin : existingRemoveAdmins) {
|
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, existingRemoveAdmins, false);
|
||||||
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, admin, false);
|
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
||||||
result = sendUpdateGroupV2Message(group,
|
|
||||||
groupGroupChangePair.first(),
|
|
||||||
groupGroupChangePair.second());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -501,18 +501,25 @@ class GroupV2Helper {
|
|||||||
|
|
||||||
Pair<DecryptedGroup, GroupChangeResponse> setMemberAdmin(
|
Pair<DecryptedGroup, GroupChangeResponse> setMemberAdmin(
|
||||||
GroupInfoV2 groupInfoV2,
|
GroupInfoV2 groupInfoV2,
|
||||||
RecipientId recipientId,
|
Set<RecipientId> recipientIds,
|
||||||
boolean admin
|
boolean admin
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
final var address = context.getRecipientHelper().resolveSignalServiceAddress(recipientId);
|
|
||||||
final var newRole = admin ? Member.Role.ADMINISTRATOR : Member.Role.DEFAULT;
|
final var newRole = admin ? Member.Role.ADMINISTRATOR : Member.Role.DEFAULT;
|
||||||
if (address.getServiceId() instanceof ACI aci) {
|
final var change = new GroupChange.Actions.Builder();
|
||||||
final var change = groupOperations.createChangeMemberRole(aci, newRole);
|
final var memberRoles = recipientIds.stream()
|
||||||
return commitChange(groupInfoV2, change);
|
.map(context.getRecipientHelper()::resolveSignalServiceAddress)
|
||||||
} else {
|
.map(SignalServiceAddress::getServiceId)
|
||||||
|
.filter(m -> m instanceof ACI)
|
||||||
|
.map(m -> (ACI) m)
|
||||||
|
.map(aci -> new GroupChange.Actions.ModifyMemberRoleAction.Builder().userId(groupOperations.encryptServiceId(
|
||||||
|
aci)).role(newRole).build())
|
||||||
|
.toList();
|
||||||
|
if (memberRoles.size() < recipientIds.size()) {
|
||||||
throw new IllegalArgumentException("Can't make a PNI a group admin.");
|
throw new IllegalArgumentException("Can't make a PNI a group admin.");
|
||||||
}
|
}
|
||||||
|
change.modifyMemberRoles(memberRoles);
|
||||||
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<DecryptedGroup, GroupChangeResponse> setMessageExpirationTimer(
|
Pair<DecryptedGroup, GroupChangeResponse> setMessageExpirationTimer(
|
||||||
|
|||||||
@ -191,9 +191,11 @@ public final class ProfileHelper {
|
|||||||
if (uploadProfile) {
|
if (uploadProfile) {
|
||||||
final var streamDetails = avatar != null && avatar.isPresent()
|
final var streamDetails = avatar != null && avatar.isPresent()
|
||||||
? Utils.createStreamDetails(avatar.get())
|
? Utils.createStreamDetails(avatar.get())
|
||||||
.first()
|
.first()
|
||||||
: forceUploadAvatar && avatar == null ? context.getAvatarStore()
|
: forceUploadAvatar && avatar == null
|
||||||
.retrieveProfileAvatar(account.getSelfRecipientAddress()) : null;
|
? context.getAvatarStore()
|
||||||
|
.retrieveProfileAvatar(account.getSelfRecipientAddress())
|
||||||
|
: null;
|
||||||
try (streamDetails) {
|
try (streamDetails) {
|
||||||
final var avatarUploadParams = streamDetails != null
|
final var avatarUploadParams = streamDetails != null
|
||||||
? AvatarUploadParams.forAvatar(streamDetails)
|
? AvatarUploadParams.forAvatar(streamDetails)
|
||||||
|
|||||||
@ -524,11 +524,11 @@ public class SendHelper {
|
|||||||
Set<RecipientId> senderKeyTargets = groupInfo.getDistributionId() == null || groupSendEndorsements == null
|
Set<RecipientId> senderKeyTargets = groupInfo.getDistributionId() == null || groupSendEndorsements == null
|
||||||
? Set.of()
|
? Set.of()
|
||||||
: recipientIds.stream()
|
: recipientIds.stream()
|
||||||
.filter(s -> this.isSenderKeyCapable(s,
|
.filter(s -> this.isSenderKeyCapable(s,
|
||||||
addressesMap.get(s),
|
addressesMap.get(s),
|
||||||
unidentifiedAccessesMap.get(s),
|
unidentifiedAccessesMap.get(s),
|
||||||
groupSendEndorsements))
|
groupSendEndorsements))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
if (senderKeyTargets.size() < 2) {
|
if (senderKeyTargets.size() < 2) {
|
||||||
logger.debug("Too few sender-key-capable users ({}). Doing all legacy sends.", senderKeyTargets.size());
|
logger.debug("Too few sender-key-capable users ({}). Doing all legacy sends.", senderKeyTargets.size());
|
||||||
senderKeyTargets = Set.of();
|
senderKeyTargets = Set.of();
|
||||||
@ -590,11 +590,11 @@ public class SendHelper {
|
|||||||
final var expirationMs = Instant.ofEpochMilli(groupSendEndorsementsExpirationMs);
|
final var expirationMs = Instant.ofEpochMilli(groupSendEndorsementsExpirationMs);
|
||||||
final var groupSendTokens = groupSendEndorsements != null && groupSecretParams != null
|
final var groupSendTokens = groupSendEndorsements != null && groupSecretParams != null
|
||||||
? legacyTargets.stream()
|
? legacyTargets.stream()
|
||||||
.map(groupSendEndorsements::get)
|
.map(groupSendEndorsements::get)
|
||||||
.map(endorsement -> Optional.ofNullable(endorsement)
|
.map(endorsement -> Optional.ofNullable(endorsement)
|
||||||
.map(e -> e.toFullToken(groupSecretParams, expirationMs))
|
.map(e -> e.toFullToken(groupSecretParams, expirationMs))
|
||||||
.orElse(null))
|
.orElse(null))
|
||||||
.toList()
|
.toList()
|
||||||
: null;
|
: null;
|
||||||
final var sealedSenderAccesses = SealedSenderAccess.forFanOutGroupSend(groupSendTokens,
|
final var sealedSenderAccesses = SealedSenderAccess.forFanOutGroupSend(groupSendTokens,
|
||||||
senderCertificate,
|
senderCertificate,
|
||||||
|
|||||||
@ -941,7 +941,7 @@ public class SignalAccount implements Closeable {
|
|||||||
profile.isUnrestrictedUnidentifiedAccess()
|
profile.isUnrestrictedUnidentifiedAccess()
|
||||||
? Profile.UnidentifiedAccessMode.UNRESTRICTED
|
? Profile.UnidentifiedAccessMode.UNRESTRICTED
|
||||||
: profile.getUnidentifiedAccess() != null
|
: profile.getUnidentifiedAccess() != null
|
||||||
? Profile.UnidentifiedAccessMode.ENABLED
|
? Profile.UnidentifiedAccessMode.ENABLED
|
||||||
: Profile.UnidentifiedAccessMode.DISABLED,
|
: Profile.UnidentifiedAccessMode.DISABLED,
|
||||||
capabilities,
|
capabilities,
|
||||||
null);
|
null);
|
||||||
|
|||||||
@ -152,6 +152,7 @@ public class GroupStore {
|
|||||||
statement.setBytes(2, groupId.serialize());
|
statement.setBytes(2, groupId.serialize());
|
||||||
final var result = Utils.executeQueryForOptional(statement, Utils::getIdMapper);
|
final var result = Utils.executeQueryForOptional(statement, Utils::getIdMapper);
|
||||||
if (result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
|
connection.commit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
internalId = result.get();
|
internalId = result.get();
|
||||||
@ -876,9 +877,9 @@ public class GroupStore {
|
|||||||
final var members = membersString == null
|
final var members = membersString == null
|
||||||
? Set.<RecipientId>of()
|
? Set.<RecipientId>of()
|
||||||
: Arrays.stream(membersString.split(","))
|
: Arrays.stream(membersString.split(","))
|
||||||
.map(Integer::valueOf)
|
.map(Integer::valueOf)
|
||||||
.map(recipientIdCreator::create)
|
.map(recipientIdCreator::create)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
final var expirationTime = resultSet.getInt("expiration_time");
|
final var expirationTime = resultSet.getInt("expiration_time");
|
||||||
final var blocked = resultSet.getBoolean("blocked");
|
final var blocked = resultSet.getBoolean("blocked");
|
||||||
final var archived = resultSet.getBoolean("archived");
|
final var archived = resultSet.getBoolean("archived");
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public class LegacyJsonIdentityKeyStore {
|
|||||||
var trustLevel = trustedKey.hasNonNull("trustLevel") ? TrustLevel.fromInt(trustedKey.get(
|
var trustLevel = trustedKey.hasNonNull("trustLevel") ? TrustLevel.fromInt(trustedKey.get(
|
||||||
"trustLevel").asInt()) : TrustLevel.TRUSTED_UNVERIFIED;
|
"trustLevel").asInt()) : TrustLevel.TRUSTED_UNVERIFIED;
|
||||||
var added = trustedKey.hasNonNull("addedTimestamp") ? new Date(trustedKey.get("addedTimestamp")
|
var added = trustedKey.hasNonNull("addedTimestamp") ? new Date(trustedKey.get("addedTimestamp")
|
||||||
.asLong()) : new Date();
|
.asLong()) : new Date();
|
||||||
identities.add(new LegacyIdentityInfo(address, id, trustLevel, added));
|
identities.add(new LegacyIdentityInfo(address, id, trustLevel, added));
|
||||||
} catch (InvalidKeyException e) {
|
} catch (InvalidKeyException e) {
|
||||||
logger.warn("Error while decoding key for {}: {}", trustedKeyName, e.getMessage());
|
logger.warn("Error while decoding key for {}: {}", trustedKeyName, e.getMessage());
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import java.sql.Types;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -50,7 +51,7 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
|||||||
|
|
||||||
private final Map<Long, Long> recipientsMerged = new HashMap<>();
|
private final Map<Long, Long> recipientsMerged = new HashMap<>();
|
||||||
|
|
||||||
private final Map<ServiceId, RecipientWithAddress> recipientAddressCache = new HashMap<>();
|
private final Map<ServiceId, RecipientWithAddress> recipientAddressCache = Collections.synchronizedMap(new HashMap<>());
|
||||||
|
|
||||||
public static void createSql(Connection connection) throws SQLException {
|
public static void createSql(Connection connection) throws SQLException {
|
||||||
// When modifying the CREATE statement here, also add a migration in AccountDatabase.java
|
// When modifying the CREATE statement here, also add a migration in AccountDatabase.java
|
||||||
@ -184,12 +185,12 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecipientId resolveRecipient(final ServiceId serviceId) {
|
public RecipientId resolveRecipient(final ServiceId serviceId) {
|
||||||
|
final var recipientWithAddress = recipientAddressCache.get(serviceId);
|
||||||
|
if (recipientWithAddress != null) {
|
||||||
|
return recipientWithAddress.id();
|
||||||
|
}
|
||||||
try (final var connection = database.getConnection()) {
|
try (final var connection = database.getConnection()) {
|
||||||
connection.setAutoCommit(false);
|
connection.setAutoCommit(false);
|
||||||
final var recipientWithAddress = recipientAddressCache.get(serviceId);
|
|
||||||
if (recipientWithAddress != null) {
|
|
||||||
return recipientWithAddress.id();
|
|
||||||
}
|
|
||||||
final var recipientId = resolveRecipientLocked(connection, serviceId);
|
final var recipientId = resolveRecipientLocked(connection, serviceId);
|
||||||
connection.commit();
|
connection.commit();
|
||||||
return recipientId;
|
return recipientId;
|
||||||
@ -1605,9 +1606,9 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re
|
|||||||
profileCapabilities == null
|
profileCapabilities == null
|
||||||
? Set.of()
|
? Set.of()
|
||||||
: Arrays.stream(profileCapabilities.split(","))
|
: Arrays.stream(profileCapabilities.split(","))
|
||||||
.map(Profile.Capability::valueOfOrNull)
|
.map(Profile.Capability::valueOfOrNull)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toSet()),
|
.collect(Collectors.toSet()),
|
||||||
PhoneNumberSharingMode.valueOfOrNull(resultSet.getString("profile_phone_number_sharing")));
|
PhoneNumberSharingMode.valueOfOrNull(resultSet.getString("profile_phone_number_sharing")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -303,6 +303,7 @@ public class MessageSendLogStore implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
if (contentId == -1) {
|
if (contentId == -1) {
|
||||||
logger.warn("Failed to insert message send log content");
|
logger.warn("Failed to insert message send log content");
|
||||||
|
connection.commit();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
insertRecipientsForExistingContent(contentId, recipientDevices, connection);
|
insertRecipientsForExistingContent(contentId, recipientDevices, connection);
|
||||||
@ -320,10 +321,10 @@ public class MessageSendLogStore implements AutoCloseable {
|
|||||||
return content.dataMessage == null
|
return content.dataMessage == null
|
||||||
? null
|
? null
|
||||||
: content.dataMessage.group != null && content.dataMessage.group.id != null
|
: content.dataMessage.group != null && content.dataMessage.group.id != null
|
||||||
? content.dataMessage.group.id.toByteArray()
|
? content.dataMessage.group.id.toByteArray()
|
||||||
: content.dataMessage.groupV2 != null && content.dataMessage.groupV2.masterKey != null
|
: content.dataMessage.groupV2 != null && content.dataMessage.groupV2.masterKey != null
|
||||||
? GroupUtils.getGroupIdV2(new GroupMasterKey(content.dataMessage.groupV2.masterKey.toByteArray()))
|
? GroupUtils.getGroupIdV2(new GroupMasterKey(content.dataMessage.groupV2.masterKey.toByteArray()))
|
||||||
.serialize()
|
.serialize()
|
||||||
: null;
|
: null;
|
||||||
} catch (InvalidInputException e) {
|
} catch (InvalidInputException e) {
|
||||||
logger.warn("Failed to parse groupId id from content");
|
logger.warn("Failed to parse groupId id from content");
|
||||||
|
|||||||
@ -194,8 +194,9 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||||||
if (session != null) {
|
if (session != null) {
|
||||||
session.archiveCurrentState();
|
session.archiveCurrentState();
|
||||||
storeSession(connection, key, session);
|
storeSession(connection, key, session);
|
||||||
connection.commit();
|
|
||||||
}
|
}
|
||||||
|
connection.commit();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException("Failed update session store", e);
|
throw new RuntimeException("Failed update session store", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,8 +78,10 @@ public class StickerUtils {
|
|||||||
throw new StickerPackInvalidException("Could not find find " + pack.cover().file());
|
throw new StickerPackInvalidException("Could not find find " + pack.cover().file());
|
||||||
}
|
}
|
||||||
|
|
||||||
var contentType = pack.cover().contentType() != null && !pack.cover().contentType().isEmpty() ? pack.cover()
|
var contentType = pack.cover().contentType() != null && !pack.cover().contentType().isEmpty()
|
||||||
.contentType() : getContentType(rootPath, zip, pack.cover().file());
|
? pack.cover()
|
||||||
|
.contentType()
|
||||||
|
: getContentType(rootPath, zip, pack.cover().file());
|
||||||
cover = new SignalServiceStickerManifestUpload.StickerInfo(data.first(),
|
cover = new SignalServiceStickerManifestUpload.StickerInfo(data.first(),
|
||||||
data.second(),
|
data.second(),
|
||||||
Optional.ofNullable(pack.cover().emoji()).orElse(""),
|
Optional.ofNullable(pack.cover().emoji()).orElse(""),
|
||||||
|
|||||||
@ -204,9 +204,9 @@ public class App {
|
|||||||
private OutputWriter getOutputWriter(final Command command) throws UserErrorException {
|
private OutputWriter getOutputWriter(final Command command) throws UserErrorException {
|
||||||
final var outputTypeInput = ns.<OutputType>get("output");
|
final var outputTypeInput = ns.<OutputType>get("output");
|
||||||
final var outputType = outputTypeInput == null ? command.getSupportedOutputTypes()
|
final var outputType = outputTypeInput == null ? command.getSupportedOutputTypes()
|
||||||
.stream()
|
.stream()
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null) : outputTypeInput;
|
.orElse(null) : outputTypeInput;
|
||||||
final var writer = new BufferedWriter(new OutputStreamWriter(System.out, IOUtils.getConsoleCharset()));
|
final var writer = new BufferedWriter(new OutputStreamWriter(System.out, IOUtils.getConsoleCharset()));
|
||||||
final var outputWriter = outputType == null
|
final var outputWriter = outputType == null
|
||||||
? null
|
? null
|
||||||
|
|||||||
@ -612,8 +612,8 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||||||
writer.println("Size: {}{}",
|
writer.println("Size: {}{}",
|
||||||
attachment.size().isPresent() ? attachment.size().get() + " bytes" : "<unavailable>",
|
attachment.size().isPresent() ? attachment.size().get() + " bytes" : "<unavailable>",
|
||||||
attachment.preview().isPresent() ? " (Preview is available: "
|
attachment.preview().isPresent() ? " (Preview is available: "
|
||||||
+ attachment.preview().get().length
|
+ attachment.preview().get().length
|
||||||
+ " bytes)" : "");
|
+ " bytes)" : "");
|
||||||
}
|
}
|
||||||
if (attachment.thumbnail().isPresent()) {
|
if (attachment.thumbnail().isPresent()) {
|
||||||
writer.println("Thumbnail:");
|
writer.println("Thumbnail:");
|
||||||
|
|||||||
@ -23,10 +23,7 @@ public class AcceptCallCommand implements JsonRpcLocalCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void attachToSubparser(final Subparser subparser) {
|
public void attachToSubparser(final Subparser subparser) {
|
||||||
subparser.help("Accept an incoming voice call.");
|
subparser.help("Accept an incoming voice call.");
|
||||||
subparser.addArgument("--call-id")
|
subparser.addArgument("--call-id").type(long.class).required(true).help("The call ID to accept.");
|
||||||
.type(long.class)
|
|
||||||
.required(true)
|
|
||||||
.help("The call ID to accept.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -21,10 +21,7 @@ public class HangupCallCommand implements JsonRpcLocalCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void attachToSubparser(final Subparser subparser) {
|
public void attachToSubparser(final Subparser subparser) {
|
||||||
subparser.help("Hang up an active voice call.");
|
subparser.help("Hang up an active voice call.");
|
||||||
subparser.addArgument("--call-id")
|
subparser.addArgument("--call-id").type(long.class).required(true).help("The call ID to hang up.");
|
||||||
.type(long.class)
|
|
||||||
.required(true)
|
|
||||||
.help("The call ID to hang up.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -5,13 +5,10 @@ import net.sourceforge.argparse4j.inf.Subparser;
|
|||||||
|
|
||||||
import org.asamk.signal.commands.exceptions.CommandException;
|
import org.asamk.signal.commands.exceptions.CommandException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.CallInfo;
|
|
||||||
import org.asamk.signal.output.JsonWriter;
|
import org.asamk.signal.output.JsonWriter;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
import org.asamk.signal.output.PlainTextWriter;
|
import org.asamk.signal.output.PlainTextWriter;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ListCallsCommand implements JsonRpcLocalCommand {
|
public class ListCallsCommand implements JsonRpcLocalCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
|
|||||||
r.getProfile().getPhoneNumberSharingMode() == null
|
r.getProfile().getPhoneNumberSharingMode() == null
|
||||||
? ""
|
? ""
|
||||||
: String.valueOf(r.getProfile().getPhoneNumberSharingMode()
|
: String.valueOf(r.getProfile().getPhoneNumberSharingMode()
|
||||||
== PhoneNumberSharingMode.EVERYBODY),
|
== PhoneNumberSharingMode.EVERYBODY),
|
||||||
r.getDiscoverable() == null ? "" : String.valueOf(r.getDiscoverable()));
|
r.getDiscoverable() == null ? "" : String.valueOf(r.getDiscoverable()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,17 +121,17 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
|
|||||||
final var jsonInternal = !internal
|
final var jsonInternal = !internal
|
||||||
? null
|
? null
|
||||||
: new JsonContact.JsonInternal(r.getProfile()
|
: new JsonContact.JsonInternal(r.getProfile()
|
||||||
.getCapabilities()
|
.getCapabilities()
|
||||||
.stream()
|
.stream()
|
||||||
.map(Enum::name)
|
.map(Enum::name)
|
||||||
.toList(),
|
.toList(),
|
||||||
r.getProfile().getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.UNKNOWN
|
r.getProfile().getUnidentifiedAccessMode() == Profile.UnidentifiedAccessMode.UNKNOWN
|
||||||
? null
|
? null
|
||||||
: r.getProfile().getUnidentifiedAccessMode().name(),
|
: r.getProfile().getUnidentifiedAccessMode().name(),
|
||||||
r.getProfile().getPhoneNumberSharingMode() == null
|
r.getProfile().getPhoneNumberSharingMode() == null
|
||||||
? null
|
? null
|
||||||
: r.getProfile().getPhoneNumberSharingMode()
|
: r.getProfile().getPhoneNumberSharingMode()
|
||||||
== PhoneNumberSharingMode.EVERYBODY,
|
== PhoneNumberSharingMode.EVERYBODY,
|
||||||
r.getDiscoverable());
|
r.getDiscoverable());
|
||||||
return new JsonContact(address.number().orElse(null),
|
return new JsonContact(address.number().orElse(null),
|
||||||
address.uuid().map(UUID::toString).orElse(null),
|
address.uuid().map(UUID::toString).orElse(null),
|
||||||
@ -159,9 +159,9 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
|
|||||||
r.getProfile().getAboutEmoji(),
|
r.getProfile().getAboutEmoji(),
|
||||||
r.getProfile().getAvatarUrlPath() != null,
|
r.getProfile().getAvatarUrlPath() != null,
|
||||||
r.getProfile().getMobileCoinAddress() == null
|
r.getProfile().getMobileCoinAddress() == null
|
||||||
? null
|
? null
|
||||||
: Base64.getEncoder()
|
: Base64.getEncoder()
|
||||||
.encodeToString(r.getProfile().getMobileCoinAddress())),
|
.encodeToString(r.getProfile().getMobileCoinAddress())),
|
||||||
jsonInternal);
|
jsonInternal);
|
||||||
}).toList();
|
}).toList();
|
||||||
writer.write(jsonContacts);
|
writer.write(jsonContacts);
|
||||||
|
|||||||
@ -21,10 +21,7 @@ public class RejectCallCommand implements JsonRpcLocalCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void attachToSubparser(final Subparser subparser) {
|
public void attachToSubparser(final Subparser subparser) {
|
||||||
subparser.help("Reject an incoming voice call.");
|
subparser.help("Reject an incoming voice call.");
|
||||||
subparser.addArgument("--call-id")
|
subparser.addArgument("--call-id").type(long.class).required(true).help("The call ID to reject.");
|
||||||
.type(long.class)
|
|
||||||
.required(true)
|
|
||||||
.help("The call ID to reject.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -82,7 +82,11 @@ public class SendPollCreateCommand implements JsonRpcLocalCommand {
|
|||||||
throw new UserErrorException("Poll options must not be empty");
|
throw new UserErrorException("Poll options must not be empty");
|
||||||
}
|
}
|
||||||
if (option.length() > MAX_POLL_OPTION_LENGTH) {
|
if (option.length() > MAX_POLL_OPTION_LENGTH) {
|
||||||
throw new UserErrorException("Poll option \"" + option + "\" exceeds the maximum length of " + MAX_POLL_OPTION_LENGTH + " characters");
|
throw new UserErrorException("Poll option \""
|
||||||
|
+ option
|
||||||
|
+ "\" exceeds the maximum length of "
|
||||||
|
+ MAX_POLL_OPTION_LENGTH
|
||||||
|
+ " characters");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "AdminDelete")
|
||||||
public record JsonAdminDelete(
|
public record JsonAdminDelete(
|
||||||
@Deprecated String targetAuthor, String targetAuthorNumber, String targetAuthorUuid, long targetSentTimestamp
|
@Deprecated String targetAuthor, String targetAuthorNumber, String targetAuthorUuid, long targetSentTimestamp
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Attachment")
|
||||||
record JsonAttachment(
|
record JsonAttachment(
|
||||||
String contentType,
|
String contentType,
|
||||||
String filename,
|
String filename,
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
|
@JsonSchema(title = "AttachmentData")
|
||||||
public record JsonAttachmentData(
|
public record JsonAttachmentData(
|
||||||
String data
|
String data
|
||||||
) {}
|
) {}
|
||||||
|
|||||||
@ -18,15 +18,13 @@ public record JsonCallEvent(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
public static JsonCallEvent from(CallInfo callInfo, String reason) {
|
public static JsonCallEvent from(CallInfo callInfo, String reason) {
|
||||||
return new JsonCallEvent(
|
return new JsonCallEvent(callInfo.callId(),
|
||||||
callInfo.callId(),
|
|
||||||
callInfo.state().name(),
|
callInfo.state().name(),
|
||||||
callInfo.recipient().number().orElse(null),
|
callInfo.recipient().number().orElse(null),
|
||||||
callInfo.recipient().aci().orElse(null),
|
callInfo.recipient().aci().orElse(null),
|
||||||
callInfo.isOutgoing(),
|
callInfo.isOutgoing(),
|
||||||
callInfo.inputDeviceName(),
|
callInfo.inputDeviceName(),
|
||||||
callInfo.outputDeviceName(),
|
callInfo.outputDeviceName(),
|
||||||
reason
|
reason);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.asamk.signal.manager.util.Utils.callIdUnsigned;
|
import static org.asamk.signal.manager.util.Utils.callIdUnsigned;
|
||||||
|
|
||||||
|
@JsonSchema(title = "CallMessage")
|
||||||
record JsonCallMessage(
|
record JsonCallMessage(
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL) Offer offerMessage,
|
@JsonInclude(JsonInclude.Include.NON_NULL) Offer offerMessage,
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL) Answer answerMessage,
|
@JsonInclude(JsonInclude.Include.NON_NULL) Answer answerMessage,
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Contact")
|
||||||
public record JsonContact(
|
public record JsonContact(
|
||||||
String number,
|
String number,
|
||||||
String uuid,
|
String uuid,
|
||||||
@ -26,6 +28,7 @@ public record JsonContact(
|
|||||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonInternal internal
|
@JsonInclude(JsonInclude.Include.NON_NULL) JsonInternal internal
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@JsonSchema(title = "Profile")
|
||||||
public record JsonProfile(
|
public record JsonProfile(
|
||||||
long lastUpdateTimestamp,
|
long lastUpdateTimestamp,
|
||||||
String givenName,
|
String givenName,
|
||||||
@ -36,6 +39,7 @@ public record JsonContact(
|
|||||||
String mobileCoinAddress
|
String mobileCoinAddress
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
@JsonSchema(title = "Internal")
|
||||||
public record JsonInternal(
|
public record JsonInternal(
|
||||||
List<String> capabilities,
|
List<String> capabilities,
|
||||||
String unidentifiedAccessMode,
|
String unidentifiedAccessMode,
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
import org.asamk.signal.util.Util;
|
import org.asamk.signal.util.Util;
|
||||||
|
|
||||||
|
@JsonSchema(title = "ContactAddress")
|
||||||
public record JsonContactAddress(
|
public record JsonContactAddress(
|
||||||
String type,
|
String type,
|
||||||
String label,
|
String label,
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "ContactAvatar")
|
||||||
public record JsonContactAvatar(JsonAttachment attachment, boolean isProfile) {
|
public record JsonContactAvatar(JsonAttachment attachment, boolean isProfile) {
|
||||||
|
|
||||||
static JsonContactAvatar from(MessageEnvelope.Data.SharedContact.Avatar avatar) {
|
static JsonContactAvatar from(MessageEnvelope.Data.SharedContact.Avatar avatar) {
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
import org.asamk.signal.util.Util;
|
import org.asamk.signal.util.Util;
|
||||||
|
|
||||||
|
@JsonSchema(title = "ContactEmail")
|
||||||
public record JsonContactEmail(String value, String type, String label) {
|
public record JsonContactEmail(String value, String type, String label) {
|
||||||
|
|
||||||
static JsonContactEmail from(MessageEnvelope.Data.SharedContact.Email email) {
|
static JsonContactEmail from(MessageEnvelope.Data.SharedContact.Email email) {
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
import org.asamk.signal.util.Util;
|
import org.asamk.signal.util.Util;
|
||||||
|
|
||||||
|
@JsonSchema(title = "ContactName")
|
||||||
public record JsonContactName(
|
public record JsonContactName(
|
||||||
String nickname, String given, String family, String prefix, String suffix, String middle
|
String nickname, String given, String family, String prefix, String suffix, String middle
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
import org.asamk.signal.util.Util;
|
import org.asamk.signal.util.Util;
|
||||||
|
|
||||||
|
@JsonSchema(title = "ContactPhone")
|
||||||
public record JsonContactPhone(String value, String type, String label) {
|
public record JsonContactPhone(String value, String type, String label) {
|
||||||
|
|
||||||
static JsonContactPhone from(MessageEnvelope.Data.SharedContact.Phone phone) {
|
static JsonContactPhone from(MessageEnvelope.Data.SharedContact.Phone phone) {
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonSchema(title = "DataMessage")
|
||||||
record JsonDataMessage(
|
record JsonDataMessage(
|
||||||
long timestamp,
|
long timestamp,
|
||||||
String message,
|
String message,
|
||||||
@ -36,7 +38,7 @@ record JsonDataMessage(
|
|||||||
static JsonDataMessage from(MessageEnvelope.Data dataMessage, Manager m) {
|
static JsonDataMessage from(MessageEnvelope.Data dataMessage, Manager m) {
|
||||||
final var timestamp = dataMessage.timestamp();
|
final var timestamp = dataMessage.timestamp();
|
||||||
final var groupInfo = dataMessage.groupContext().isPresent() ? JsonGroupInfo.from(dataMessage.groupContext()
|
final var groupInfo = dataMessage.groupContext().isPresent() ? JsonGroupInfo.from(dataMessage.groupContext()
|
||||||
.get(), m) : null;
|
.get(), m) : null;
|
||||||
final var storyContext = dataMessage.storyContext().isPresent()
|
final var storyContext = dataMessage.storyContext().isPresent()
|
||||||
? JsonStoryContext.from(dataMessage.storyContext().get())
|
? JsonStoryContext.from(dataMessage.storyContext().get())
|
||||||
: null;
|
: null;
|
||||||
@ -48,32 +50,32 @@ record JsonDataMessage(
|
|||||||
final var quote = dataMessage.quote().isPresent() ? JsonQuote.from(dataMessage.quote().get()) : null;
|
final var quote = dataMessage.quote().isPresent() ? JsonQuote.from(dataMessage.quote().get()) : null;
|
||||||
final var payment = dataMessage.payment().isPresent() ? JsonPayment.from(dataMessage.payment().get()) : null;
|
final var payment = dataMessage.payment().isPresent() ? JsonPayment.from(dataMessage.payment().get()) : null;
|
||||||
final var mentions = !dataMessage.mentions().isEmpty() ? dataMessage.mentions()
|
final var mentions = !dataMessage.mentions().isEmpty() ? dataMessage.mentions()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonMention::from)
|
.map(JsonMention::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
final var previews = !dataMessage.previews().isEmpty() ? dataMessage.previews()
|
final var previews = !dataMessage.previews().isEmpty() ? dataMessage.previews()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonPreview::from)
|
.map(JsonPreview::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
final var remoteDelete = dataMessage.remoteDeleteId().isPresent()
|
final var remoteDelete = dataMessage.remoteDeleteId().isPresent()
|
||||||
? new JsonRemoteDelete(dataMessage.remoteDeleteId().get())
|
? new JsonRemoteDelete(dataMessage.remoteDeleteId().get())
|
||||||
: null;
|
: null;
|
||||||
final var attachments = !dataMessage.attachments().isEmpty() ? dataMessage.attachments()
|
final var attachments = !dataMessage.attachments().isEmpty() ? dataMessage.attachments()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonAttachment::from)
|
.map(JsonAttachment::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
final var sticker = dataMessage.sticker().isPresent() ? JsonSticker.from(dataMessage.sticker().get()) : null;
|
final var sticker = dataMessage.sticker().isPresent() ? JsonSticker.from(dataMessage.sticker().get()) : null;
|
||||||
final var contacts = !dataMessage.sharedContacts().isEmpty() ? dataMessage.sharedContacts()
|
final var contacts = !dataMessage.sharedContacts().isEmpty() ? dataMessage.sharedContacts()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonSharedContact::from)
|
.map(JsonSharedContact::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
final var pollCreate = dataMessage.pollCreate().map(JsonPollCreate::from).orElse(null);
|
final var pollCreate = dataMessage.pollCreate().map(JsonPollCreate::from).orElse(null);
|
||||||
final var pollVote = dataMessage.pollVote().map(JsonPollVote::from).orElse(null);
|
final var pollVote = dataMessage.pollVote().map(JsonPollVote::from).orElse(null);
|
||||||
final var pollTerminate = dataMessage.pollTerminate().map(JsonPollTerminate::from).orElse(null);
|
final var pollTerminate = dataMessage.pollTerminate().map(JsonPollTerminate::from).orElse(null);
|
||||||
final var textStyles = !dataMessage.textStyles().isEmpty() ? dataMessage.textStyles()
|
final var textStyles = !dataMessage.textStyles().isEmpty() ? dataMessage.textStyles()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonTextStyle::from)
|
.map(JsonTextStyle::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
final var pinMessage = dataMessage.pinMessage().map(JsonPinMessage::from).orElse(null);
|
final var pinMessage = dataMessage.pinMessage().map(JsonPinMessage::from).orElse(null);
|
||||||
final var unpinMessage = dataMessage.unpinMessage().map(JsonUnpinMessage::from).orElse(null);
|
final var unpinMessage = dataMessage.unpinMessage().map(JsonUnpinMessage::from).orElse(null);
|
||||||
final var adminDelete = dataMessage.adminDelete().map(JsonAdminDelete::from).orElse(null);
|
final var adminDelete = dataMessage.adminDelete().map(JsonAdminDelete::from).orElse(null);
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "EditMessage")
|
||||||
record JsonEditMessage(long targetSentTimestamp, JsonDataMessage dataMessage) {
|
record JsonEditMessage(long targetSentTimestamp, JsonDataMessage dataMessage) {
|
||||||
|
|
||||||
static JsonEditMessage from(MessageEnvelope.Edit editMessage, Manager m) {
|
static JsonEditMessage from(MessageEnvelope.Edit editMessage, Manager m) {
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Error")
|
||||||
public record JsonError(String message, String type) {
|
public record JsonError(String message, String type) {
|
||||||
|
|
||||||
public static JsonError from(Throwable exception) {
|
public static JsonError from(Throwable exception) {
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "GroupInfo")
|
||||||
record JsonGroupInfo(String groupId, String groupName, int revision, String type) {
|
record JsonGroupInfo(String groupId, String groupName, int revision, String type) {
|
||||||
|
|
||||||
static JsonGroupInfo from(MessageEnvelope.Data.GroupContext groupContext, Manager m) {
|
static JsonGroupInfo from(MessageEnvelope.Data.GroupContext groupContext, Manager m) {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Mention")
|
||||||
public record JsonMention(@Deprecated String name, String number, String uuid, int start, int length) {
|
public record JsonMention(@Deprecated String name, String number, String uuid, int start, int length) {
|
||||||
|
|
||||||
static JsonMention from(MessageEnvelope.Data.Mention mention) {
|
static JsonMention from(MessageEnvelope.Data.Mention mention) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
@ -10,6 +11,7 @@ import org.asamk.signal.manager.api.UntrustedIdentityException;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "MessageEnvelope")
|
||||||
public record JsonMessageEnvelope(
|
public record JsonMessageEnvelope(
|
||||||
@Deprecated String source,
|
@Deprecated String source,
|
||||||
String sourceNumber,
|
String sourceNumber,
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Payment")
|
||||||
public record JsonPayment(String note, byte[] receipt) {
|
public record JsonPayment(String note, byte[] receipt) {
|
||||||
|
|
||||||
static JsonPayment from(MessageEnvelope.Data.Payment payment) {
|
static JsonPayment from(MessageEnvelope.Data.Payment payment) {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "PinMessage")
|
||||||
public record JsonPinMessage(
|
public record JsonPinMessage(
|
||||||
@Deprecated String targetAuthor,
|
@Deprecated String targetAuthor,
|
||||||
String targetAuthorNumber,
|
String targetAuthorNumber,
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonSchema(title = "PollCreate")
|
||||||
public record JsonPollCreate(
|
public record JsonPollCreate(
|
||||||
String question, boolean allowMultiple, List<String> options
|
String question, boolean allowMultiple, List<String> options
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "PollTerminate")
|
||||||
public record JsonPollTerminate(long targetSentTimestamp) {
|
public record JsonPollTerminate(long targetSentTimestamp) {
|
||||||
|
|
||||||
static JsonPollTerminate from(MessageEnvelope.Data.PollTerminate pollTerminate) {
|
static JsonPollTerminate from(MessageEnvelope.Data.PollTerminate pollTerminate) {
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "PollVote")
|
||||||
public record JsonPollVote(
|
public record JsonPollVote(
|
||||||
@Deprecated String author,
|
@Deprecated String author,
|
||||||
String authorNumber,
|
String authorNumber,
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Preview")
|
||||||
public record JsonPreview(String url, String title, String description, JsonAttachment image) {
|
public record JsonPreview(String url, String title, String description, JsonAttachment image) {
|
||||||
|
|
||||||
static JsonPreview from(MessageEnvelope.Data.Preview preview) {
|
static JsonPreview from(MessageEnvelope.Data.Preview preview) {
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Quote")
|
||||||
public record JsonQuote(
|
public record JsonQuote(
|
||||||
long id,
|
long id,
|
||||||
@Deprecated String author,
|
@Deprecated String author,
|
||||||
@ -31,14 +33,14 @@ public record JsonQuote(
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
final var attachments = !quote.attachments().isEmpty() ? quote.attachments()
|
final var attachments = !quote.attachments().isEmpty() ? quote.attachments()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonQuotedAttachment::from)
|
.map(JsonQuotedAttachment::from)
|
||||||
.toList() : List.<JsonQuotedAttachment>of();
|
.toList() : List.<JsonQuotedAttachment>of();
|
||||||
|
|
||||||
final var textStyles = !quote.textStyles().isEmpty() ? quote.textStyles()
|
final var textStyles = !quote.textStyles().isEmpty() ? quote.textStyles()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonTextStyle::from)
|
.map(JsonTextStyle::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
|
|
||||||
return new JsonQuote(id, author, authorNumber, authorUuid, text, mentions, attachments, textStyles);
|
return new JsonQuote(id, author, authorNumber, authorUuid, text, mentions, attachments, textStyles);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "QuotedAttachment")
|
||||||
public record JsonQuotedAttachment(
|
public record JsonQuotedAttachment(
|
||||||
String contentType, String filename, @JsonInclude(JsonInclude.Include.NON_NULL) JsonAttachment thumbnail
|
String contentType, String filename, @JsonInclude(JsonInclude.Include.NON_NULL) JsonAttachment thumbnail
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Reaction")
|
||||||
public record JsonReaction(
|
public record JsonReaction(
|
||||||
String emoji,
|
String emoji,
|
||||||
@Deprecated String targetAuthor,
|
@Deprecated String targetAuthor,
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonSchema(title = "ReceiptMessage")
|
||||||
record JsonReceiptMessage(long when, boolean isDelivery, boolean isRead, boolean isViewed, List<Long> timestamps) {
|
record JsonReceiptMessage(long when, boolean isDelivery, boolean isRead, boolean isViewed, List<Long> timestamps) {
|
||||||
|
|
||||||
static JsonReceiptMessage from(MessageEnvelope.Receipt receiptMessage) {
|
static JsonReceiptMessage from(MessageEnvelope.Receipt receiptMessage) {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.RecipientAddress;
|
import org.asamk.signal.manager.api.RecipientAddress;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "RecipientAddress")
|
||||||
public record JsonRecipientAddress(String uuid, String number, String username) {
|
public record JsonRecipientAddress(String uuid, String number, String username) {
|
||||||
|
|
||||||
public static JsonRecipientAddress from(RecipientAddress address) {
|
public static JsonRecipientAddress from(RecipientAddress address) {
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
|
@JsonSchema(title = "RemoteDelete")
|
||||||
record JsonRemoteDelete(long timestamp) {}
|
record JsonRemoteDelete(long timestamp) {}
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.GroupId;
|
import org.asamk.signal.manager.api.GroupId;
|
||||||
import org.asamk.signal.manager.api.SendMessageResult;
|
import org.asamk.signal.manager.api.SendMessageResult;
|
||||||
|
|
||||||
|
@JsonSchema(title = "SendMessageResult")
|
||||||
public record JsonSendMessageResult(
|
public record JsonSendMessageResult(
|
||||||
JsonRecipientAddress recipientAddress,
|
JsonRecipientAddress recipientAddress,
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
|
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
|
||||||
@ -23,13 +25,13 @@ public record JsonSendMessageResult(
|
|||||||
result.isSuccess()
|
result.isSuccess()
|
||||||
? Type.SUCCESS
|
? Type.SUCCESS
|
||||||
: result.isRateLimitFailure()
|
: result.isRateLimitFailure()
|
||||||
? Type.RATE_LIMIT_FAILURE
|
? Type.RATE_LIMIT_FAILURE
|
||||||
: result.isNetworkFailure()
|
: result.isNetworkFailure()
|
||||||
? Type.NETWORK_FAILURE
|
? Type.NETWORK_FAILURE
|
||||||
: result.isUnregisteredFailure()
|
: result.isUnregisteredFailure()
|
||||||
? Type.UNREGISTERED_FAILURE
|
? Type.UNREGISTERED_FAILURE
|
||||||
: result.isInvalidPreKeyFailure()
|
: result.isInvalidPreKeyFailure()
|
||||||
? Type.INVALID_PRE_KEY_FAILURE
|
? Type.INVALID_PRE_KEY_FAILURE
|
||||||
: Type.IDENTITY_FAILURE,
|
: Type.IDENTITY_FAILURE,
|
||||||
result.proofRequiredFailure() != null ? result.proofRequiredFailure().getToken() : null,
|
result.proofRequiredFailure() != null ? result.proofRequiredFailure().getToken() : null,
|
||||||
result.proofRequiredFailure() != null ? result.proofRequiredFailure().getRetryAfterSeconds() : null);
|
result.proofRequiredFailure() != null ? result.proofRequiredFailure().getRetryAfterSeconds() : null);
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonSchema(title = "SharedContact")
|
||||||
public record JsonSharedContact(
|
public record JsonSharedContact(
|
||||||
JsonContactName name,
|
JsonContactName name,
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonContactAvatar avatar,
|
@JsonInclude(JsonInclude.Include.NON_NULL) JsonContactAvatar avatar,
|
||||||
@ -28,9 +30,9 @@ public record JsonSharedContact(
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
final var address = !contact.address().isEmpty() ? contact.address()
|
final var address = !contact.address().isEmpty() ? contact.address()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonContactAddress::from)
|
.map(JsonContactAddress::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
|
|
||||||
final var organization = contact.organization().orElse(null);
|
final var organization = contact.organization().orElse(null);
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
import org.asamk.signal.util.Hex;
|
import org.asamk.signal.util.Hex;
|
||||||
|
|
||||||
|
@JsonSchema(title = "Sticker")
|
||||||
public record JsonSticker(String packId, int stickerId) {
|
public record JsonSticker(String packId, int stickerId) {
|
||||||
|
|
||||||
static JsonSticker from(MessageEnvelope.Data.Sticker sticker) {
|
static JsonSticker from(MessageEnvelope.Data.Sticker sticker) {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "StoryContext")
|
||||||
record JsonStoryContext(
|
record JsonStoryContext(
|
||||||
String authorNumber, String authorUuid, long sentTimestamp
|
String authorNumber, String authorUuid, long sentTimestamp
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.Color;
|
import org.asamk.signal.manager.api.Color;
|
||||||
import org.asamk.signal.manager.api.GroupId;
|
import org.asamk.signal.manager.api.GroupId;
|
||||||
@ -8,6 +9,7 @@ import org.asamk.signal.manager.api.MessageEnvelope;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonSchema(title = "StoryMessage")
|
||||||
record JsonStoryMessage(
|
record JsonStoryMessage(
|
||||||
boolean allowsReplies,
|
boolean allowsReplies,
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
|
@JsonInclude(JsonInclude.Include.NON_NULL) String groupId,
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package org.asamk.signal.json;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
@ -9,6 +10,7 @@ import org.asamk.signal.manager.api.RecipientAddress;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "SyncDataMessage")
|
||||||
record JsonSyncDataMessage(
|
record JsonSyncDataMessage(
|
||||||
@Deprecated String destination,
|
@Deprecated String destination,
|
||||||
String destinationNumber,
|
String destinationNumber,
|
||||||
|
|||||||
@ -9,12 +9,15 @@ import org.asamk.signal.manager.api.RecipientAddress;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
enum JsonSyncMessageType {
|
enum JsonSyncMessageType {
|
||||||
CONTACTS_SYNC,
|
CONTACTS_SYNC,
|
||||||
GROUPS_SYNC,
|
GROUPS_SYNC,
|
||||||
REQUEST_SYNC
|
REQUEST_SYNC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonSchema(title = "SyncMessage")
|
||||||
record JsonSyncMessage(
|
record JsonSyncMessage(
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSyncDataMessage sentMessage,
|
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSyncDataMessage sentMessage,
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSyncStoryMessage sentStoryMessage,
|
@JsonInclude(JsonInclude.Include.NON_NULL) JsonSyncStoryMessage sentStoryMessage,
|
||||||
@ -47,9 +50,9 @@ record JsonSyncMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
final var readMessages = !syncMessage.read().isEmpty() ? syncMessage.read()
|
final var readMessages = !syncMessage.read().isEmpty() ? syncMessage.read()
|
||||||
.stream()
|
.stream()
|
||||||
.map(JsonSyncReadMessage::from)
|
.map(JsonSyncReadMessage::from)
|
||||||
.toList() : null;
|
.toList() : null;
|
||||||
|
|
||||||
final JsonSyncMessageType type;
|
final JsonSyncMessageType type;
|
||||||
if (syncMessage.contacts().isPresent()) {
|
if (syncMessage.contacts().isPresent()) {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "SyncReadMessage")
|
||||||
record JsonSyncReadMessage(
|
record JsonSyncReadMessage(
|
||||||
@Deprecated String sender, String senderNumber, String senderUuid, long timestamp
|
@Deprecated String sender, String senderNumber, String senderUuid, long timestamp
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "SyncStoryMessage")
|
||||||
record JsonSyncStoryMessage(
|
record JsonSyncStoryMessage(
|
||||||
String destinationNumber, String destinationUuid, @JsonUnwrapped JsonStoryMessage dataMessage
|
String destinationNumber, String destinationUuid, @JsonUnwrapped JsonStoryMessage dataMessage
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.TextStyle;
|
import org.asamk.signal.manager.api.TextStyle;
|
||||||
|
|
||||||
|
@JsonSchema(title = "TextStyle")
|
||||||
public record JsonTextStyle(String style, int start, int length) {
|
public record JsonTextStyle(String style, int start, int length) {
|
||||||
|
|
||||||
static JsonTextStyle from(TextStyle textStyle) {
|
static JsonTextStyle from(TextStyle textStyle) {
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.GroupId;
|
import org.asamk.signal.manager.api.GroupId;
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
|
@JsonSchema(title = "TypingMessage")
|
||||||
record JsonTypingMessage(
|
record JsonTypingMessage(
|
||||||
String action, long timestamp, @JsonInclude(JsonInclude.Include.NON_NULL) String groupId
|
String action, long timestamp, @JsonInclude(JsonInclude.Include.NON_NULL) String groupId
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
package org.asamk.signal.json;
|
package org.asamk.signal.json;
|
||||||
|
|
||||||
|
import io.micronaut.jsonschema.JsonSchema;
|
||||||
|
|
||||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@JsonSchema(title = "UnpinMessage")
|
||||||
public record JsonUnpinMessage(
|
public record JsonUnpinMessage(
|
||||||
@Deprecated String targetAuthor, String targetAuthorNumber, String targetAuthorUuid, long targetSentTimestamp
|
@Deprecated String targetAuthor, String targetAuthorNumber, String targetAuthorUuid, long targetSentTimestamp
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -2,11 +2,8 @@ package org.asamk.signal.json;
|
|||||||
|
|
||||||
import org.asamk.signal.manager.api.CallInfo;
|
import org.asamk.signal.manager.api.CallInfo;
|
||||||
import org.asamk.signal.manager.api.RecipientAddress;
|
import org.asamk.signal.manager.api.RecipientAddress;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
@ -17,7 +14,12 @@ class JsonCallEventTest {
|
|||||||
@Test
|
@Test
|
||||||
void fromWithNumberAndUuid() {
|
void fromWithNumberAndUuid() {
|
||||||
var recipient = new RecipientAddress("a1b2c3d4-e5f6-7890-abcd-ef1234567890", null, "+15551234567", null);
|
var recipient = new RecipientAddress("a1b2c3d4-e5f6-7890-abcd-ef1234567890", null, "+15551234567", null);
|
||||||
var callInfo = new CallInfo(123L, CallInfo.State.CONNECTED, recipient, "signal_input_123", "signal_output_123", true);
|
var callInfo = new CallInfo(123L,
|
||||||
|
CallInfo.State.CONNECTED,
|
||||||
|
recipient,
|
||||||
|
"signal_input_123",
|
||||||
|
"signal_output_123",
|
||||||
|
true);
|
||||||
|
|
||||||
var event = JsonCallEvent.from(callInfo, null);
|
var event = JsonCallEvent.from(callInfo, null);
|
||||||
|
|
||||||
@ -34,7 +36,12 @@ class JsonCallEventTest {
|
|||||||
@Test
|
@Test
|
||||||
void fromWithUuidOnly() {
|
void fromWithUuidOnly() {
|
||||||
var recipient = new RecipientAddress("a1b2c3d4-e5f6-7890-abcd-ef1234567890", null, null, null);
|
var recipient = new RecipientAddress("a1b2c3d4-e5f6-7890-abcd-ef1234567890", null, null, null);
|
||||||
var callInfo = new CallInfo(456L, CallInfo.State.RINGING_INCOMING, recipient, "signal_input_456", "signal_output_456", false);
|
var callInfo = new CallInfo(456L,
|
||||||
|
CallInfo.State.RINGING_INCOMING,
|
||||||
|
recipient,
|
||||||
|
"signal_input_456",
|
||||||
|
"signal_output_456",
|
||||||
|
false);
|
||||||
|
|
||||||
var event = JsonCallEvent.from(callInfo, null);
|
var event = JsonCallEvent.from(callInfo, null);
|
||||||
|
|
||||||
@ -48,7 +55,12 @@ class JsonCallEventTest {
|
|||||||
@Test
|
@Test
|
||||||
void fromWithNumberOnly() {
|
void fromWithNumberOnly() {
|
||||||
var recipient = new RecipientAddress(null, null, "+15559876543", null);
|
var recipient = new RecipientAddress(null, null, "+15559876543", null);
|
||||||
var callInfo = new CallInfo(789L, CallInfo.State.RINGING_OUTGOING, recipient, "signal_input_789", "signal_output_789", true);
|
var callInfo = new CallInfo(789L,
|
||||||
|
CallInfo.State.RINGING_OUTGOING,
|
||||||
|
recipient,
|
||||||
|
"signal_input_789",
|
||||||
|
"signal_output_789",
|
||||||
|
true);
|
||||||
|
|
||||||
var event = JsonCallEvent.from(callInfo, null);
|
var event = JsonCallEvent.from(callInfo, null);
|
||||||
|
|
||||||
@ -81,7 +93,12 @@ class JsonCallEventTest {
|
|||||||
@Test
|
@Test
|
||||||
void fromConnectingState() {
|
void fromConnectingState() {
|
||||||
var recipient = new RecipientAddress("uuid-5678", null, "+15552222222", null);
|
var recipient = new RecipientAddress("uuid-5678", null, "+15552222222", null);
|
||||||
var callInfo = new CallInfo(200L, CallInfo.State.CONNECTING, recipient, "signal_input_200", "signal_output_200", true);
|
var callInfo = new CallInfo(200L,
|
||||||
|
CallInfo.State.CONNECTING,
|
||||||
|
recipient,
|
||||||
|
"signal_input_200",
|
||||||
|
"signal_output_200",
|
||||||
|
true);
|
||||||
|
|
||||||
var event = JsonCallEvent.from(callInfo, null);
|
var event = JsonCallEvent.from(callInfo, null);
|
||||||
|
|
||||||
@ -97,8 +114,17 @@ class JsonCallEventTest {
|
|||||||
void fromWithVariousEndReasons() {
|
void fromWithVariousEndReasons() {
|
||||||
var recipient = new RecipientAddress("uuid-1234", null, "+15551111111", null);
|
var recipient = new RecipientAddress("uuid-1234", null, "+15551111111", null);
|
||||||
|
|
||||||
var reasons = new String[]{"local_hangup", "remote_hangup", "rejected", "remote_busy",
|
var reasons = new String[]{
|
||||||
"ring_timeout", "ice_failed", "tunnel_exit", "tunnel_error", "shutdown"};
|
"local_hangup",
|
||||||
|
"remote_hangup",
|
||||||
|
"rejected",
|
||||||
|
"remote_busy",
|
||||||
|
"ring_timeout",
|
||||||
|
"ice_failed",
|
||||||
|
"tunnel_exit",
|
||||||
|
"tunnel_error",
|
||||||
|
"shutdown"
|
||||||
|
};
|
||||||
|
|
||||||
for (var reason : reasons) {
|
for (var reason : reasons) {
|
||||||
var callInfo = new CallInfo(1L, CallInfo.State.ENDED, recipient, null, null, false);
|
var callInfo = new CallInfo(1L, CallInfo.State.ENDED, recipient, null, null, false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user