Commit e7bd984e authored by Finn Herzfeld's avatar Finn Herzfeld 🌵

Upgrade dependency com.github.turasa:signal-service-java

parent fe45b891
......@@ -33,7 +33,7 @@ configurations {
}
dependencies {
compile 'com.github.turasa:signal-service-java:2.13.0_unofficial_2'
compile 'com.github.turasa:signal-service-java:2.13.9_unofficial_1'
compile 'org.bouncycastle:bcprov-jdk15on:1.64'
compile 'com.kohlschutter.junixsocket:junixsocket-common:2.2.0'
compile 'com.kohlschutter.junixsocket:junixsocket-native-common:2.2.0'
......
......@@ -38,6 +38,7 @@ class JsonAttachment {
String preview;
String key;
String digest;
String blurhash;
JsonAttachment() {}
......@@ -73,6 +74,10 @@ class JsonAttachment {
this.caption = pointer.getCaption().get();
}
if(pointer.getBlurHash().isPresent()) {
this.blurhash = pointer.getBlurHash().get();
}
if( m != null) {
File file = m.getAttachmentFile(pointer.getId());
if( file.exists()) {
......
......@@ -26,12 +26,9 @@ class JsonUntrustedIdentityException {
public String fingerprint;
public String safety_number;
JsonUntrustedIdentityException(UntrustedIdentityException e, Manager m) {
this.number = e.getE164Number();
IdentityKey key = e.getIdentityKey();
JsonUntrustedIdentityException(IdentityKey key, String number, Manager m) {
this.number = number;
this.fingerprint = Hex.toStringCondensed(key.getPublicKey().serialize());
this.safety_number = m.computeSafetyNumber(this.number, key);
}
}
This diff is collapsed.
......@@ -23,6 +23,7 @@ import org.whispersystems.signalservice.internal.util.Base64;
import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.push.ContactTokenDetails;
import org.whispersystems.signalservice.api.messages.SendMessageResult;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentStream;
......@@ -30,7 +31,6 @@ import org.whispersystems.signalservice.api.push.exceptions.NetworkFailureExcept
import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserException;
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
import org.asamk.signal.AttachmentInvalidException;
import org.asamk.signal.UserAlreadyExists;
import org.asamk.signal.GroupNotFoundException;
......@@ -230,7 +230,7 @@ public class SocketHandler implements Runnable {
mime = "application/octet-stream";
}
attachments.add(new SignalServiceAttachmentStream(attachmentStream, mime, attachmentSize, Optional.of(attachmentFile.getName()), attachment.voiceNote, attachment.getPreview(), attachment.width, attachment.height, Optional.fromNullable(attachment.caption), null));
attachments.add(new SignalServiceAttachmentStream(attachmentStream, mime, attachmentSize, Optional.of(attachmentFile.getName()), attachment.voiceNote, attachment.getPreview(), attachment.width, attachment.height, Optional.fromNullable(attachment.caption), Optional.fromNullable(attachment.blurhash), null));
} catch (IOException e) {
throw new AttachmentInvalidException(attachment.filename, e);
}
......@@ -238,17 +238,41 @@ public class SocketHandler implements Runnable {
}
try {
List<SendMessageResult> sendMessageResults;
if(request.recipientGroupId != null) {
byte[] groupId = Base64.decode(request.recipientGroupId);
manager.sendGroupMessage(request.messageBody, attachments, groupId, quote);
sendMessageResults = manager.sendGroupMessage(request.messageBody, attachments, groupId, quote);
} else {
manager.sendMessage(request.messageBody, attachments, request.recipientNumber, quote);
sendMessageResults = manager.sendMessage(request.messageBody, attachments, request.recipientNumber, quote);
}
this.reply("success", new JsonStatusMessage(0, "success"), request.id);
} catch(EncapsulatedExceptions e) {
for(UntrustedIdentityException i: e.getUntrustedIdentityExceptions()) {
this.reply("untrusted_identity", new JsonUntrustedIdentityException(i, manager), request.id);
for(SendMessageResult result: sendMessageResults) {
SendMessageResult.Success success = result.getSuccess();
if(success != null) {
if(success.isUnidentified()) {
this.reply("success", new JsonStatusMessage(0, "successfully send unidentified message"), request.id);
}
if(success.isNeedsSync()) {
this.reply("success", new JsonStatusMessage(1, "isNeedsSync = true"), request.id);
}
}
if(result.isNetworkFailure()) {
// TODO: Log more info about what message failed, who it failed to, and any other info needed to resend
this.reply("network_failure", null, request.id);
}
if(result.isUnregisteredFailure()) {
this.reply("unregistered_user", null, request.id);
}
SendMessageResult.IdentityFailure identityFailure = result.getIdentityFailure();
if(identityFailure != null) {
this.reply("untrusted_identity", new JsonUntrustedIdentityException(identityFailure.getIdentityKey(), result.getAddress().getNumber(), manager), request.id);
}
}
} catch(EncapsulatedExceptions e) {
for(UnregisteredUserException i: e.getUnregisteredUserExceptions()) {
this.reply("unregistered_user", new JsonUnregisteredUserException(i), request.id);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment