import org.asamk.signal.manager.groups.GroupId;
import org.asamk.signal.manager.groups.GroupNotFoundException;
import org.asamk.signal.manager.groups.NotAGroupMemberException;
import org.asamk.signal.manager.groups.GroupId;
import org.asamk.signal.manager.groups.GroupNotFoundException;
import org.asamk.signal.manager.groups.NotAGroupMemberException;
import org.asamk.signal.util.ErrorUtils;
import org.freedesktop.dbus.exceptions.DBusExecutionException;
import org.asamk.signal.util.ErrorUtils;
import org.freedesktop.dbus.exceptions.DBusExecutionException;
import org.whispersystems.signalservice.api.messages.SendMessageResult;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.util.InvalidNumberException;
import org.whispersystems.signalservice.api.messages.SendMessageResult;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.util.InvalidNumberException;
@Override
public long sendMessage(final String message, final List<String> attachments, final String recipient) {
@Override
public long sendMessage(final String message, final List<String> attachments, final String recipient) {
recipients.add(recipient);
return sendMessage(message, attachments, recipients);
}
private static void checkSendMessageResult(long timestamp, SendMessageResult result) throws DBusExecutionException {
recipients.add(recipient);
return sendMessage(message, attachments, recipients);
}
private static void checkSendMessageResult(long timestamp, SendMessageResult result) throws DBusExecutionException {
@Override
public long sendMessage(final String message, final List<String> attachments, final List<String> recipients) {
try {
@Override
public long sendMessage(final String message, final List<String> attachments, final List<String> recipients) {
try {
- final Pair<Long, List<SendMessageResult>> results = m.sendMessage(message, attachments, recipients);
+ final var results = m.sendMessage(message, attachments, recipients);
checkSendMessageResults(results.first(), results.second());
return results.first();
} catch (InvalidNumberException e) {
checkSendMessageResults(results.first(), results.second());
return results.first();
} catch (InvalidNumberException e) {
final String message, final List<String> attachments
) throws Error.AttachmentInvalid, Error.Failure, Error.UntrustedIdentity {
try {
final String message, final List<String> attachments
) throws Error.AttachmentInvalid, Error.Failure, Error.UntrustedIdentity {
try {
checkSendMessageResult(results.first(), results.second());
return results.first();
} catch (AttachmentInvalidException e) {
checkSendMessageResult(results.first(), results.second());
return results.first();
} catch (AttachmentInvalidException e) {
checkSendMessageResults(results.first(), results.second());
} catch (IOException e) {
throw new Error.Failure(e.getMessage());
checkSendMessageResults(results.first(), results.second());
} catch (IOException e) {
throw new Error.Failure(e.getMessage());
@Override
public long sendGroupMessage(final String message, final List<String> attachments, final byte[] groupId) {
try {
@Override
public long sendGroupMessage(final String message, final List<String> attachments, final byte[] groupId) {
try {
- Pair<Long, List<SendMessageResult>> results = m.sendGroupMessage(message,
- attachments,
- GroupId.unknownVersion(groupId));
+ var results = m.sendGroupMessage(message, attachments, GroupId.unknownVersion(groupId));
checkSendMessageResults(results.first(), results.second());
return results.first();
} catch (IOException e) {
checkSendMessageResults(results.first(), results.second());
return results.first();
} catch (IOException e) {
- List<GroupInfo> groups = m.getGroups();
- List<byte[]> ids = new ArrayList<>(groups.size());
- for (GroupInfo group : groups) {
+ var groups = m.getGroups();
+ var ids = new ArrayList<byte[]>(groups.size());
+ for (var group : groups) {
- final Pair<GroupId, List<SendMessageResult>> results = m.updateGroup(groupId == null
- ? null
- : GroupId.unknownVersion(groupId), name, members, avatar == null ? null : new File(avatar));
+ final var results = m.updateGroup(groupId == null ? null : GroupId.unknownVersion(groupId),
+ name,
+ members,
+ avatar == null ? null : new File(avatar));
checkSendMessageResults(0, results.second());
return results.first().serialize();
} catch (IOException e) {
checkSendMessageResults(0, results.second());
return results.first().serialize();
} catch (IOException e) {
- public void updateProfile(final String name,final String about,final String aboutEmoji, String avatarPath, final boolean removeAvatar) {
+ public void updateProfile(
+ final String name,
+ final String about,
+ final String aboutEmoji,
+ String avatarPath,
+ final boolean removeAvatar
+ ) {