M5: Windows client moderation UI; add C ABI getters for account list, user mute/deafen, channel topic
This commit is contained in:
@@ -36,6 +36,7 @@ internal static class Marshaling
|
||||
raw.Id,
|
||||
raw.ParentId,
|
||||
Marshal.PtrToStringUTF8(raw.Name) ?? string.Empty,
|
||||
Marshal.PtrToStringUTF8(raw.Topic) ?? string.Empty,
|
||||
raw.PasswordProtected != 0,
|
||||
raw.MaxUsers));
|
||||
}
|
||||
@@ -54,7 +55,11 @@ internal static class Marshaling
|
||||
raw.Id,
|
||||
Marshal.PtrToStringUTF8(raw.Nickname) ?? string.Empty,
|
||||
raw.IsGuest != 0,
|
||||
raw.ChannelId));
|
||||
raw.ChannelId,
|
||||
raw.SelfMicMuted != 0,
|
||||
raw.SelfDeafened != 0,
|
||||
raw.ServerMuted != 0,
|
||||
raw.ServerDeafened != 0));
|
||||
}
|
||||
NativeMethods.vc_free_user_list(ref native);
|
||||
return result;
|
||||
@@ -87,4 +92,29 @@ internal static class Marshaling
|
||||
native.ExpectedPacketLoss,
|
||||
native.Dtx != 0,
|
||||
native.Complexity);
|
||||
|
||||
public static PermissionsInfo ToManaged(in VcPermissionsNative native) => new(
|
||||
native.CanCreateTempChannel != 0,
|
||||
native.CanKick != 0,
|
||||
native.CanBan != 0,
|
||||
native.CanMoveUsers != 0,
|
||||
native.CanAdminAccounts != 0,
|
||||
native.IsAdmin != 0);
|
||||
|
||||
public static List<AccountInfo> ToManaged(ref VcAccountListNative native)
|
||||
{
|
||||
var result = new List<AccountInfo>((int)native.Count);
|
||||
int size = Marshal.SizeOf<VcAccountNative>();
|
||||
for (nuint i = 0; i < native.Count; i++)
|
||||
{
|
||||
var raw = Marshal.PtrToStructure<VcAccountNative>(native.Items + (int)i * size);
|
||||
result.Add(new AccountInfo(
|
||||
Marshal.PtrToStringUTF8(raw.Username) ?? string.Empty,
|
||||
raw.IsAdmin != 0,
|
||||
raw.CreatedAtUnixMs,
|
||||
raw.LastLoginUnixMs));
|
||||
}
|
||||
NativeMethods.vc_free_account_list(ref native);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user