Esempio n. 1
0
 /// <summary>
 ///     Retrieve the modes for the specified channel.
 /// </summary>
 /// <param name="channel">The channel for which to retrieve modes.</param>
 public void Mode(IrcTarget channel)
 {
     if (channel.IsChannel)
     {
         Send("MODE", channel);
     }
 }
Esempio n. 2
0
        private void OnMode(IrcMessage message)
        {
            if (message.Parameters.Count > 0)
            {
                if (IrcTarget.IsChannelName(message.Parameters[0]))
                {
                    RaiseEvent(ChannelModeChanged, new IrcChannelModeEventArgs(message));
                }
                else
                {
                    var e = new IrcUserModeEventArgs(message);
                    UserModes =
                        (from m in e.Modes.Where(newMode => newMode.Set).Select(newMode => newMode.Mode).Union(UserModes).Distinct()
                         where !e.Modes.Any(newMode => !newMode.Set && newMode.Mode == m)
                         select m).ToArray();

                    RaiseEvent(UserModeChanged, new IrcUserModeEventArgs(message));
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 ///     Send a notice to a user or channel.
 /// </summary>
 /// <param name="target">The user or channel that the notice will be delivered to.</param>
 /// <param name="text">The notice text.</param>
 public void Notice(IrcTarget target, string text)
 {
     Send("NOTICE", target, text);
 }
Esempio n. 4
0
 /// <summary>
 ///     Send a private message to a user or channel.
 /// </summary>
 /// <param name="target">The user or channel that the message will be delivered to.</param>
 /// <param name="text">The message text.</param>
 public void PrivateMessage(IrcTarget target, string text)
 {
     Send("PRIVMSG", target, text);
 }
Esempio n. 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 void SendCtcp(IrcTarget target, CtcpCommand command, bool isResponse)
 {
     Send(isResponse ? "NOTICE" : "PRIVMSG", target, command.ToString());
 }
Esempio n. 6
0
 /// <summary>
 ///     Send a message to the server.
 /// </summary>
 /// <param name="command">The name of the command.</param>
 /// <param name="target">The target of the command.</param>
 /// <param name="parameters">The optional command parameters.</param>
 public void Send(string command, IrcTarget target, params string[] parameters)
 {
     Send(command, (new[] { target.ToString() }).Union(parameters).ToArray());
 }
Esempio n. 7
0
 /// <summary>
 ///     Determine whether the specified target refers to this session by comparing the nickname to the session's current
 ///     nickname.
 /// </summary>
 /// <param name="target">The target to evaluate.</param>
 /// <returns>True if the target refers to this session, false otherwise.</returns>
 public bool IsSelf(IrcTarget target)
 {
     return(target != null && !target.IsChannel &&
            string.Compare(target.Name, Nickname, StringComparison.OrdinalIgnoreCase) == 0);
 }