import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-class Manager {
+class Manager implements TextSecure {
private final static String URL = "https://textsecure-service.whispersystems.org";
private final static TrustStore TRUST_STORE = new WhisperTrustStore();
return new TextSecureAttachmentStream(attachmentStream, mime, attachmentSize, null);
}
+ @Override
public void sendGroupMessage(String messageText, List<String> attachments,
byte[] groupId)
throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException {
return g.groupId;
}
+ @Override
+ public void sendMessage(String message, List<String> attachments, String recipient)
+ throws EncapsulatedExceptions, AttachmentInvalidException, IOException {
+ List<String> recipients = new ArrayList<>(1);
+ recipients.add(recipient);
+ sendMessage(message, attachments, recipients);
+ }
+
public void sendMessage(String messageText, List<String> attachments,
Collection<String> recipients)
- throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException {
+ throws IOException, EncapsulatedExceptions, AttachmentInvalidException {
final TextSecureDataMessage.Builder messageBuilder = TextSecureDataMessage.newBuilder().withBody(messageText);
if (attachments != null) {
messageBuilder.withAttachments(getTextSecureAttachments(attachments));
handleEndSession(recipient.getNumber());
}
}
+ save();
}
private TextSecureContent decryptMessage(TextSecureEnvelope envelope) {
}
}
}
+ save();
handler.handleMessage(envelope, content, group);
} catch (TimeoutException e) {
if (returnOnTimeout)
} catch (InvalidVersionException e) {
System.err.println("Ignoring error: " + e.getMessage());
}
- save();
}
} finally {
if (messagePipe != null)
private void setGroupInfo(GroupInfo group) {
groupStore.updateGroup(group);
}
+
+ @Override
+ public boolean isRemote() {
+ return false;
+ }
}