public async void Init() { using var events = _client.ContextActionEvents(new MurmurRPC.ContextAction { Action = Action, Channel = Channel?.GetMumbleChannel(), Context = (uint)Context, Server = Server?.GetMumbleServer(), Text = Text, User = User?.GetMumbleUser() }); if (events?.ResponseStream is null) { return; } await foreach (var ev in events.ResponseStream.ReadAllAsync()) { var ch = ev.Channel == null ? null : _client.ChannelGet(ev.Channel); var se = ev.Server == null ? null : _client.ServerGet(ev.Server); var us = ev.User == null ? null : _client.UserGet(ev.User); Trigger?.Invoke(this, new MumbleContextActionEvent(ev.Action, ev.Text, ev.Context, ev.Actor, us, ch, se)); } }
public MumbleChannel(Channel channel, V1.V1Client client) { _client = client ?? throw new ArgumentNullException(nameof(client), "Client is null!"); if (channel == null) { throw new ArgumentNullException(nameof(channel), "Channel is null!"); } _channel = _client.ChannelGet(channel); }
public bool HasAdmin() { var perm = _client.ACLGetEffectivePermissions(new ACL.Types.Query { User = _user, Channel = _client.ChannelGet(new Channel { Id = 0, Server = Server }), Server = Server }); // Assuming if the user has ban on ALLOW in Root-Channel (Channel 0), then he would be an "admin". var hasBanSetInRoot = IsBitSet((byte)perm.Allow, (int)ACL.Types.Permission.Ban); return(hasBanSetInRoot); }
public void SetParent(uint parentId) { var newparent = _client.ChannelGet(new Channel { Id = parentId, Server = _channel.Server }); if (newparent == null) { return; } _channel.Parent = newparent; _client.ChannelUpdate(_channel); }