internal void OnRequestMuteUserMessage(MessageEventArgs <RequestMuteUserMessage> e) { var msg = e.Message; if (!context.GetPermission(PermissionName.MuteUser, e.Connection)) { e.Connection.SendAsync(new PermissionDeniedMessage(GablarskiMessageType.RequestMuteUser)); return; } IUserInfo user = Manager.FirstOrDefault(u => u.UserId == msg.TargetId); if (user == null) { return; } if (user.IsMuted == msg.Unmute) { Manager.ToggleMute(user); } else { return; } foreach (IConnection connection in this.context.Connections) { connection.SendAsync(new UserMutedMessage { UserId = user.UserId, Unmuted = msg.Unmute }); } }
public void ToggleMuteNull() { Assert.Throws <ArgumentNullException> (() => manager.ToggleMute(null)); }