Merge branch 'AsamK:master' into master

This commit is contained in:
Adimarantis 2021-09-05 18:45:07 +02:00 committed by GitHub
commit f2c7c60669
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 1146 additions and 86 deletions

View file

@ -82,6 +82,12 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
DateUtils.formatTimestamp(content.getServerReceivedTimestamp()),
DateUtils.formatTimestamp(content.getServerDeliveredTimestamp()));
if (content.getSenderKeyDistributionMessage().isPresent()) {
final var message = content.getSenderKeyDistributionMessage().get();
writer.println("Received a sender key distribution message for distributionId {}",
message.getDistributionId());
}
if (content.getDataMessage().isPresent()) {
var message = content.getDataMessage().get();
printDataMessage(writer, message);
@ -235,6 +241,13 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
final var deviceId = callMessage.getDestinationDeviceId().get();
writer.println("Destination device id: {}", deviceId);
}
if (callMessage.getGroupId().isPresent()) {
final var groupId = GroupId.unknownVersion(callMessage.getGroupId().get());
writer.println("Destination group id: {}", groupId);
}
if (callMessage.getTimestamp().isPresent()) {
writer.println("Timestamp: {}", DateUtils.formatTimestamp(callMessage.getTimestamp().get()));
}
if (callMessage.getAnswerMessage().isPresent()) {
var answerMessage = callMessage.getAnswerMessage().get();
writer.println("Answer message: {}, sdp: {})", answerMessage.getId(), answerMessage.getSdp());
@ -260,7 +273,9 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
}
if (callMessage.getOpaqueMessage().isPresent()) {
final var opaqueMessage = callMessage.getOpaqueMessage().get();
writer.println("Opaque message: size {}", opaqueMessage.getOpaque().length);
writer.println("Opaque message: size {}, urgency: {}",
opaqueMessage.getOpaque().length,
opaqueMessage.getUrgency().name());
}
}

View file

@ -75,6 +75,16 @@ public class JsonRpcDispatcherCommand implements LocalCommand {
objectMapper.valueToTree(s),
null)), m, ignoreAttachments);
// Maybe this should be handled inside the Manager
while (!m.hasCaughtUpWithOldMessages()) {
try {
synchronized (m) {
m.wait();
}
} catch (InterruptedException ignored) {
}
}
final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
final var jsonRpcReader = new JsonRpcReader(jsonRpcSender, () -> {

View file

@ -20,14 +20,16 @@ public class UpdateAccountCommand implements JsonRpcLocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.help("Update the account attributes on the signal server.");
subparser.addArgument("-n", "--device-name").help("Specify a name to describe this device.");
}
@Override
public void handleCommand(
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
var deviceName = ns.getString("device-name");
try {
m.updateAccountAttributes();
m.updateAccountAttributes(deviceName);
} catch (IOException e) {
throw new IOErrorException("UpdateAccount error: " + e.getMessage());
}