Exemple #1
0
 private void session_RawMessageReceived(object sender, IrcEventArgs e)
 {
     if (e.Message.Command == "PRIVMSG" && e.Message.Parameters.Count == 2 &&
         (!CtcpCommand.IsCtcpCommand(e.Message.Parameters[1]) ||
          CtcpCommand.Parse(e.Message.Parameters[1]).Command == "ACTION"))
     {
         var target = new IrcTarget(e.Message.Parameters[0]);
         if (App.IsIgnoreMatch(e.Message.From, target.IsChannel ? IgnoreActions.Channel : IgnoreActions.Private))
         {
             return;
         }
         if (!target.IsChannel && e.Message.From is IrcPeer)
         {
             if (App.Create(sender as IrcSession, new IrcTarget((IrcPeer)e.Message.From), false) &&
                 _notifyIcon != null && _notifyIcon.IsVisible)
             {
                 _notifyIcon.Show("IRC Message", string.Format("You received a message from {0}.", ((IrcPeer)e.Message.From).Nickname));
             }
         }
         else if (_notifyIcon != null && _notifyIcon.IsVisible && e.Message.From is IrcPeer)
         {
             var title = String.Format("{0} : {1}", e.Message.Parameters[0], ((IrcPeer)e.Message.From).Nickname);
             _notifyIcon.Show(title, e.Message.Parameters[1]);
         }
     }
 }
Exemple #2
0
 internal CtcpEventArgs(IrcMessage message)
     : base(message)
 {
     From       = message.From as IrcPeer;
     To         = message.Parameters.Count > 0 ? new IrcTarget(message.Parameters[0]) : null;
     Command    = message.Parameters.Count > 1 ? CtcpCommand.Parse(message.Parameters[1]) : null;
     IsResponse = message.Command == "NOTICE";
 }
Exemple #3
0
 private void OnPrivateMessage(IrcMessage message)
 {
     if (message.Parameters.Count > 1 && CtcpCommand.IsCtcpCommand(message.Parameters[1]))
     {
         OnCtcpCommand(message);
     }
     else
     {
         RaiseEvent(PrivateMessaged, new IrcMessageEventArgs(message));
     }
 }
Exemple #4
0
 /// <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)
 {
     Send(isResponse ? "NOTICE" : "PRIVMSG", target, command.ToString());
 }
Exemple #5
0
 /// <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 async Task SendCtcpAsync(IrcTarget target, CtcpCommand command, bool isResponse)
 {
     await SendAsync(isResponse? "NOTICE" : "PRIVMSG", target, command.ToString());
 }