Пример #1
0
 public override void SendResponse(Response response)
 {
     try
     {
         if (response.ResponseType == ResponseType.Action)
         {
             if (response.ResponseTargetType == ResponseTargetType.Private)
             {
                 _ircConnection.Sender.PrivateAction(response.Nick, response.Message);
             }
             else if (response.ResponseTargetType == ResponseTargetType.Public)
             {
                 _ircConnection.Sender.Action(response.Channel, response.Message);
             }
         }
         else if (response.ResponseType == ResponseType.Message)
         {
             if (response.ResponseTargetType == ResponseTargetType.Private)
             {
                 _ircConnection.Sender.PrivateMessage(response.Nick, response.Message);
             }
             else if (response.ResponseTargetType == ResponseTargetType.Public)
             {
                 _ircConnection.Sender.PublicMessage(response.Channel, response.Message);
             }
         }
     }
     catch (Exception ex)
     {
         _logger.WarnFormat("Caught an exception trying to SendResponse on [channel: {0} by nick: {1} of message {2}]: {3}",
                            response.Channel, response.Nick ?? "N/A", response.Message, ex);
     }
 }
Пример #2
0
 /// <summary>
 /// Attempts to send an outgoing message to the world.
 /// </summary>
 /// 
 /// <param name="response">A response object to send.</param>
 public void SendResponse(Response response)
 {
     _ircClient.SendResponse(response);
 }
Пример #3
0
 /// <summary>
 /// Attempt to send an outgoing message through our communications manager.
 /// </summary>
 /// 
 /// <param name="response">The outgoing message to send.</param>
 public void HandleResponse(Response response)
 {
     CommunicationManager.SendResponse(response);
 }
Пример #4
0
 /// <summary>
 /// Attempts to send an outgoing message to the world.
 /// </summary>
 /// 
 /// <param name="response">A response object to send.</param>
 public void SendResponse(Response response)
 {
     try
     {
         if (response.ResponseType == ResponseType.Public)
         {
             _ircClient.LocalUser.SendMessage(response.Channel, response.Message);
         }
         else if (response.ResponseType == ResponseType.Private)
         {
             _ircClient.LocalUser.SendMessage(response.Nick, response.Message);
         }
     }
     catch (Exception ex)
     {
         _logger.WarnFormat("Caught an exception trying to SendResponse on [channel: {0} by nick: {1} of message {2}]: {3}",
                            response.Channel, response.Nick ?? "N/A", response.Message, ex);
     }
 }
Пример #5
0
        public override void SendResponse(Response response)
        {
            try
            {
                if (response.ResponseType == ResponseType.Action)
                {
                    IIrcMessageTarget target = null;

                    if (response.ResponseTargetType == ResponseTargetType.Public)
                    {
                        target = _ircClient.Channels.FirstOrDefault(c => c.Name.Equals(response.Channel, StringComparison.OrdinalIgnoreCase));
                    }
                    else if (response.ResponseTargetType == ResponseTargetType.Private)
                    {
                        target = _ircClient.Users.FirstOrDefault(u => u.NickName.Equals(response.Nick, StringComparison.OrdinalIgnoreCase));
                    }

                    if (target != null)
                    {
                        _ctcpClient.SendAction(target, response.Message);
                    }
                }
                else if (response.ResponseType == ResponseType.Message)
                {
                    string target = null;

                    if (response.ResponseTargetType == ResponseTargetType.Public)
                    {
                        target = response.Channel;
                    }
                    else if (response.ResponseTargetType == ResponseTargetType.Private)
                    {
                        target = response.Nick;
                    }

                    if (target != null)
                    {
                        _ircClient.LocalUser.SendMessage(target, response.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.WarnFormat("Caught an exception trying to SendResponse on [channel: {0} by nick: {1} of message {2}]: {3}",
                    response.Channel,
                    response.Nick ?? "N/A",
                    response.Message,
                    ex);
            }
        }