Skip to content

Commit 12f56e2

Browse files
committed
Support for blocking groups
1 parent 9dabdcd commit 12f56e2

File tree

6 files changed

+143
-55
lines changed

6 files changed

+143
-55
lines changed

libsignal-service-dotnet/SignalServiceMessageSender.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,10 @@ private byte[] CreateMultiDeviceBlockedContent(BlockedListMessage blocked)
483483
Blocked blockedMessage = new Blocked { };
484484

485485
blockedMessage.Numbers.AddRange(blocked.Numbers);
486+
foreach (var groupId in blocked.GroupIds)
487+
{
488+
blockedMessage.GroupIds.Add(ByteString.CopyFrom(groupId));
489+
}
486490
syncMessage.Blocked = blockedMessage;
487491
content.SyncMessage = syncMessage;
488492
return content.ToByteArray();

libsignal-service-dotnet/messages/multidevice/BlockedListMessage.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ namespace libsignalservice.messages.multidevice
55
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
66
public class BlockedListMessage
77
{
8-
public List<string> Numbers { get; }
8+
public List<string> Numbers { get; }
9+
public List<byte[]> GroupIds { get; }
910

10-
public BlockedListMessage(List<string> numbers)
11+
public BlockedListMessage(List<string> numbers, List<byte[]> groupIds)
1112
{
12-
Numbers = numbers;
13+
Numbers = numbers;
14+
GroupIds = groupIds;
1315
}
1416
}
1517
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

libsignal-service-dotnet/messages/multidevice/DeviceGroup.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ public class DeviceGroup
1313
public bool Active { get; }
1414
public uint? ExpirationTimer { get; }
1515
public string? Color { get; }
16+
public bool Blocked { get; }
1617

17-
public DeviceGroup(byte[] id, string? name, IList<string> members, SignalServiceAttachmentStream? avatar, bool active, uint? expirationTimer, string? color)
18+
public DeviceGroup(byte[] id, string? name, IList<string> members, SignalServiceAttachmentStream? avatar, bool active, uint? expirationTimer, string? color, bool blocked)
1819
{
1920
Id = id;
2021
Name = name;
@@ -23,6 +24,7 @@ public DeviceGroup(byte[] id, string? name, IList<string> members, SignalService
2324
Active = active;
2425
ExpirationTimer = expirationTimer;
2526
Color = color;
27+
Blocked = blocked;
2628
}
2729
}
2830
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

libsignal-service-dotnet/messages/multidevice/DeviceGroupsInputStream.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public DeviceGroup Read()
2929
bool active = details.Active;
3030
uint? expirationTimer = null;
3131
string? color = details.ColorOneofCase == GroupDetails.ColorOneofOneofCase.Color ? details.Color : null;
32+
var blocked = details.Blocked;
3233

3334
if (details.AvatarOneofCase == GroupDetails.AvatarOneofOneofCase.Avatar)
3435
{
@@ -43,7 +44,7 @@ public DeviceGroup Read()
4344
expirationTimer = details.ExpireTimer;
4445
}
4546

46-
return new DeviceGroup(id, name, members, avatar, active, expirationTimer, color);
47+
return new DeviceGroup(id, name, members, avatar, active, expirationTimer, color, blocked);
4748
}
4849
}
4950
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member

libsignal-service-dotnet/protobuf/SignalService.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ message SyncMessage {
211211

212212
message Blocked {
213213
repeated string numbers = 1;
214+
repeated bytes groupIds = 2;
214215
}
215216

216217
message Request {
@@ -307,4 +308,5 @@ message GroupDetails {
307308
oneof active_oneof { bool active = 5; } //[default = true] ### }
308309
oneof expireTimer_oneof { uint32 expireTimer = 6; }
309310
oneof color_oneof { string color = 7; }
311+
oneof blocked_oneof { bool blocked = 8; }
310312
}

0 commit comments

Comments
 (0)