mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-09-01 06:28:11 +00:00
Merge branch 'master' into signal-call-tunnel
This commit is contained in:
commit
318f6f1ffc
11
CHANGELOG.md
11
CHANGELOG.md
@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.14.1] - 2026-03-08
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added isArchived to contact json output (Thanks @moppman)
|
||||||
|
- Added support for group member labels
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Adapt registration to signal server changes
|
||||||
|
|
||||||
## [0.14.0] - 2026-03-01
|
## [0.14.0] - 2026-03-01
|
||||||
|
|
||||||
**Attention**: Now requires Java 25
|
**Attention**: Now requires Java 25
|
||||||
|
|||||||
@ -10,7 +10,7 @@ If you have a question you can ask it in the [GitHub discussions page](https://g
|
|||||||
- Be sure to include a **title and clear description**, as much relevant information as possible.
|
- Be sure to include a **title and clear description**, as much relevant information as possible.
|
||||||
- Specify the versions of signal-cli, libsignal-client (if self-compiled), JDK and OS you're using
|
- Specify the versions of signal-cli, libsignal-client (if self-compiled), JDK and OS you're using
|
||||||
- Specify if it's the normal java or the graalvm native version.
|
- Specify if it's the normal java or the graalvm native version.
|
||||||
- Run the failing command with `--verbose` flag to get a more detailed log output and include that in the bug report
|
- Run the failing command with `-vv --scrub-log` flags to get a more detailed log output and include that in the bug report
|
||||||
|
|
||||||
# Pull request
|
# Pull request
|
||||||
|
|
||||||
|
|||||||
@ -3,12 +3,12 @@ plugins {
|
|||||||
application
|
application
|
||||||
eclipse
|
eclipse
|
||||||
`check-lib-versions`
|
`check-lib-versions`
|
||||||
id("org.graalvm.buildtools.native") version "0.11.4"
|
id("org.graalvm.buildtools.native") version "0.11.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "org.asamk"
|
group = "org.asamk"
|
||||||
version = "0.14.1-SNAPSHOT"
|
version = "0.14.2-SNAPSHOT"
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
|
|||||||
4
client/Cargo.lock
generated
4
client/Cargo.lock
generated
@ -897,9 +897,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustls-webpki"
|
name = "rustls-webpki"
|
||||||
version = "0.103.9"
|
version = "0.103.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53"
|
checksum = "df33b2b81ac578cabaf06b89b0631153a3f416b0a886e8a7a1707fb51abbd1ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ring",
|
"ring",
|
||||||
"rustls-pki-types",
|
"rustls-pki-types",
|
||||||
|
|||||||
@ -598,6 +598,12 @@ pub enum CliCommands {
|
|||||||
|
|
||||||
#[arg(short = 'e', long)]
|
#[arg(short = 'e', long)]
|
||||||
expiration: Option<u32>,
|
expiration: Option<u32>,
|
||||||
|
|
||||||
|
#[arg(long = "member-label-emoji")]
|
||||||
|
member_label_emoji: Option<String>,
|
||||||
|
|
||||||
|
#[arg(long = "member-label")]
|
||||||
|
member_label: Option<String>,
|
||||||
},
|
},
|
||||||
UpdateProfile {
|
UpdateProfile {
|
||||||
#[arg(long = "given-name")]
|
#[arg(long = "given-name")]
|
||||||
|
|||||||
@ -460,6 +460,8 @@ pub trait Rpc {
|
|||||||
#[allow(non_snake_case)] setPermissionEditDetails: Option<String>,
|
#[allow(non_snake_case)] setPermissionEditDetails: Option<String>,
|
||||||
#[allow(non_snake_case)] setPermissionSendMessages: Option<String>,
|
#[allow(non_snake_case)] setPermissionSendMessages: Option<String>,
|
||||||
expiration: Option<u32>,
|
expiration: Option<u32>,
|
||||||
|
#[allow(non_snake_case)] memberLabelEmoji: Option<String>,
|
||||||
|
#[allow(non_snake_case)] memberLabel: Option<String>,
|
||||||
) -> Result<Value, ErrorObjectOwned>;
|
) -> Result<Value, ErrorObjectOwned>;
|
||||||
|
|
||||||
#[method(name = "updateProfile", param_kind = map)]
|
#[method(name = "updateProfile", param_kind = map)]
|
||||||
|
|||||||
@ -535,6 +535,8 @@ async fn handle_command(
|
|||||||
set_permission_edit_details,
|
set_permission_edit_details,
|
||||||
set_permission_send_messages,
|
set_permission_send_messages,
|
||||||
expiration,
|
expiration,
|
||||||
|
member_label_emoji,
|
||||||
|
member_label,
|
||||||
} => {
|
} => {
|
||||||
client
|
client
|
||||||
.update_group(
|
.update_group(
|
||||||
@ -568,6 +570,8 @@ async fn handle_command(
|
|||||||
GroupPermission::OnlyAdmins => "onlyAdmins".to_owned(),
|
GroupPermission::OnlyAdmins => "onlyAdmins".to_owned(),
|
||||||
}),
|
}),
|
||||||
expiration,
|
expiration,
|
||||||
|
member_label_emoji,
|
||||||
|
member_label,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,9 @@
|
|||||||
<content_attribute id="social-chat">intense</content_attribute>
|
<content_attribute id="social-chat">intense</content_attribute>
|
||||||
</content_rating>
|
</content_rating>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="0.14.1" date="2026-03-08">
|
||||||
|
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.1</url>
|
||||||
|
</release>
|
||||||
<release version="0.14.0" date="2026-03-01">
|
<release version="0.14.0" date="2026-03-01">
|
||||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.0</url>
|
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.0</url>
|
||||||
</release>
|
</release>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
|||||||
slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
|
slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
|
||||||
logback = "ch.qos.logback:logback-classic:1.5.32"
|
logback = "ch.qos.logback:logback-classic:1.5.32"
|
||||||
|
|
||||||
signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_140"
|
signalservice = "com.github.turasa:signal-service-java:2.15.3_unofficial_141"
|
||||||
sqlite = "org.xerial:sqlite-jdbc:3.51.2.0"
|
sqlite = "org.xerial:sqlite-jdbc:3.51.2.0"
|
||||||
hikari = "com.zaxxer:HikariCP:7.0.2"
|
hikari = "com.zaxxer:HikariCP:7.0.2"
|
||||||
junit-jupiter-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
|
junit-jupiter-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@ -12,10 +12,9 @@ public record Group(
|
|||||||
String title,
|
String title,
|
||||||
String description,
|
String description,
|
||||||
GroupInviteLinkUrl groupInviteLinkUrl,
|
GroupInviteLinkUrl groupInviteLinkUrl,
|
||||||
Set<RecipientAddress> members,
|
Set<GroupMember> members,
|
||||||
Set<RecipientAddress> pendingMembers,
|
Set<RecipientAddress> pendingMembers,
|
||||||
Set<RecipientAddress> requestingMembers,
|
Set<RecipientAddress> requestingMembers,
|
||||||
Set<RecipientAddress> adminMembers,
|
|
||||||
Set<RecipientAddress> bannedMembers,
|
Set<RecipientAddress> bannedMembers,
|
||||||
boolean isBlocked,
|
boolean isBlocked,
|
||||||
int messageExpirationTimer,
|
int messageExpirationTimer,
|
||||||
@ -37,8 +36,7 @@ public record Group(
|
|||||||
groupInfo.getGroupInviteLink(),
|
groupInfo.getGroupInviteLink(),
|
||||||
groupInfo.getMembers()
|
groupInfo.getMembers()
|
||||||
.stream()
|
.stream()
|
||||||
.map(recipientStore::resolveRecipientAddress)
|
.map(m -> org.asamk.signal.manager.api.GroupMember.from(m, recipientStore))
|
||||||
.map(org.asamk.signal.manager.storage.recipients.RecipientAddress::toApiRecipientAddress)
|
|
||||||
.collect(Collectors.toSet()),
|
.collect(Collectors.toSet()),
|
||||||
groupInfo.getPendingMembers()
|
groupInfo.getPendingMembers()
|
||||||
.stream()
|
.stream()
|
||||||
@ -50,11 +48,6 @@ public record Group(
|
|||||||
.map(recipientStore::resolveRecipientAddress)
|
.map(recipientStore::resolveRecipientAddress)
|
||||||
.map(org.asamk.signal.manager.storage.recipients.RecipientAddress::toApiRecipientAddress)
|
.map(org.asamk.signal.manager.storage.recipients.RecipientAddress::toApiRecipientAddress)
|
||||||
.collect(Collectors.toSet()),
|
.collect(Collectors.toSet()),
|
||||||
groupInfo.getAdminMembers()
|
|
||||||
.stream()
|
|
||||||
.map(recipientStore::resolveRecipientAddress)
|
|
||||||
.map(org.asamk.signal.manager.storage.recipients.RecipientAddress::toApiRecipientAddress)
|
|
||||||
.collect(Collectors.toSet()),
|
|
||||||
groupInfo.getBannedMembers()
|
groupInfo.getBannedMembers()
|
||||||
.stream()
|
.stream()
|
||||||
.map(recipientStore::resolveRecipientAddress)
|
.map(recipientStore::resolveRecipientAddress)
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package org.asamk.signal.manager.api;
|
||||||
|
|
||||||
|
import org.asamk.signal.manager.helper.RecipientAddressResolver;
|
||||||
|
import org.asamk.signal.manager.storage.groups.GroupMemberInfo;
|
||||||
|
|
||||||
|
public record GroupMember(
|
||||||
|
RecipientAddress recipientAddress, boolean isAdmin, String labelEmoji, String label
|
||||||
|
) {
|
||||||
|
|
||||||
|
public static GroupMember from(final GroupMemberInfo memberInfo, final RecipientAddressResolver recipientStore) {
|
||||||
|
return new GroupMember(recipientStore.resolveRecipientAddress(memberInfo.getRecipientId())
|
||||||
|
.toApiRecipientAddress(), memberInfo.isAdmin(), memberInfo.labelEmoji(), memberInfo.labelString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ public record Message(
|
|||||||
String messageText,
|
String messageText,
|
||||||
List<String> attachments,
|
List<String> attachments,
|
||||||
boolean viewOnce,
|
boolean viewOnce,
|
||||||
|
boolean voiceNote,
|
||||||
List<Mention> mentions,
|
List<Mention> mentions,
|
||||||
Optional<Quote> quote,
|
Optional<Quote> quote,
|
||||||
Optional<Sticker> sticker,
|
Optional<Sticker> sticker,
|
||||||
|
|||||||
@ -19,6 +19,8 @@ public class UpdateGroup {
|
|||||||
private final String avatarFile;
|
private final String avatarFile;
|
||||||
private final Integer expirationTimer;
|
private final Integer expirationTimer;
|
||||||
private final Boolean isAnnouncementGroup;
|
private final Boolean isAnnouncementGroup;
|
||||||
|
private final String labelEmoji;
|
||||||
|
private final String labelString;
|
||||||
|
|
||||||
private UpdateGroup(final Builder builder) {
|
private UpdateGroup(final Builder builder) {
|
||||||
name = builder.name;
|
name = builder.name;
|
||||||
@ -36,6 +38,8 @@ public class UpdateGroup {
|
|||||||
avatarFile = builder.avatarFile;
|
avatarFile = builder.avatarFile;
|
||||||
expirationTimer = builder.expirationTimer;
|
expirationTimer = builder.expirationTimer;
|
||||||
isAnnouncementGroup = builder.isAnnouncementGroup;
|
isAnnouncementGroup = builder.isAnnouncementGroup;
|
||||||
|
labelEmoji = builder.labelEmoji;
|
||||||
|
labelString = builder.labelString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder newBuilder() {
|
public static Builder newBuilder() {
|
||||||
@ -57,7 +61,9 @@ public class UpdateGroup {
|
|||||||
copy.editDetailsPermission,
|
copy.editDetailsPermission,
|
||||||
copy.avatarFile,
|
copy.avatarFile,
|
||||||
copy.expirationTimer,
|
copy.expirationTimer,
|
||||||
copy.isAnnouncementGroup);
|
copy.isAnnouncementGroup,
|
||||||
|
copy.labelEmoji,
|
||||||
|
copy.labelString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder newBuilder(
|
public static Builder newBuilder(
|
||||||
@ -75,7 +81,9 @@ public class UpdateGroup {
|
|||||||
final GroupPermission editDetailsPermission,
|
final GroupPermission editDetailsPermission,
|
||||||
final String avatarFile,
|
final String avatarFile,
|
||||||
final Integer expirationTimer,
|
final Integer expirationTimer,
|
||||||
final Boolean isAnnouncementGroup
|
final Boolean isAnnouncementGroup,
|
||||||
|
final String labelEmoji,
|
||||||
|
final String labelString
|
||||||
) {
|
) {
|
||||||
return new Builder(name,
|
return new Builder(name,
|
||||||
description,
|
description,
|
||||||
@ -91,7 +99,9 @@ public class UpdateGroup {
|
|||||||
editDetailsPermission,
|
editDetailsPermission,
|
||||||
avatarFile,
|
avatarFile,
|
||||||
expirationTimer,
|
expirationTimer,
|
||||||
isAnnouncementGroup);
|
isAnnouncementGroup,
|
||||||
|
labelEmoji,
|
||||||
|
labelString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -154,6 +164,14 @@ public class UpdateGroup {
|
|||||||
return isAnnouncementGroup;
|
return isAnnouncementGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLabelEmoji() {
|
||||||
|
return labelEmoji;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabelString() {
|
||||||
|
return labelString;
|
||||||
|
}
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
@ -171,6 +189,8 @@ public class UpdateGroup {
|
|||||||
private String avatarFile;
|
private String avatarFile;
|
||||||
private Integer expirationTimer;
|
private Integer expirationTimer;
|
||||||
private Boolean isAnnouncementGroup;
|
private Boolean isAnnouncementGroup;
|
||||||
|
private String labelEmoji;
|
||||||
|
private String labelString;
|
||||||
|
|
||||||
private Builder() {
|
private Builder() {
|
||||||
}
|
}
|
||||||
@ -190,7 +210,9 @@ public class UpdateGroup {
|
|||||||
final GroupPermission editDetailsPermission,
|
final GroupPermission editDetailsPermission,
|
||||||
final String avatarFile,
|
final String avatarFile,
|
||||||
final Integer expirationTimer,
|
final Integer expirationTimer,
|
||||||
final Boolean isAnnouncementGroup
|
final Boolean isAnnouncementGroup,
|
||||||
|
final String labelEmoji,
|
||||||
|
final String labelString
|
||||||
) {
|
) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@ -207,6 +229,8 @@ public class UpdateGroup {
|
|||||||
this.avatarFile = avatarFile;
|
this.avatarFile = avatarFile;
|
||||||
this.expirationTimer = expirationTimer;
|
this.expirationTimer = expirationTimer;
|
||||||
this.isAnnouncementGroup = isAnnouncementGroup;
|
this.isAnnouncementGroup = isAnnouncementGroup;
|
||||||
|
this.labelEmoji = labelEmoji;
|
||||||
|
this.labelString = labelString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder withName(final String val) {
|
public Builder withName(final String val) {
|
||||||
@ -284,6 +308,16 @@ public class UpdateGroup {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder withLabelEmoji(final String val) {
|
||||||
|
labelEmoji = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder withLabelString(final String val) {
|
||||||
|
labelString = val;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public UpdateGroup build() {
|
public UpdateGroup build() {
|
||||||
return new UpdateGroup(this);
|
return new UpdateGroup(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ public class ServiceConfig {
|
|||||||
|
|
||||||
public static final int MAX_ATTACHMENT_SIZE = 150 * 1024 * 1024;
|
public static final int MAX_ATTACHMENT_SIZE = 150 * 1024 * 1024;
|
||||||
public static final long MAX_ENVELOPE_SIZE = 0;
|
public static final long MAX_ENVELOPE_SIZE = 0;
|
||||||
|
public static final int MAX_INCREMENTAL_MACS_PER_ENVELOPE = 10;
|
||||||
public static final int MAX_MESSAGE_SIZE_BYTES = 2000;
|
public static final int MAX_MESSAGE_SIZE_BYTES = 2000;
|
||||||
public static final long AVATAR_DOWNLOAD_FAILSAFE_MAX_SIZE = 10 * 1024 * 1024;
|
public static final long AVATAR_DOWNLOAD_FAILSAFE_MAX_SIZE = 10 * 1024 * 1024;
|
||||||
public static final boolean AUTOMATIC_NETWORK_RETRY = true;
|
public static final boolean AUTOMATIC_NETWORK_RETRY = true;
|
||||||
@ -29,7 +30,7 @@ public class ServiceConfig {
|
|||||||
|
|
||||||
public static AccountAttributes.Capabilities getCapabilities(boolean isPrimaryDevice) {
|
public static AccountAttributes.Capabilities getCapabilities(boolean isPrimaryDevice) {
|
||||||
final var attachmentBackfill = !isPrimaryDevice;
|
final var attachmentBackfill = !isPrimaryDevice;
|
||||||
final var spqr = !isPrimaryDevice;
|
final var spqr = true;
|
||||||
return new AccountAttributes.Capabilities(true, true, attachmentBackfill, spqr);
|
return new AccountAttributes.Capabilities(true, true, attachmentBackfill, spqr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,8 +44,8 @@ public class AttachmentHelper {
|
|||||||
return attachmentStore.retrieveAttachment(id);
|
return attachmentStore.retrieveAttachment(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SignalServiceAttachment> uploadAttachments(final List<String> attachments) throws AttachmentInvalidException, IOException {
|
public List<SignalServiceAttachment> uploadAttachments(final List<String> attachments, boolean voiceNote) throws AttachmentInvalidException, IOException {
|
||||||
final var attachmentStreams = createAttachmentStreams(attachments);
|
final var attachmentStreams = createAttachmentStreams(attachments, voiceNote);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Upload attachments here, so we only upload once even for multiple recipients
|
// Upload attachments here, so we only upload once even for multiple recipients
|
||||||
@ -61,14 +61,18 @@ public class AttachmentHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SignalServiceAttachmentStream> createAttachmentStreams(List<String> attachments) throws AttachmentInvalidException, IOException {
|
public List<SignalServiceAttachment> uploadAttachments(final List<String> attachments) throws AttachmentInvalidException, IOException {
|
||||||
|
return uploadAttachments(attachments, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SignalServiceAttachmentStream> createAttachmentStreams(List<String> attachments, boolean voiceNote) throws AttachmentInvalidException, IOException {
|
||||||
if (attachments == null) {
|
if (attachments == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final var signalServiceAttachments = new ArrayList<SignalServiceAttachmentStream>(attachments.size());
|
final var signalServiceAttachments = new ArrayList<SignalServiceAttachmentStream>(attachments.size());
|
||||||
for (var attachment : attachments) {
|
for (var attachment : attachments) {
|
||||||
final var uploadSpec = dependencies.getMessageSender().getResumableUploadSpec();
|
final var uploadSpec = dependencies.getMessageSender().getResumableUploadSpec();
|
||||||
signalServiceAttachments.add(AttachmentUtils.createAttachmentStream(attachment, uploadSpec));
|
signalServiceAttachments.add(AttachmentUtils.createAttachmentStream(attachment, voiceNote, uploadSpec));
|
||||||
}
|
}
|
||||||
return signalServiceAttachments;
|
return signalServiceAttachments;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -299,7 +299,9 @@ public class GroupHelper {
|
|||||||
final GroupPermission editDetailsPermission,
|
final GroupPermission editDetailsPermission,
|
||||||
final String avatarFile,
|
final String avatarFile,
|
||||||
final Integer expirationTimer,
|
final Integer expirationTimer,
|
||||||
final Boolean isAnnouncementGroup
|
final Boolean isAnnouncementGroup,
|
||||||
|
final String labelEmoji,
|
||||||
|
final String labelString
|
||||||
) throws IOException, GroupNotFoundException, AttachmentInvalidException, NotAGroupMemberException, GroupSendingNotAllowedException {
|
) throws IOException, GroupNotFoundException, AttachmentInvalidException, NotAGroupMemberException, GroupSendingNotAllowedException {
|
||||||
var group = getGroupForUpdating(groupId);
|
var group = getGroupForUpdating(groupId);
|
||||||
final var avatarBytes = readAvatarBytes(avatarFile);
|
final var avatarBytes = readAvatarBytes(avatarFile);
|
||||||
@ -323,7 +325,9 @@ public class GroupHelper {
|
|||||||
editDetailsPermission,
|
editDetailsPermission,
|
||||||
avatarBytes,
|
avatarBytes,
|
||||||
expirationTimer,
|
expirationTimer,
|
||||||
isAnnouncementGroup);
|
isAnnouncementGroup,
|
||||||
|
labelEmoji,
|
||||||
|
labelString);
|
||||||
} catch (ConflictException e) {
|
} catch (ConflictException e) {
|
||||||
// Detected conflicting update, refreshing group and trying again
|
// Detected conflicting update, refreshing group and trying again
|
||||||
group = getGroup(groupId, true);
|
group = getGroup(groupId, true);
|
||||||
@ -342,7 +346,9 @@ public class GroupHelper {
|
|||||||
editDetailsPermission,
|
editDetailsPermission,
|
||||||
avatarBytes,
|
avatarBytes,
|
||||||
expirationTimer,
|
expirationTimer,
|
||||||
isAnnouncementGroup);
|
isAnnouncementGroup,
|
||||||
|
labelEmoji,
|
||||||
|
labelString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,7 +707,9 @@ public class GroupHelper {
|
|||||||
final GroupPermission editDetailsPermission,
|
final GroupPermission editDetailsPermission,
|
||||||
final byte[] avatarFile,
|
final byte[] avatarFile,
|
||||||
final Integer expirationTimer,
|
final Integer expirationTimer,
|
||||||
final Boolean isAnnouncementGroup
|
final Boolean isAnnouncementGroup,
|
||||||
|
final String labelEmoji,
|
||||||
|
final String labelString
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
SendGroupMessageResults result = null;
|
SendGroupMessageResults result = null;
|
||||||
final var groupV2Helper = context.getGroupV2Helper();
|
final var groupV2Helper = context.getGroupV2Helper();
|
||||||
@ -731,7 +739,7 @@ public class GroupHelper {
|
|||||||
if (banMembers != null) {
|
if (banMembers != null) {
|
||||||
existingRemoveMembers.addAll(banMembers);
|
existingRemoveMembers.addAll(banMembers);
|
||||||
}
|
}
|
||||||
existingRemoveMembers.retainAll(group.getMembers());
|
existingRemoveMembers.retainAll(group.getMemberRecipientIds());
|
||||||
if (members != null) {
|
if (members != null) {
|
||||||
existingRemoveMembers.removeAll(members);
|
existingRemoveMembers.removeAll(members);
|
||||||
}
|
}
|
||||||
@ -757,8 +765,8 @@ public class GroupHelper {
|
|||||||
|
|
||||||
if (admins != null) {
|
if (admins != null) {
|
||||||
final var newAdmins = new HashSet<>(admins);
|
final var newAdmins = new HashSet<>(admins);
|
||||||
newAdmins.retainAll(group.getMembers());
|
newAdmins.retainAll(group.getMemberRecipientIds());
|
||||||
newAdmins.removeAll(group.getAdminMembers());
|
newAdmins.removeAll(group.getAdminMemberRecipientIds());
|
||||||
if (!newAdmins.isEmpty()) {
|
if (!newAdmins.isEmpty()) {
|
||||||
for (var admin : newAdmins) {
|
for (var admin : newAdmins) {
|
||||||
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, admin, true);
|
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, admin, true);
|
||||||
@ -771,7 +779,7 @@ public class GroupHelper {
|
|||||||
|
|
||||||
if (removeAdmins != null) {
|
if (removeAdmins != null) {
|
||||||
final var existingRemoveAdmins = new HashSet<>(removeAdmins);
|
final var existingRemoveAdmins = new HashSet<>(removeAdmins);
|
||||||
existingRemoveAdmins.retainAll(group.getAdminMembers());
|
existingRemoveAdmins.retainAll(group.getAdminMemberRecipientIds());
|
||||||
if (!existingRemoveAdmins.isEmpty()) {
|
if (!existingRemoveAdmins.isEmpty()) {
|
||||||
for (var admin : existingRemoveAdmins) {
|
for (var admin : existingRemoveAdmins) {
|
||||||
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, admin, false);
|
var groupGroupChangePair = groupV2Helper.setMemberAdmin(group, admin, false);
|
||||||
@ -830,6 +838,15 @@ public class GroupHelper {
|
|||||||
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (labelString != null || labelEmoji != null) {
|
||||||
|
final var selfRecipientId = account.getSelfRecipientId();
|
||||||
|
final var selfMember = group.getMember(selfRecipientId);
|
||||||
|
var groupGroupChangePair = groupV2Helper.setMemberLabels(group,
|
||||||
|
labelEmoji != null ? labelEmoji : selfMember.labelEmoji(),
|
||||||
|
labelString != null ? labelString : selfMember.labelString());
|
||||||
|
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
|
||||||
|
}
|
||||||
|
|
||||||
if (name != null || description != null || avatarFile != null) {
|
if (name != null || description != null || avatarFile != null) {
|
||||||
var groupGroupChangePair = groupV2Helper.updateGroup(group, name, description, avatarFile);
|
var groupGroupChangePair = groupV2Helper.updateGroup(group, name, description, avatarFile);
|
||||||
if (avatarFile != null) {
|
if (avatarFile != null) {
|
||||||
@ -859,9 +876,9 @@ public class GroupHelper {
|
|||||||
final GroupInfoV2 groupInfoV2,
|
final GroupInfoV2 groupInfoV2,
|
||||||
final Set<RecipientId> newAdmins
|
final Set<RecipientId> newAdmins
|
||||||
) throws LastGroupAdminException, IOException {
|
) throws LastGroupAdminException, IOException {
|
||||||
final var currentAdmins = groupInfoV2.getAdminMembers();
|
final var currentAdmins = groupInfoV2.getAdminMemberRecipientIds();
|
||||||
newAdmins.removeAll(currentAdmins);
|
newAdmins.removeAll(currentAdmins);
|
||||||
newAdmins.retainAll(groupInfoV2.getMembers());
|
newAdmins.retainAll(groupInfoV2.getMemberRecipientIds());
|
||||||
if (currentAdmins.contains(account.getSelfRecipientId())
|
if (currentAdmins.contains(account.getSelfRecipientId())
|
||||||
&& currentAdmins.size() == 1
|
&& currentAdmins.size() == 1
|
||||||
&& groupInfoV2.getMembers().size() > 1
|
&& groupInfoV2.getMembers().size() > 1
|
||||||
@ -888,7 +905,7 @@ public class GroupHelper {
|
|||||||
var group = SignalServiceGroup.newBuilder(SignalServiceGroup.Type.UPDATE)
|
var group = SignalServiceGroup.newBuilder(SignalServiceGroup.Type.UPDATE)
|
||||||
.withId(g.getGroupId().serialize())
|
.withId(g.getGroupId().serialize())
|
||||||
.withName(g.name)
|
.withName(g.name)
|
||||||
.withMembers(g.getMembers()
|
.withMembers(g.getMemberRecipientIds()
|
||||||
.stream()
|
.stream()
|
||||||
.map(context.getRecipientHelper()::resolveSignalServiceAddress)
|
.map(context.getRecipientHelper()::resolveSignalServiceAddress)
|
||||||
.toList());
|
.toList());
|
||||||
|
|||||||
@ -533,6 +533,18 @@ class GroupV2Helper {
|
|||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pair<DecryptedGroup, GroupChangeResponse> setMemberLabels(
|
||||||
|
GroupInfoV2 groupInfoV2,
|
||||||
|
String labelEmoji,
|
||||||
|
String labelString
|
||||||
|
) throws IOException {
|
||||||
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
final var change = groupOperations.createChangeMemberLabel(getSelfAci(),
|
||||||
|
labelString == null ? "" : labelString,
|
||||||
|
labelEmoji);
|
||||||
|
return commitChange(groupInfoV2, change);
|
||||||
|
}
|
||||||
|
|
||||||
private AccessControl.AccessRequired toAccessControl(final GroupLinkState state) {
|
private AccessControl.AccessRequired toAccessControl(final GroupLinkState state) {
|
||||||
return switch (state) {
|
return switch (state) {
|
||||||
case DISABLED -> AccessControl.AccessRequired.UNSATISFIABLE;
|
case DISABLED -> AccessControl.AccessRequired.UNSATISFIABLE;
|
||||||
|
|||||||
@ -320,7 +320,9 @@ public class SendHelper {
|
|||||||
messageBuilder.withExpiration(g.getMessageExpirationTimer());
|
messageBuilder.withExpiration(g.getMessageExpirationTimer());
|
||||||
|
|
||||||
final var message = messageBuilder.build();
|
final var message = messageBuilder.build();
|
||||||
final var recipients = includeSelf ? g.getMembers() : g.getMembersWithout(account.getSelfRecipientId());
|
final var recipients = includeSelf
|
||||||
|
? g.getMemberRecipientIds()
|
||||||
|
: g.getMembersWithout(account.getSelfRecipientId());
|
||||||
|
|
||||||
if (g.isAnnouncementGroup() && !g.isAdmin(account.getSelfRecipientId())) {
|
if (g.isAnnouncementGroup() && !g.isAdmin(account.getSelfRecipientId())) {
|
||||||
if (message.getBody().isPresent()
|
if (message.getBody().isPresent()
|
||||||
|
|||||||
@ -114,7 +114,7 @@ public class SyncHelper {
|
|||||||
if (record instanceof GroupInfoV1 groupInfo) {
|
if (record instanceof GroupInfoV1 groupInfo) {
|
||||||
out.write(new DeviceGroup(groupInfo.getGroupId().serialize(),
|
out.write(new DeviceGroup(groupInfo.getGroupId().serialize(),
|
||||||
Optional.ofNullable(groupInfo.name),
|
Optional.ofNullable(groupInfo.name),
|
||||||
groupInfo.getMembers()
|
groupInfo.getMemberRecipientIds()
|
||||||
.stream()
|
.stream()
|
||||||
.map(context.getRecipientHelper()::resolveSignalServiceAddress)
|
.map(context.getRecipientHelper()::resolveSignalServiceAddress)
|
||||||
.toList(),
|
.toList(),
|
||||||
|
|||||||
@ -643,7 +643,9 @@ public class ManagerImpl implements Manager {
|
|||||||
updateGroup.getEditDetailsPermission(),
|
updateGroup.getEditDetailsPermission(),
|
||||||
updateGroup.getAvatarFile(),
|
updateGroup.getAvatarFile(),
|
||||||
updateGroup.getExpirationTimer(),
|
updateGroup.getExpirationTimer(),
|
||||||
updateGroup.getIsAnnouncementGroup());
|
updateGroup.getIsAnnouncementGroup(),
|
||||||
|
updateGroup.getLabelEmoji(),
|
||||||
|
updateGroup.getLabelString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -851,7 +853,7 @@ public class ManagerImpl implements Manager {
|
|||||||
messageBuilder.withBody(message.messageText());
|
messageBuilder.withBody(message.messageText());
|
||||||
}
|
}
|
||||||
if (!message.attachments().isEmpty()) {
|
if (!message.attachments().isEmpty()) {
|
||||||
final var uploadedAttachments = context.getAttachmentHelper().uploadAttachments(message.attachments());
|
final var uploadedAttachments = context.getAttachmentHelper().uploadAttachments(message.attachments(), message.voiceNote());
|
||||||
if (!additionalAttachments.isEmpty()) {
|
if (!additionalAttachments.isEmpty()) {
|
||||||
additionalAttachments.addAll(uploadedAttachments);
|
additionalAttachments.addAll(uploadedAttachments);
|
||||||
messageBuilder.withAttachments(additionalAttachments);
|
messageBuilder.withAttachments(additionalAttachments);
|
||||||
|
|||||||
@ -337,6 +337,7 @@ public class SignalDependencies {
|
|||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
executor,
|
executor,
|
||||||
ServiceConfig.MAX_ENVELOPE_SIZE,
|
ServiceConfig.MAX_ENVELOPE_SIZE,
|
||||||
|
ServiceConfig.MAX_INCREMENTAL_MACS_PER_ENVELOPE,
|
||||||
() -> true,
|
() -> true,
|
||||||
true,
|
true,
|
||||||
true));
|
true));
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import org.asamk.signal.manager.api.GroupPermission;
|
|||||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||||
import org.whispersystems.signalservice.api.push.DistributionId;
|
import org.whispersystems.signalservice.api.push.DistributionId;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@ -24,7 +25,18 @@ public sealed abstract class GroupInfo permits GroupInfoV1, GroupInfoV2 {
|
|||||||
|
|
||||||
public abstract GroupInviteLinkUrl getGroupInviteLink();
|
public abstract GroupInviteLinkUrl getGroupInviteLink();
|
||||||
|
|
||||||
public abstract Set<RecipientId> getMembers();
|
public abstract Collection<GroupMemberInfo> getMembers();
|
||||||
|
|
||||||
|
public Set<RecipientId> getMemberRecipientIds() {
|
||||||
|
return getMembers().stream().map(GroupMemberInfo::getRecipientId).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupMemberInfo getMember(RecipientId recipientId) {
|
||||||
|
return getMembers().stream()
|
||||||
|
.filter(member -> member.getRecipientId().equals(recipientId))
|
||||||
|
.findFirst()
|
||||||
|
.orElseThrow();
|
||||||
|
}
|
||||||
|
|
||||||
public Set<RecipientId> getBannedMembers() {
|
public Set<RecipientId> getBannedMembers() {
|
||||||
return Set.of();
|
return Set.of();
|
||||||
@ -38,7 +50,7 @@ public sealed abstract class GroupInfo permits GroupInfoV1, GroupInfoV2 {
|
|||||||
return Set.of();
|
return Set.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<RecipientId> getAdminMembers() {
|
public Set<RecipientId> getAdminMemberRecipientIds() {
|
||||||
return Set.of();
|
return Set.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,21 +73,23 @@ public sealed abstract class GroupInfo permits GroupInfoV1, GroupInfoV2 {
|
|||||||
public abstract GroupPermission getPermissionSendMessage();
|
public abstract GroupPermission getPermissionSendMessage();
|
||||||
|
|
||||||
public Set<RecipientId> getMembersWithout(RecipientId recipientId) {
|
public Set<RecipientId> getMembersWithout(RecipientId recipientId) {
|
||||||
return getMembers().stream().filter(member -> !member.equals(recipientId)).collect(Collectors.toSet());
|
return getMemberRecipientIds().stream()
|
||||||
|
.filter(member -> !member.equals(recipientId))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<RecipientId> getMembersIncludingPendingWithout(RecipientId recipientId) {
|
public Set<RecipientId> getMembersIncludingPendingWithout(RecipientId recipientId) {
|
||||||
return Stream.concat(getMembers().stream(), getPendingMembers().stream())
|
return Stream.concat(getMemberRecipientIds().stream(), getPendingMembers().stream())
|
||||||
.filter(member -> !member.equals(recipientId))
|
.filter(member -> !member.equals(recipientId))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMember(RecipientId recipientId) {
|
public boolean isMember(RecipientId recipientId) {
|
||||||
return getMembers().contains(recipientId);
|
return getMembers().stream().anyMatch(m -> m.getRecipientId().equals(recipientId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAdmin(RecipientId recipientId) {
|
public boolean isAdmin(RecipientId recipientId) {
|
||||||
return getAdminMembers().contains(recipientId);
|
return getMembers().stream().anyMatch(m -> m.isAdmin() && m.getRecipientId().equals(recipientId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPendingMember(RecipientId recipientId) {
|
public boolean isPendingMember(RecipientId recipientId) {
|
||||||
|
|||||||
@ -80,8 +80,8 @@ public final class GroupInfoV1 extends GroupInfo {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<RecipientId> getMembers() {
|
public Collection<GroupMemberInfo> getMembers() {
|
||||||
return new HashSet<>(members);
|
return members.stream().map(m -> (GroupMemberInfo) new GroupMemberInfoV1(m)).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,18 +3,17 @@ package org.asamk.signal.manager.storage.groups;
|
|||||||
import org.asamk.signal.manager.api.GroupIdV2;
|
import org.asamk.signal.manager.api.GroupIdV2;
|
||||||
import org.asamk.signal.manager.api.GroupInviteLinkUrl;
|
import org.asamk.signal.manager.api.GroupInviteLinkUrl;
|
||||||
import org.asamk.signal.manager.api.GroupPermission;
|
import org.asamk.signal.manager.api.GroupPermission;
|
||||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
|
||||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||||
import org.asamk.signal.manager.storage.recipients.RecipientResolver;
|
import org.asamk.signal.manager.storage.recipients.RecipientResolver;
|
||||||
import org.signal.core.models.ServiceId;
|
import org.signal.core.models.ServiceId;
|
||||||
import org.signal.libsignal.zkgroup.groups.GroupMasterKey;
|
import org.signal.libsignal.zkgroup.groups.GroupMasterKey;
|
||||||
import org.signal.storageservice.storage.protos.groups.AccessControl;
|
import org.signal.storageservice.storage.protos.groups.AccessControl;
|
||||||
import org.signal.storageservice.storage.protos.groups.Member;
|
|
||||||
import org.signal.storageservice.storage.protos.groups.local.DecryptedGroup;
|
import org.signal.storageservice.storage.protos.groups.local.DecryptedGroup;
|
||||||
import org.signal.storageservice.storage.protos.groups.local.EnabledState;
|
import org.signal.storageservice.storage.protos.groups.local.EnabledState;
|
||||||
import org.whispersystems.signalservice.api.push.DistributionId;
|
import org.whispersystems.signalservice.api.push.DistributionId;
|
||||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -122,14 +121,11 @@ public final class GroupInfoV2 extends GroupInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<RecipientId> getMembers() {
|
public Collection<GroupMemberInfo> getMembers() {
|
||||||
if (this.group == null) {
|
if (this.group == null) {
|
||||||
return Set.of();
|
return Set.of();
|
||||||
}
|
}
|
||||||
return group.members.stream()
|
return group.members.stream().map(m -> (GroupMemberInfo) new GroupMemberInfoV2(m, recipientResolver)).toList();
|
||||||
.map(m -> ServiceId.parseOrThrow(m.aciBytes))
|
|
||||||
.map(recipientResolver::resolveRecipient)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -175,16 +171,11 @@ public final class GroupInfoV2 extends GroupInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<RecipientId> getAdminMembers() {
|
public Set<RecipientId> getAdminMemberRecipientIds() {
|
||||||
if (this.group == null) {
|
return this.getMembers()
|
||||||
return Set.of();
|
.stream()
|
||||||
}
|
.filter(GroupMemberInfo::isAdmin)
|
||||||
return group.members.stream()
|
.map(GroupMemberInfo::getRecipientId)
|
||||||
.filter(m -> m.role == Member.Role.ADMINISTRATOR)
|
|
||||||
.map(m -> new RecipientAddress(ServiceId.ACI.parseOrNull(m.aciBytes),
|
|
||||||
ServiceId.PNI.parseOrNull(m.pniBytes),
|
|
||||||
null))
|
|
||||||
.map(recipientResolver::resolveRecipient)
|
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,20 @@
|
|||||||
|
package org.asamk.signal.manager.storage.groups;
|
||||||
|
|
||||||
|
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||||
|
|
||||||
|
public interface GroupMemberInfo {
|
||||||
|
|
||||||
|
RecipientId getRecipientId();
|
||||||
|
|
||||||
|
default boolean isAdmin() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
default String labelEmoji() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
default String labelString() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package org.asamk.signal.manager.storage.groups;
|
||||||
|
|
||||||
|
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||||
|
|
||||||
|
public class GroupMemberInfoV1 implements GroupMemberInfo {
|
||||||
|
|
||||||
|
private final RecipientId recipientId;
|
||||||
|
|
||||||
|
public GroupMemberInfoV1(final RecipientId recipientId) {
|
||||||
|
this.recipientId = recipientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipientId getRecipientId() {
|
||||||
|
return this.recipientId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
package org.asamk.signal.manager.storage.groups;
|
||||||
|
|
||||||
|
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||||
|
import org.asamk.signal.manager.storage.recipients.RecipientResolver;
|
||||||
|
import org.signal.core.models.ServiceId;
|
||||||
|
import org.signal.storageservice.storage.protos.groups.Member;
|
||||||
|
import org.signal.storageservice.storage.protos.groups.local.DecryptedMember;
|
||||||
|
|
||||||
|
public class GroupMemberInfoV2 implements GroupMemberInfo {
|
||||||
|
|
||||||
|
private final RecipientResolver recipientResolver;
|
||||||
|
private final DecryptedMember member;
|
||||||
|
|
||||||
|
public GroupMemberInfoV2(final DecryptedMember member, final RecipientResolver recipientResolver) {
|
||||||
|
this.recipientResolver = recipientResolver;
|
||||||
|
this.member = member;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecipientId getRecipientId() {
|
||||||
|
return recipientResolver.resolveRecipient(ServiceId.ACI.parseOrThrow(member.aciBytes));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAdmin() {
|
||||||
|
return member.role == Member.Role.ADMINISTRATOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String labelEmoji() {
|
||||||
|
return member.labelEmoji.isEmpty() ? null : member.labelEmoji;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String labelString() {
|
||||||
|
return member.labelString.isEmpty() ? null : member.labelString;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -648,7 +648,7 @@ public class GroupStore {
|
|||||||
ON CONFLICT (group_id, recipient_id) DO NOTHING
|
ON CONFLICT (group_id, recipient_id) DO NOTHING
|
||||||
""".formatted(TABLE_GROUP_V1_MEMBER);
|
""".formatted(TABLE_GROUP_V1_MEMBER);
|
||||||
try (final var statement = connection.prepareStatement(sqlInsertMember)) {
|
try (final var statement = connection.prepareStatement(sqlInsertMember)) {
|
||||||
for (final var recipient : groupV1.getMembers()) {
|
for (final var recipient : groupV1.getMemberRecipientIds()) {
|
||||||
statement.setLong(1, internalId);
|
statement.setLong(1, internalId);
|
||||||
statement.setLong(2, recipient.id());
|
statement.setLong(2, recipient.id());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
|
|||||||
@ -133,6 +133,11 @@ public class KyberPreKeyStore implements SignalServiceKyberPreKeyStore {
|
|||||||
return getPreKey(keyId) != null;
|
return getPreKey(keyId) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When we mark Kyber pre-keys used, we want to keep a record of last resort tuples, which are deleted when the key
|
||||||
|
* itself is deleted from this table via a cascading delete.
|
||||||
|
* For non-last-resort keys, this method just deletes them like normal.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void markKyberPreKeyUsed(
|
public void markKyberPreKeyUsed(
|
||||||
final int kyberPreKeyId,
|
final int kyberPreKeyId,
|
||||||
|
|||||||
@ -14,32 +14,49 @@ public class AttachmentUtils {
|
|||||||
|
|
||||||
public static SignalServiceAttachmentStream createAttachmentStream(
|
public static SignalServiceAttachmentStream createAttachmentStream(
|
||||||
String attachment,
|
String attachment,
|
||||||
|
boolean voiceNote,
|
||||||
ResumableUploadSpec resumableUploadSpec
|
ResumableUploadSpec resumableUploadSpec
|
||||||
) throws AttachmentInvalidException {
|
) throws AttachmentInvalidException {
|
||||||
try {
|
try {
|
||||||
final var streamDetails = Utils.createStreamDetails(attachment);
|
final var streamDetails = Utils.createStreamDetails(attachment);
|
||||||
|
|
||||||
return createAttachmentStream(streamDetails.first(), streamDetails.second(), resumableUploadSpec);
|
return createAttachmentStream(streamDetails.first(), streamDetails.second(), voiceNote, resumableUploadSpec);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new AttachmentInvalidException(attachment, e);
|
throw new AttachmentInvalidException(attachment, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static SignalServiceAttachmentStream createAttachmentStream(
|
||||||
|
String attachment,
|
||||||
|
ResumableUploadSpec resumableUploadSpec
|
||||||
|
) throws AttachmentInvalidException {
|
||||||
|
return createAttachmentStream(attachment, false, resumableUploadSpec);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SignalServiceAttachmentStream createAttachmentStream(
|
||||||
|
StreamDetails streamDetails,
|
||||||
|
Optional<String> name,
|
||||||
|
boolean voiceNote,
|
||||||
|
ResumableUploadSpec resumableUploadSpec
|
||||||
|
) throws ResumeLocationInvalidException {
|
||||||
|
final var uploadTimestamp = System.currentTimeMillis();
|
||||||
|
return SignalServiceAttachmentStream.newStreamBuilder()
|
||||||
|
.withStream(streamDetails.getStream())
|
||||||
|
.withContentType(streamDetails.getContentType())
|
||||||
|
.withLength(streamDetails.getLength())
|
||||||
|
.withFileName(name.orElse(null))
|
||||||
|
.withVoiceNote(voiceNote)
|
||||||
|
.withUploadTimestamp(uploadTimestamp)
|
||||||
|
.withResumableUploadSpec(resumableUploadSpec)
|
||||||
|
.withUuid(UUID.randomUUID())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
public static SignalServiceAttachmentStream createAttachmentStream(
|
public static SignalServiceAttachmentStream createAttachmentStream(
|
||||||
StreamDetails streamDetails,
|
StreamDetails streamDetails,
|
||||||
Optional<String> name,
|
Optional<String> name,
|
||||||
ResumableUploadSpec resumableUploadSpec
|
ResumableUploadSpec resumableUploadSpec
|
||||||
) throws ResumeLocationInvalidException {
|
) throws ResumeLocationInvalidException {
|
||||||
// TODO maybe add a parameter to set the voiceNote, borderless, preview, width, height and caption option
|
return createAttachmentStream(streamDetails, name, false, resumableUploadSpec);
|
||||||
final var uploadTimestamp = System.currentTimeMillis();
|
|
||||||
return SignalServiceAttachmentStream.newStreamBuilder()
|
|
||||||
.withStream(streamDetails.getStream())
|
|
||||||
.withContentType(streamDetails.getContentType())
|
|
||||||
.withLength(streamDetails.getLength())
|
|
||||||
.withFileName(name.orElse(null))
|
|
||||||
.withUploadTimestamp(uploadTimestamp)
|
|
||||||
.withResumableUploadSpec(resumableUploadSpec)
|
|
||||||
.withUuid(UUID.randomUUID())
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,7 +154,7 @@ RESPONSE: `{"jsonrpc":"2.0","result":{"timestamp":999},"id":4}`
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
REQUEST: `{"jsonrpc":"2.0","method":"updateGroup","params":{"groupId":"GROUP_ID=","name":"new group name","members":["+ZZZ"],"link":"enabledWithApproval","setPermissionEditDetails":"only-admins"},"id":"someId"}`
|
REQUEST: `{"jsonrpc":"2.0","method":"updateGroup","params":{"groupId":"GROUP_ID=","name":"new group name","members":["+ZZZ"],"link":"enabledWithApproval","setPermissionEditDetails":"only-admins","memberLabelEmoji":"😀","memberLabel":"My Label"},"id":"someId"}`
|
||||||
|
|
||||||
RESPONSE: `{"jsonrpc":"2.0","result":{"timestamp":9999},"id":"someId"}`
|
RESPONSE: `{"jsonrpc":"2.0","result":{"timestamp":9999},"id":"someId"}`
|
||||||
|
|
||||||
|
|||||||
@ -443,6 +443,7 @@ By default, recipients can select multiple options.
|
|||||||
*-o* OPTION [OPTION ...], *--option* OPTION [OPTION ...]*::
|
*-o* OPTION [OPTION ...], *--option* OPTION [OPTION ...]*::
|
||||||
The options for the poll.
|
The options for the poll.
|
||||||
Between 2 and 10 options must be specified.
|
Between 2 and 10 options must be specified.
|
||||||
|
Each option must be between 1 and 100 characters.
|
||||||
|
|
||||||
=== sendPollVote
|
=== sendPollVote
|
||||||
|
|
||||||
@ -754,6 +755,12 @@ Groups where only admins can send messages are also called announcement groups
|
|||||||
Set expiration time of messages (seconds).
|
Set expiration time of messages (seconds).
|
||||||
To disable expiration set expiration time to 0.
|
To disable expiration set expiration time to 0.
|
||||||
|
|
||||||
|
*--member-label-emoji* EMOJI::
|
||||||
|
Specify the emoji for the member label.
|
||||||
|
|
||||||
|
*--member-label* STRING::
|
||||||
|
Specify the string for the member label.
|
||||||
|
|
||||||
=== quitGroup
|
=== quitGroup
|
||||||
|
|
||||||
Send a quit group message to all group members and remove self from member list.
|
Send a quit group message to all group members and remove self from member list.
|
||||||
|
|||||||
@ -50,9 +50,9 @@ run() {
|
|||||||
if [ "$JSON_RPC" -eq 1 ]; then
|
if [ "$JSON_RPC" -eq 1 ]; then
|
||||||
"$SIGNAL_CLI" $@
|
"$SIGNAL_CLI" $@
|
||||||
elif [ "$DBUS" -eq 1 ]; then
|
elif [ "$DBUS" -eq 1 ]; then
|
||||||
"$SIGNAL_CLI" --dbus --verbose --verbose $@ | grep -v '^Warning:' | grep -v 'at org'
|
"$SIGNAL_CLI" --dbus --verbose --verbose $@ | grep -v 'Warning:' | grep -v 'at org'
|
||||||
else
|
else
|
||||||
"$SIGNAL_CLI" --service-environment="staging" --verbose --verbose $@ | grep -v '^Warning:' | grep -v 'at org'
|
"$SIGNAL_CLI" --service-environment="staging" --verbose --verbose $@ | grep -v 'Warning:' | grep -v 'at org'
|
||||||
fi
|
fi
|
||||||
set +x
|
set +x
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package org.asamk.signal.commands;
|
package org.asamk.signal.commands;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
import net.sourceforge.argparse4j.impl.Arguments;
|
import net.sourceforge.argparse4j.impl.Arguments;
|
||||||
import net.sourceforge.argparse4j.inf.Namespace;
|
import net.sourceforge.argparse4j.inf.Namespace;
|
||||||
import net.sourceforge.argparse4j.inf.Subparser;
|
import net.sourceforge.argparse4j.inf.Subparser;
|
||||||
@ -7,6 +9,7 @@ import net.sourceforge.argparse4j.inf.Subparser;
|
|||||||
import org.asamk.signal.commands.exceptions.CommandException;
|
import org.asamk.signal.commands.exceptions.CommandException;
|
||||||
import org.asamk.signal.manager.Manager;
|
import org.asamk.signal.manager.Manager;
|
||||||
import org.asamk.signal.manager.api.Group;
|
import org.asamk.signal.manager.api.Group;
|
||||||
|
import org.asamk.signal.manager.api.GroupMember;
|
||||||
import org.asamk.signal.manager.api.RecipientAddress;
|
import org.asamk.signal.manager.api.RecipientAddress;
|
||||||
import org.asamk.signal.output.JsonWriter;
|
import org.asamk.signal.output.JsonWriter;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
@ -37,33 +40,55 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||||||
subparser.addArgument("-g", "--group-id").help("Specify one or more group IDs to show.").nargs("*");
|
subparser.addArgument("-g", "--group-id").help("Specify one or more group IDs to show.").nargs("*");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<String> resolveMembers(Set<RecipientAddress> addresses) {
|
private static Set<String> resolveMembers(Set<GroupMember> addresses) {
|
||||||
|
return addresses.stream()
|
||||||
|
.map(m -> m.recipientAddress().getLegacyIdentifier() + (m.isAdmin() ? "{ADMIN}" : "") + (
|
||||||
|
m.labelEmoji() != null || m.label() != null ? "(" + (
|
||||||
|
m.labelEmoji() != null ? m.labelEmoji() : ""
|
||||||
|
) + (
|
||||||
|
m.label() != null ? m.label() : ""
|
||||||
|
) + ")" : ""
|
||||||
|
))
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Set<String> resolveMemberAddress(Set<RecipientAddress> addresses) {
|
||||||
return addresses.stream().map(RecipientAddress::getLegacyIdentifier).collect(Collectors.toSet());
|
return addresses.stream().map(RecipientAddress::getLegacyIdentifier).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<JsonGroupMember> resolveJsonMembers(Set<RecipientAddress> addresses) {
|
private static Set<JsonGroupMemberAddress> resolveJsonMembers(Set<RecipientAddress> addresses) {
|
||||||
return addresses.stream()
|
return addresses.stream()
|
||||||
.map(address -> new JsonGroupMember(address.number().orElse(null),
|
.map(address -> new JsonGroupMemberAddress(address.number().orElse(null),
|
||||||
address.uuid().map(UUID::toString).orElse(null)))
|
address.uuid().map(UUID::toString).orElse(null)))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Set<JsonGroupMember> resolveFullJsonMembers(Set<GroupMember> addresses) {
|
||||||
|
return addresses.stream().map(member -> {
|
||||||
|
final var address = member.recipientAddress();
|
||||||
|
return new JsonGroupMember(address.number().orElse(null),
|
||||||
|
address.uuid().map(UUID::toString).orElse(null),
|
||||||
|
member.isAdmin(),
|
||||||
|
member.labelEmoji(),
|
||||||
|
member.label());
|
||||||
|
}).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
private static void printGroupPlainText(PlainTextWriter writer, Group group, boolean detailed) {
|
private static void printGroupPlainText(PlainTextWriter writer, Group group, boolean detailed) {
|
||||||
if (detailed) {
|
if (detailed) {
|
||||||
final var groupInviteLink = group.groupInviteLinkUrl();
|
final var groupInviteLink = group.groupInviteLinkUrl();
|
||||||
|
|
||||||
writer.println(
|
writer.println(
|
||||||
"Id: {} Name: {} Description: {} Active: {} Blocked: {} Members: {} Pending members: {} Requesting members: {} Admins: {} Banned: {} Message expiration: {} Link: {}",
|
"Id: {} Name: {} Description: {} Active: {} Blocked: {} Members: {} Pending members: {} Requesting members: {} Banned: {} Message expiration: {} Link: {}",
|
||||||
group.groupId().toBase64(),
|
group.groupId().toBase64(),
|
||||||
group.title(),
|
group.title(),
|
||||||
group.description(),
|
group.description(),
|
||||||
group.isMember(),
|
group.isMember(),
|
||||||
group.isBlocked(),
|
group.isBlocked(),
|
||||||
resolveMembers(group.members()),
|
resolveMembers(group.members()),
|
||||||
resolveMembers(group.pendingMembers()),
|
resolveMemberAddress(group.pendingMembers()),
|
||||||
resolveMembers(group.requestingMembers()),
|
resolveMemberAddress(group.requestingMembers()),
|
||||||
resolveMembers(group.adminMembers()),
|
resolveMemberAddress(group.bannedMembers()),
|
||||||
resolveMembers(group.bannedMembers()),
|
|
||||||
group.messageExpirationTimer() == 0 ? "disabled" : group.messageExpirationTimer() + "s",
|
group.messageExpirationTimer() == 0 ? "disabled" : group.messageExpirationTimer() + "s",
|
||||||
groupInviteLink == null ? '-' : groupInviteLink.getUrl());
|
groupInviteLink == null ? '-' : groupInviteLink.getUrl());
|
||||||
} else {
|
} else {
|
||||||
@ -96,10 +121,14 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||||||
group.isMember(),
|
group.isMember(),
|
||||||
group.isBlocked(),
|
group.isBlocked(),
|
||||||
group.messageExpirationTimer(),
|
group.messageExpirationTimer(),
|
||||||
resolveJsonMembers(group.members()),
|
resolveFullJsonMembers(group.members()),
|
||||||
resolveJsonMembers(group.pendingMembers()),
|
resolveJsonMembers(group.pendingMembers()),
|
||||||
resolveJsonMembers(group.requestingMembers()),
|
resolveJsonMembers(group.requestingMembers()),
|
||||||
resolveJsonMembers(group.adminMembers()),
|
resolveJsonMembers(group.members()
|
||||||
|
.stream()
|
||||||
|
.filter(GroupMember::isAdmin)
|
||||||
|
.map(GroupMember::recipientAddress)
|
||||||
|
.collect(Collectors.toSet())),
|
||||||
resolveJsonMembers(group.bannedMembers()),
|
resolveJsonMembers(group.bannedMembers()),
|
||||||
group.permissionAddMember().name(),
|
group.permissionAddMember().name(),
|
||||||
group.permissionEditDetails().name(),
|
group.permissionEditDetails().name(),
|
||||||
@ -125,15 +154,23 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||||||
boolean isBlocked,
|
boolean isBlocked,
|
||||||
int messageExpirationTime,
|
int messageExpirationTime,
|
||||||
Set<JsonGroupMember> members,
|
Set<JsonGroupMember> members,
|
||||||
Set<JsonGroupMember> pendingMembers,
|
Set<JsonGroupMemberAddress> pendingMembers,
|
||||||
Set<JsonGroupMember> requestingMembers,
|
Set<JsonGroupMemberAddress> requestingMembers,
|
||||||
Set<JsonGroupMember> admins,
|
@Deprecated Set<JsonGroupMemberAddress> admins,
|
||||||
Set<JsonGroupMember> banned,
|
Set<JsonGroupMemberAddress> banned,
|
||||||
String permissionAddMember,
|
String permissionAddMember,
|
||||||
String permissionEditDetails,
|
String permissionEditDetails,
|
||||||
String permissionSendMessage,
|
String permissionSendMessage,
|
||||||
String groupInviteLink
|
String groupInviteLink
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
private record JsonGroupMember(String number, String uuid) {}
|
private record JsonGroupMemberAddress(String number, String uuid) {}
|
||||||
|
|
||||||
|
private record JsonGroupMember(
|
||||||
|
String number,
|
||||||
|
String uuid,
|
||||||
|
boolean isAdmin,
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) String labelEmoji,
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) String label
|
||||||
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,6 +109,9 @@ public class SendCommand implements JsonRpcLocalCommand {
|
|||||||
.action(Arguments.storeTrue())
|
.action(Arguments.storeTrue())
|
||||||
.help("Send the message without the urgent flag, so no push notification is triggered for the recipient. "
|
.help("Send the message without the urgent flag, so no push notification is triggered for the recipient. "
|
||||||
+ "The message will still be delivered in real-time if the recipient's app is active.");
|
+ "The message will still be delivered in real-time if the recipient's app is active.");
|
||||||
|
subparser.addArgument("--voice-note")
|
||||||
|
.action(Arguments.storeTrue())
|
||||||
|
.help("Mark audio attachments as voice notes. Voice notes are displayed inline in Signal clients.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -171,6 +174,7 @@ public class SendCommand implements JsonRpcLocalCommand {
|
|||||||
attachments = List.of();
|
attachments = List.of();
|
||||||
}
|
}
|
||||||
final var viewOnce = Boolean.TRUE.equals(ns.getBoolean("view-once"));
|
final var viewOnce = Boolean.TRUE.equals(ns.getBoolean("view-once"));
|
||||||
|
final var voiceNote = Boolean.TRUE.equals(ns.getBoolean("voice-note"));
|
||||||
|
|
||||||
final var selfNumber = m.getSelfNumber();
|
final var selfNumber = m.getSelfNumber();
|
||||||
|
|
||||||
@ -247,6 +251,7 @@ public class SendCommand implements JsonRpcLocalCommand {
|
|||||||
final var message = new Message(messageText,
|
final var message = new Message(messageText,
|
||||||
attachments,
|
attachments,
|
||||||
viewOnce,
|
viewOnce,
|
||||||
|
voiceNote,
|
||||||
mentions,
|
mentions,
|
||||||
Optional.ofNullable(quote),
|
Optional.ofNullable(quote),
|
||||||
Optional.ofNullable(sticker),
|
Optional.ofNullable(sticker),
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public class SendPollCreateCommand implements JsonRpcLocalCommand {
|
|||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SendPollCreateCommand.class);
|
private static final Logger logger = LoggerFactory.getLogger(SendPollCreateCommand.class);
|
||||||
private static final int MAX_POLL_OPTIONS = 10;
|
private static final int MAX_POLL_OPTIONS = 10;
|
||||||
|
private static final int MAX_POLL_OPTION_LENGTH = 100;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -76,6 +77,14 @@ public class SendPollCreateCommand implements JsonRpcLocalCommand {
|
|||||||
if (options.size() > MAX_POLL_OPTIONS) {
|
if (options.size() > MAX_POLL_OPTIONS) {
|
||||||
throw new UserErrorException("Poll cannot have more than " + MAX_POLL_OPTIONS + " options");
|
throw new UserErrorException("Poll cannot have more than " + MAX_POLL_OPTIONS + " options");
|
||||||
}
|
}
|
||||||
|
for (final var option : options) {
|
||||||
|
if (option.isEmpty()) {
|
||||||
|
throw new UserErrorException("Poll options must not be empty");
|
||||||
|
}
|
||||||
|
if (option.length() > MAX_POLL_OPTION_LENGTH) {
|
||||||
|
throw new UserErrorException("Poll option \"" + option + "\" exceeds the maximum length of " + MAX_POLL_OPTION_LENGTH + " characters");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var results = m.sendPollCreateMessage(question, !noMulti, options, recipientIdentifiers, notifySelf);
|
var results = m.sendPollCreateMessage(question, !noMulti, options, recipientIdentifiers, notifySelf);
|
||||||
|
|||||||
@ -75,6 +75,8 @@ public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
|||||||
.choices("every-member", "only-admins");
|
.choices("every-member", "only-admins");
|
||||||
|
|
||||||
subparser.addArgument("-e", "--expiration").type(int.class).help("Set expiration time of messages (seconds)");
|
subparser.addArgument("-e", "--expiration").type(int.class).help("Set expiration time of messages (seconds)");
|
||||||
|
subparser.addArgument("--member-label-emoji").help("Specify the emoji for the member label.");
|
||||||
|
subparser.addArgument("--member-label").help("Specify the string for the member label.");
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupLinkState getGroupLinkState(String value) throws UserErrorException {
|
GroupLinkState getGroupLinkState(String value) throws UserErrorException {
|
||||||
@ -126,6 +128,8 @@ public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
|||||||
var groupAddMemberPermission = getGroupPermission(ns.getString("set-permission-add-member"));
|
var groupAddMemberPermission = getGroupPermission(ns.getString("set-permission-add-member"));
|
||||||
var groupEditDetailsPermission = getGroupPermission(ns.getString("set-permission-edit-details"));
|
var groupEditDetailsPermission = getGroupPermission(ns.getString("set-permission-edit-details"));
|
||||||
var groupSendMessagesPermission = getGroupPermission(ns.getString("set-permission-send-messages"));
|
var groupSendMessagesPermission = getGroupPermission(ns.getString("set-permission-send-messages"));
|
||||||
|
var memberLabelEmoji = ns.getString("member-label-emoji");
|
||||||
|
var memberLabelString = ns.getString("member-label");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean isNewGroup = false;
|
boolean isNewGroup = false;
|
||||||
@ -159,6 +163,8 @@ public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
|||||||
.withIsAnnouncementGroup(groupSendMessagesPermission == null
|
.withIsAnnouncementGroup(groupSendMessagesPermission == null
|
||||||
? null
|
? null
|
||||||
: groupSendMessagesPermission == GroupPermission.ONLY_ADMINS)
|
: groupSendMessagesPermission == GroupPermission.ONLY_ADMINS)
|
||||||
|
.withLabelEmoji(memberLabelEmoji)
|
||||||
|
.withLabelString(memberLabelString)
|
||||||
.build());
|
.build());
|
||||||
if (results != null) {
|
if (results != null) {
|
||||||
if (groupMessageResults == null) {
|
if (groupMessageResults == null) {
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import org.asamk.signal.manager.api.DeviceLinkUrl;
|
|||||||
import org.asamk.signal.manager.api.Group;
|
import org.asamk.signal.manager.api.Group;
|
||||||
import org.asamk.signal.manager.api.GroupId;
|
import org.asamk.signal.manager.api.GroupId;
|
||||||
import org.asamk.signal.manager.api.GroupInviteLinkUrl;
|
import org.asamk.signal.manager.api.GroupInviteLinkUrl;
|
||||||
|
import org.asamk.signal.manager.api.GroupMember;
|
||||||
import org.asamk.signal.manager.api.GroupNotFoundException;
|
import org.asamk.signal.manager.api.GroupNotFoundException;
|
||||||
import org.asamk.signal.manager.api.GroupPermission;
|
import org.asamk.signal.manager.api.GroupPermission;
|
||||||
import org.asamk.signal.manager.api.GroupSendingNotAllowedException;
|
import org.asamk.signal.manager.api.GroupSendingNotAllowedException;
|
||||||
@ -834,24 +835,22 @@ public class DbusManagerImpl implements Manager {
|
|||||||
final var group = getRemoteObject(groupPath, Signal.Group.class).GetAll("org.asamk.Signal.Group");
|
final var group = getRemoteObject(groupPath, Signal.Group.class).GetAll("org.asamk.Signal.Group");
|
||||||
final var id = (byte[]) group.get("Id").getValue();
|
final var id = (byte[]) group.get("Id").getValue();
|
||||||
try {
|
try {
|
||||||
|
final var admins = new HashSet<>(((List<String>) group.get("Admins").getValue()));
|
||||||
return new Group(GroupId.unknownVersion(id),
|
return new Group(GroupId.unknownVersion(id),
|
||||||
(String) group.get("Name").getValue(),
|
(String) group.get("Name").getValue(),
|
||||||
(String) group.get("Description").getValue(),
|
(String) group.get("Description").getValue(),
|
||||||
GroupInviteLinkUrl.fromUri((String) group.get("GroupInviteLink").getValue()),
|
GroupInviteLinkUrl.fromUri((String) group.get("GroupInviteLink").getValue()),
|
||||||
((List<String>) group.get("Members").getValue()).stream()
|
((List<String>) group.get("Members").getValue()).stream()
|
||||||
.map(m -> new RecipientAddress(m))
|
.map(m -> new GroupMember(new RecipientAddress(m), admins.contains(m), null, null))
|
||||||
.collect(Collectors.toSet()),
|
.collect(Collectors.toSet()),
|
||||||
((List<String>) group.get("PendingMembers").getValue()).stream()
|
((List<String>) group.get("PendingMembers").getValue()).stream()
|
||||||
.map(m -> new RecipientAddress(m))
|
.map(RecipientAddress::new)
|
||||||
.collect(Collectors.toSet()),
|
.collect(Collectors.toSet()),
|
||||||
((List<String>) group.get("RequestingMembers").getValue()).stream()
|
((List<String>) group.get("RequestingMembers").getValue()).stream()
|
||||||
.map(m -> new RecipientAddress(m))
|
.map(RecipientAddress::new)
|
||||||
.collect(Collectors.toSet()),
|
|
||||||
((List<String>) group.get("Admins").getValue()).stream()
|
|
||||||
.map(m -> new RecipientAddress(m))
|
|
||||||
.collect(Collectors.toSet()),
|
.collect(Collectors.toSet()),
|
||||||
((List<String>) group.get("Banned").getValue()).stream()
|
((List<String>) group.get("Banned").getValue()).stream()
|
||||||
.map(m -> new RecipientAddress(m))
|
.map(RecipientAddress::new)
|
||||||
.collect(Collectors.toSet()),
|
.collect(Collectors.toSet()),
|
||||||
(boolean) group.get("IsBlocked").getValue(),
|
(boolean) group.get("IsBlocked").getValue(),
|
||||||
(int) group.get("MessageExpirationTimer").getValue(),
|
(int) group.get("MessageExpirationTimer").getValue(),
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import org.asamk.signal.manager.api.DeviceLinkUrl;
|
|||||||
import org.asamk.signal.manager.api.GroupId;
|
import org.asamk.signal.manager.api.GroupId;
|
||||||
import org.asamk.signal.manager.api.GroupInviteLinkUrl;
|
import org.asamk.signal.manager.api.GroupInviteLinkUrl;
|
||||||
import org.asamk.signal.manager.api.GroupLinkState;
|
import org.asamk.signal.manager.api.GroupLinkState;
|
||||||
|
import org.asamk.signal.manager.api.GroupMember;
|
||||||
import org.asamk.signal.manager.api.GroupNotFoundException;
|
import org.asamk.signal.manager.api.GroupNotFoundException;
|
||||||
import org.asamk.signal.manager.api.GroupPermission;
|
import org.asamk.signal.manager.api.GroupPermission;
|
||||||
import org.asamk.signal.manager.api.GroupSendingNotAllowedException;
|
import org.asamk.signal.manager.api.GroupSendingNotAllowedException;
|
||||||
@ -237,6 +238,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
|
|||||||
final var message = new Message(messageText,
|
final var message = new Message(messageText,
|
||||||
attachments,
|
attachments,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
List.of(),
|
List.of(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
@ -403,6 +405,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
|
|||||||
final var message = new Message(messageText,
|
final var message = new Message(messageText,
|
||||||
attachments,
|
attachments,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
List.of(),
|
List.of(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
@ -450,6 +453,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
|
|||||||
final var message = new Message(messageText,
|
final var message = new Message(messageText,
|
||||||
attachments,
|
attachments,
|
||||||
false,
|
false,
|
||||||
|
false,
|
||||||
List.of(),
|
List.of(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
Optional.empty(),
|
Optional.empty(),
|
||||||
@ -624,7 +628,7 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
|
|||||||
if (group == null) {
|
if (group == null) {
|
||||||
return List.of();
|
return List.of();
|
||||||
} else {
|
} else {
|
||||||
final var members = group.members();
|
final var members = group.members().stream().map(GroupMember::recipientAddress).collect(Collectors.toSet());
|
||||||
return getRecipientStrings(members);
|
return getRecipientStrings(members);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1300,13 +1304,20 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
|
|||||||
() -> getGroup().messageExpirationTimer(),
|
() -> getGroup().messageExpirationTimer(),
|
||||||
this::setMessageExpirationTime),
|
this::setMessageExpirationTime),
|
||||||
new DbusProperty<>("Members",
|
new DbusProperty<>("Members",
|
||||||
() -> new Variant<>(getRecipientStrings(getGroup().members()), "as")),
|
() -> new Variant<>(getRecipientStrings(getGroup().members()
|
||||||
|
.stream()
|
||||||
|
.map(GroupMember::recipientAddress)
|
||||||
|
.collect(Collectors.toSet())), "as")),
|
||||||
new DbusProperty<>("PendingMembers",
|
new DbusProperty<>("PendingMembers",
|
||||||
() -> new Variant<>(getRecipientStrings(getGroup().pendingMembers()), "as")),
|
() -> new Variant<>(getRecipientStrings(getGroup().pendingMembers()), "as")),
|
||||||
new DbusProperty<>("RequestingMembers",
|
new DbusProperty<>("RequestingMembers",
|
||||||
() -> new Variant<>(getRecipientStrings(getGroup().requestingMembers()), "as")),
|
() -> new Variant<>(getRecipientStrings(getGroup().requestingMembers()), "as")),
|
||||||
new DbusProperty<>("Admins",
|
new DbusProperty<>("Admins",
|
||||||
() -> new Variant<>(getRecipientStrings(getGroup().adminMembers()), "as")),
|
() -> new Variant<>(getRecipientStrings(getGroup().members()
|
||||||
|
.stream()
|
||||||
|
.filter(GroupMember::isAdmin)
|
||||||
|
.map(GroupMember::recipientAddress)
|
||||||
|
.collect(Collectors.toSet())), "as")),
|
||||||
new DbusProperty<>("Banned",
|
new DbusProperty<>("Banned",
|
||||||
() -> new Variant<>(getRecipientStrings(getGroup().bannedMembers()), "as")),
|
() -> new Variant<>(getRecipientStrings(getGroup().bannedMembers()), "as")),
|
||||||
new DbusProperty<>("PermissionAddMember",
|
new DbusProperty<>("PermissionAddMember",
|
||||||
|
|||||||
@ -1476,6 +1476,20 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "kotlin.Pair",
|
||||||
|
"jniAccessible": true,
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "getFirst",
|
||||||
|
"parameterTypes": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getSecond",
|
||||||
|
"parameterTypes": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "kotlin.SafePublicationLazyImpl",
|
"type": "kotlin.SafePublicationLazyImpl",
|
||||||
"fields": [
|
"fields": [
|
||||||
@ -2129,6 +2143,19 @@
|
|||||||
"allDeclaredMethods": true,
|
"allDeclaredMethods": true,
|
||||||
"allDeclaredConstructors": true
|
"allDeclaredConstructors": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.asamk.signal.commands.ListGroupsCommand$JsonGroupMemberAddress",
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "number",
|
||||||
|
"parameterTypes": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "uuid",
|
||||||
|
"parameterTypes": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.asamk.signal.commands.ListIdentitiesCommand$JsonIdentity",
|
"type": "org.asamk.signal.commands.ListIdentitiesCommand$JsonIdentity",
|
||||||
"allDeclaredFields": true,
|
"allDeclaredFields": true,
|
||||||
@ -2513,6 +2540,10 @@
|
|||||||
"name": "internal",
|
"name": "internal",
|
||||||
"parameterTypes": []
|
"parameterTypes": []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "isArchived",
|
||||||
|
"parameterTypes": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "isBlocked",
|
"name": "isBlocked",
|
||||||
"parameterTypes": []
|
"parameterTypes": []
|
||||||
@ -5494,6 +5525,18 @@
|
|||||||
{
|
{
|
||||||
"type": "org.signal.core.models.ServiceId$PNI"
|
"type": "org.signal.core.models.ServiceId$PNI"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.attest.AttestationDataException",
|
||||||
|
"jniAccessible": true,
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "<init>",
|
||||||
|
"parameterTypes": [
|
||||||
|
"java.lang.String"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.internal.CompletableFuture",
|
"type": "org.signal.libsignal.internal.CompletableFuture",
|
||||||
"jniAccessible": true,
|
"jniAccessible": true,
|
||||||
@ -5805,6 +5848,78 @@
|
|||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.protocol.SessionCipher$1",
|
"type": "org.signal.libsignal.protocol.SessionCipher$1",
|
||||||
"jniAccessible": true,
|
"jniAccessible": true,
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "getIdentityKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"long"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getLocalIdentityKeyPair",
|
||||||
|
"parameterTypes": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "getLocalRegistrationId",
|
||||||
|
"parameterTypes": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "isTrustedIdentity",
|
||||||
|
"parameterTypes": [
|
||||||
|
"long",
|
||||||
|
"long",
|
||||||
|
"int"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "loadPreKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"int"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "removePreKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"int"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "saveIdentityKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"long",
|
||||||
|
"long"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.SessionCipher$2",
|
||||||
|
"jniAccessible": true,
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "loadSession",
|
||||||
|
"parameterTypes": [
|
||||||
|
"long"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "loadSignedPreKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"int"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "storeSession",
|
||||||
|
"parameterTypes": [
|
||||||
|
"long",
|
||||||
|
"long"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.SessionCipher$3",
|
||||||
|
"jniAccessible": true,
|
||||||
"methods": [
|
"methods": [
|
||||||
{
|
{
|
||||||
"name": "loadPreKey",
|
"name": "loadPreKey",
|
||||||
@ -5821,7 +5936,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.protocol.SessionCipher$2",
|
"type": "org.signal.libsignal.protocol.SessionCipher$4",
|
||||||
"jniAccessible": true,
|
"jniAccessible": true,
|
||||||
"methods": [
|
"methods": [
|
||||||
{
|
{
|
||||||
@ -5832,6 +5947,26 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.SessionCipher$5",
|
||||||
|
"jniAccessible": true,
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "loadKyberPreKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"int"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "markKyberPreKeyUsed",
|
||||||
|
"parameterTypes": [
|
||||||
|
"int",
|
||||||
|
"int",
|
||||||
|
"long"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.protocol.SignalProtocolAddress",
|
"type": "org.signal.libsignal.protocol.SignalProtocolAddress",
|
||||||
"jniAccessible": true,
|
"jniAccessible": true,
|
||||||
@ -5863,6 +5998,9 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.ecc.ECPrivateKey"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.protocol.ecc.ECPublicKey",
|
"type": "org.signal.libsignal.protocol.ecc.ECPublicKey",
|
||||||
"jniAccessible": true,
|
"jniAccessible": true,
|
||||||
@ -5887,6 +6025,27 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.groups.GroupCipher$1",
|
||||||
|
"jniAccessible": true,
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "loadSenderKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"long",
|
||||||
|
"java.util.UUID"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "storeSenderKey",
|
||||||
|
"parameterTypes": [
|
||||||
|
"long",
|
||||||
|
"java.util.UUID",
|
||||||
|
"long"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.protocol.groups.state.SenderKeyRecord",
|
"type": "org.signal.libsignal.protocol.groups.state.SenderKeyRecord",
|
||||||
"jniAccessible": true,
|
"jniAccessible": true,
|
||||||
@ -6078,10 +6237,26 @@
|
|||||||
"allDeclaredMethods": true,
|
"allDeclaredMethods": true,
|
||||||
"jniAccessible": true
|
"jniAccessible": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.state.internal.IdentityKeyStore",
|
||||||
|
"jniAccessible": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.state.internal.KyberPreKeyStore",
|
||||||
|
"jniAccessible": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.protocol.state.internal.PreKeyStore",
|
"type": "org.signal.libsignal.protocol.state.internal.PreKeyStore",
|
||||||
"jniAccessible": true
|
"jniAccessible": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.state.internal.SenderKeyStore",
|
||||||
|
"jniAccessible": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "org.signal.libsignal.protocol.state.internal.SessionStore",
|
||||||
|
"jniAccessible": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.signal.libsignal.protocol.state.internal.SignedPreKeyStore",
|
"type": "org.signal.libsignal.protocol.state.internal.SignedPreKeyStore",
|
||||||
"jniAccessible": true
|
"jniAccessible": true
|
||||||
@ -7922,6 +8097,18 @@
|
|||||||
{
|
{
|
||||||
"type": "org.whispersystems.signalservice.internal.push.GroupMismatchedDevices[]"
|
"type": "org.whispersystems.signalservice.internal.push.GroupMismatchedDevices[]"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "org.whispersystems.signalservice.internal.push.GroupPatchResponse",
|
||||||
|
"methods": [
|
||||||
|
{
|
||||||
|
"name": "<init>",
|
||||||
|
"parameterTypes": [
|
||||||
|
"java.lang.Integer",
|
||||||
|
"java.lang.String"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "org.whispersystems.signalservice.internal.push.GroupStaleDevices",
|
"type": "org.whispersystems.signalservice.internal.push.GroupStaleDevices",
|
||||||
"allDeclaredFields": true,
|
"allDeclaredFields": true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user