Ejemplo n.º 1
0
        /// <summary>
        /// Adds the specified message to the response.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="destination">The destination.</param>
        public void respond(string message, CommandResponseDestination destination)
        {
            CommandResponse cr;

            cr.destination = destination;
            cr.message     = message;

            this._responses.Add(cr);
        }
Ejemplo n.º 2
0
        public IEnumerable <CommandResponse> Respond(
            string messageKey,
            string context,
            object[] arguments,
            Context contextType = null,
            CommandResponseDestination destination = CommandResponseDestination.Default,
            CommandResponseType type = CommandResponseType.Message,
            bool ignoreRedirection   = false,
            IEnumerable <string> redirectionTarget = null)
        {
            List <string> redirectionTargetList = null;

            if (redirectionTarget != null)
            {
                redirectionTargetList = redirectionTarget.ToList();
            }

            return(this.GetMessagePartAlternates(messageKey, context, arguments, contextType, false).Select(
                       parsedString =>
            {
                string ctcp = null;
                var msgIgnoreRedir = ignoreRedirection;
                var msgDest = destination;
                var msg = parsedString;

                if (msg.StartsWith("#ACTION"))
                {
                    ctcp = "ACTION";
                    msgIgnoreRedir = true;
                    msg = msg.Substring("#ACTION ".Length);
                }

                if (msg.StartsWith("#PRIVMSG"))
                {
                    msgDest = CommandResponseDestination.PrivateMessage;
                    msg = msg.Substring("#PRIVMSG ".Length);
                    msgIgnoreRedir = true;
                }

                return new CommandResponse
                {
                    Message = msg,
                    ClientToClientProtocol = ctcp,
                    IgnoreRedirection = msgIgnoreRedir,
                    Destination = msgDest,
                    Type = type,
                    RedirectionTarget = redirectionTargetList
                };
            }));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the specified message to the response.
        /// </summary>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="destination">
        /// The destination.
        /// </param>
        public void Respond(string message, CommandResponseDestination destination)
        {
            CommandResponse cr;
            cr.Destination = destination;
            cr.Message = message;

            this.responses.Add(cr);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initialises a new instance of the <see cref="CommandResponseHandler"/> class. 
 /// </summary>
 /// <param name="message">
 /// A message.
 /// </param>
 /// <param name="destination">
 /// The destination of the message.
 /// </param>
 public CommandResponseHandler(string message, CommandResponseDestination destination)
 {
     this.responses = new ArrayList();
     this.Respond(message, destination);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandResponseHandler"/> class.
 /// </summary>
 /// <param name="message">A message.</param>
 /// <param name="destination">The destination of the message.</param>
 public CommandResponseHandler(string message, CommandResponseDestination destination)
 {
     this._responses = new ArrayList();
     respond(message, destination);
 }