private OperationResponse HandleOperationRemoveChatChannel(OperationRequest operationRequest)
        {
            var operation = new RemoveChannel(this.Protocol, operationRequest);

            if (!operation.IsValid)
            {
                return new OperationResponse(operationRequest.OperationCode)
                       {
                           ReturnCode = (short)ResultCode.InvalidOperationParameter, DebugMessage = operation.GetErrorMessage()
                       }
            }
            ;

            Channel channel;

            if (chat.Channels.TryGetValue(operation.ChannelId, out channel))
            {
                if (!chat.RemoveChannel(channel))
                {
                    // this wont happen
                    _logger.ErrorFormat("[HandleOperationRemoveChatChannel]: Cannot remove chat channel");
                    channel.Dispose();
                }
                this.channels.Remove(channel.Id);
            }
            return(null);
        }
Ejemplo n.º 2
0
 public void SetUp()
 {
     handler = Create<RemoveChannel>();
 }