final Boolean linkPreviews
) throws IOException, NotMasterDeviceException;
+ List<Boolean> getConfiguration() throws IOException, NotMasterDeviceException;
+
void setProfile(
String givenName, String familyName, String about, String aboutEmoji, Optional<File> avatar
) throws IOException;
syncHelper.sendConfigurationMessage();
}
+ @Override
+ public List<Boolean> getConfiguration() throws IOException, NotMasterDeviceException {
+ if (!account.isMasterDevice()) {
+ throw new NotMasterDeviceException();
+ }
+ final var configurationStore = account.getConfigurationStore();
+ final Boolean readReceipts = configurationStore.getReadReceipts();
+ final Boolean unidentifiedDeliveryIndicators = configurationStore.getUnidentifiedDeliveryIndicators();
+ final Boolean typingIndicators = configurationStore.getTypingIndicators();
+ final Boolean linkPreviews = configurationStore.getLinkPreviews();
+ return List.of(readReceipts, unidentifiedDeliveryIndicators, typingIndicators, linkPreviews);
+ }
+
/**
* @param givenName if null, the previous givenName will be kept
* @param familyName if null, the previous familyName will be kept
Where <type> is according to DBus specification:
-* <a> : Array of ... (comma-separated list)
+* <a> : Array of ... (comma-separated list, array:)
* (...) : Struct (cannot be sent via `dbus-send`)
* <b> : Boolean (false|true) (boolean:)
* <i> : Signed 32-bit (int) integer (int32:)
getContactName(number<s>) -> name<s>::
* number : Phone number
-* name : Contact's name in local storage (from the master device for a linked account, or the one set with setContactName); if not set, contact's profile name is used
+* name : Contact's name in local storage (from the primary device for a linked account, or the one set with setContactName); if not set, contact's profile name is used
setContactName(number<s>,name<>) -> <>::
* number : Phone number
* stickerPackPath : Path to the manifest.json file or a zip file in the same directory
* url : URL of sticker pack after successful upload
-Exception: Failure
+Exception: Failure, IOError
+
+getConfiguration() -> [readReceipts<b>, unidentifiedDeliveryIndicators<b>, typingIndicators<b>, linkPreviews<b>] -> <>::
+* readReceipts : Should Signal send read receipts (true/false).
+* unidentifiedDeliveryIndicators : Should Signal show unidentified delivery indicators (true/false).
+* typingIndicators : Should Signal send/show typing indicators (true/false).
+* linkPreviews : Should Signal generate link previews (true/false).
+
+Gets an array of four booleans as indicated. Only works from primary device.
+
+Exceptions: IOError, UserError
+
+setConfiguration(readReceipts<b>, unidentifiedDeliveryIndicators<b>, typingIndicators<b>, linkPreviews<b>) -> <>::
+* readReceipts : Should Signal send read receipts (true/false).
+* unidentifiedDeliveryIndicators : Should Signal show unidentified delivery indicators (true/false).
+* typingIndicators : Should Signal send/show typing indicators (true/false).
+* linkPreviews : Should Signal generate link previews (true/false).
+
+Update Signal configurations and sync them to linked devices. Only works from primary device.
+
+Exceptions: IOError, UserError
submitRateLimitChallenge(challenge<s>, captcha<s>) -> <>::
* challenge : The challenge token taken from the proof required error.
String uploadStickerPack(String stickerPackPath) throws Error.Failure;
+ void setConfiguration(boolean readReceipts, boolean unidentifiedDeliveryIndicators, boolean typingIndicators, boolean linkPreviews) throws Error.IOError, Error.UserError;
+
+ List<Boolean> getConfiguration();
+
void submitRateLimitChallenge(String challenge, String captchaString) throws IOErrorException;
class MessageReceived extends DBusSignal {
super(message);
}
}
+
+ class IOError extends DBusExecutionException {
+
+ public IOError(final String message) {
+ super(message);
+ }
+ }
+
+ class UserError extends DBusExecutionException {
+
+ public UserError(final String message) {
+ super(message);
+ }
+ }
}
}
final Boolean typingIndicators,
final Boolean linkPreviews
) throws IOException {
- throw new UnsupportedOperationException();
+ signal.setConfiguration(
+ readReceipts,
+ unidentifiedDeliveryIndicators,
+ typingIndicators,
+ linkPreviews
+ );
+ }
+
+ @Override
+ public List<Boolean> getConfiguration() {
+ return signal.getConfiguration();
}
@Override
try {
return m.uploadStickerPack(path).toString();
} catch (IOException e) {
- throw new Error.Failure("Upload error (maybe image size is too large):" + e.getMessage());
+ throw new Error.IOError("Upload error (maybe image size is too large):" + e.getMessage());
} catch (StickerPackInvalidException e) {
throw new Error.Failure("Invalid sticker pack: " + e.getMessage());
}
}
+ @Override
+ public void setConfiguration(boolean readReceipts, boolean unidentifiedDeliveryIndicators, boolean typingIndicators, boolean linkPreviews) {
+ try {
+ m.updateConfiguration(readReceipts, unidentifiedDeliveryIndicators, typingIndicators, linkPreviews);
+ } catch (IOException e) {
+ throw new Error.IOError("UpdateAccount error: " + e.getMessage());
+ } catch (NotMasterDeviceException e) {
+ throw new Error.UserError("This command doesn't work on linked devices.");
+ }
+ }
+
+ @Override
+ public List<Boolean> getConfiguration() {
+ List<Boolean> config = new ArrayList<>(4);
+ try {
+ config = m.getConfiguration();
+ } catch (IOException e) {
+ throw new Error.IOError("Configuration storage error: " + e.getMessage());
+ } catch (NotMasterDeviceException e) {
+ throw new Error.UserError("This command doesn't work on linked devices.");
+ }
+ return config;
+ }
+
private static void checkSendMessageResult(long timestamp, SendMessageResult result) throws DBusExecutionException {
var error = ErrorUtils.getErrorMessageFromSendMessageResult(result);