internal CtcpEventArgs(IrcMessage message) : base(message) { this.From = message.From as IrcPeer; this.To = message.Parameters.Count > 0 ? new IrcTarget(message.Parameters[0]) : null; this.Command = message.Parameters.Count > 1 ? CtcpCommand.Parse(message.Parameters[1]) : null; this.IsResponse = message.Command == "NOTICE"; }
private void OnNotice(IrcMessage message) { if (message.Parameters.Count > 1 && CtcpCommand.IsCtcpCommand(message.Parameters[1])) { this.OnCtcpCommand(message); } else { this.RaiseEvent(this.Noticed, new IrcMessageEventArgs(message)); } }
/// <summary> /// Send a CTCP message to another client. /// </summary> /// <param name="target">The user to which the CTCP command will be delivered.</param> /// <param name="command">The CTCP command to send.</param> /// <param name="isResponse">Indicates whether the CTCP message is a response to a command that was received. This parameter /// is important for preventing an infinite back-and-forth loop between two clients.</param> public void SendCtcp(IrcTarget target, CtcpCommand command, bool isResponse) { this.Send(isResponse ? "NOTICE" : "PRIVMSG", target, command.ToString()); }