Example #1
0
 /// <summary>
 /// Adds a friend to automatically register in the friends list after connecting to a network.
 /// </summary>
 /// <param name="nickname">The nickname of the friend to add.</param>
 public void AddFriend(IrcNickname nickname)
 {
     if (!_friends.Contains(nickname))
     {
         _friends.Add(nickname);
     }
 }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.ChannelUser"/> class.
 /// </summary>
 /// <param name="nickname">The nickname of the user.</param>
 /// <param name="channel">The channel the user belongs to.</param>
 /// <param name="client">The connection to the network on which the user exists.</param>
 /// <param name="modes">The current channel modes set for the user.</param>
 /// <exception cref="System.ArgumentNullException">Thrown if nickname or connection is null.</exception>
 public ChannelUser(IrcNickname nickname, Channel channel, IIrcxProtocol client, string modes)
     : this(nickname, channel, client)
 {
     //set the channel status of the user
     if (!string.IsNullOrEmpty(modes))
     {
         if (modes.Contains(OPERATORPREFIX))
         {
             _channelStatus |= UserChannelModes.Operator;
         }
         if (modes.Contains(VOICEPREFIX))
         {
             _channelStatus |= UserChannelModes.Voice;
         }
         if (modes.Contains(HALFOPERATORPREFIX))
         {
             _channelStatus |= UserChannelModes.HalfOperator;
         }
         if (modes.Contains(OWNERPREFIX))
         {
             _channelStatus |= UserChannelModes.Owner;
         }
         if (modes.Contains(PROTECTEDPREFIX))
         {
             _channelStatus |= UserChannelModes.Protected;
         }
     }
 }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.TopicEventArgs"/> class.
        /// </summary>
        /// <param name="channelName">The name of the channel on which the topic is set.</param>
        /// <param name="author">The nickname of the user that set the topic.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelName or author are null.</exception>
        public TopicChangeEventArgs(IrcChannelName channelName, IrcNickname author) : base(channelName)
        {
            if (author == null)
            {
                throw new ArgumentNullException(nameof(author));
            }

            Nickname = author;
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.AwayEventArgs"/> class.
        /// </summary>
        /// <param name="nickname">The nickname of the user that
        /// is the source of the event.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if nickname is null.</exception>
        public AwayEventArgs(IrcNickname nickname)
        {
            if (nickname == null)
            {
                throw new ArgumentNullException(nameof(nickname));
            }

            Nickname = nickname;
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.ChannelUser"/> class.
 /// </summary>
 /// <param name="nickname">The nickname of the user.</param>
 /// <param name="channel">The channel the user belongs to.</param>
 /// <param name="client">The connection to the network on which the user exists.</param>
 /// <exception cref="System.ArgumentNullException">Thrown if nickname or connection is null.</exception>
 public ChannelUser(IrcNickname nickname, Channel channel, IIrcxProtocol client)
     : base(nickname, client)
 {
     if (channel == null)
     {
         throw new ArgumentNullException(nameof(channel));
     }
     Channel = channel;
 }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.ServiceListEventArgs"/> class.
        /// </summary>
        /// <param name="serviceName">The name of a service in the network service list.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if serviceName is null.</exception>
        public ServiceListEventArgs(IrcNickname serviceName)
        {
            if (serviceName == null)
            {
                throw new ArgumentNullException(nameof(serviceName));
            }

            ServiceName = serviceName;
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the Irc.JoinEventArgs class.
        /// </summary>
        /// <param name="channelName">The name of the channel that has been joined.</param>
        /// <param name="newUserName">The nickname of the new user that has joined.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelName or nickname are null.</exception>
        public JoinEventArgs(IrcChannelName channelName, IrcNickname newUserName)
            : base(newUserName)
        {
            if (channelName == null)
            {
                throw new ArgumentNullException(nameof(channelName));
            }

            ChannelName = channelName;
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.NickChangeEventArgs"/> class.
        /// </summary>
        /// <param name="oldNickname">The user's nickname before the change.</param>
        /// <param name="newNickname">The user's new nickname after the change.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if oldNickname or newNickname are null.</exception>
        public NickChangeEventArgs(IrcNickname oldNickname, IrcNickname newNickname)
            : base(oldNickname)
        {
            if (newNickname == null)
            {
                throw new ArgumentNullException(nameof(newNickname));
            }

            NewNickname = newNickname;
        }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.PrivateMessageEventArgs"/> class.
        /// </summary>
        /// <param name="sender">The nickname of the user sending the message.</param>
        /// <param name="target">The user or channel that the message is being sent to.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if sender or target are null.</exception>
        public PrivateMessageEventArgs(IrcNickname sender, IrcNameBase target)
            : base(sender)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            MessageTarget = target;
            TimeStamp     = DateTime.Now;
        }
Example #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.ChannelModeEventArgs"/> class.
        /// </summary>
        /// <param name="channelName">The channel that is the source of the mode change.</param>
        /// <param name="modeChanger">The nickname of the user that changed the channel modes, or null if none exists.</param>
        /// <param name="modeString">The mode string containing a list of added and removed channel modes.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelName is null.</exception>
        public ChannelModeEventArgs(IrcChannelName channelName, IrcNickname modeChanger, ChannelModeString modeString)
            : base(modeChanger)
        {
            if (channelName == null)
            {
                throw new ArgumentNullException(nameof(channelName));
            }

            ChannelName = channelName;

            ModeString = modeString;
        }
Example #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.ChannelCreatorEventArgs"/> class.
        /// </summary>
        /// <param name="channelName">The name of a channel that was queried.</param>
        /// <param name="creator">The nickname of the user that created the channel.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelName or creator are null.</exception>
        public ChannelCreatorEventArgs(IrcChannelName channelName, IrcNickname creator)
        {
            if (channelName == null)
            {
                throw new ArgumentNullException(nameof(channelName));
            }
            if (creator == null)
            {
                throw new ArgumentNullException(nameof(creator));
            }

            Nickname    = creator;
            ChannelName = channelName;
        }
Example #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.KickEventArgs"/> class.
        /// </summary>
        /// <param name="channelName">The name of the channel a user was kicked from.</param>
        /// <param name="kicker">The nickname of the user that performed the kick.</param>
        /// <param name="userKicked">The nickname of the user that was kicked.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelName, kicker, or userKicked is null.</exception>
        public KickEventArgs(IrcChannelName channelName, IrcNickname kicker, IrcNickname userKicked) : base(kicker)
        {
            if (channelName == null)
            {
                throw new ArgumentNullException(nameof(channelName));
            }
            if (userKicked == null)
            {
                throw new ArgumentNullException(nameof(userKicked));
            }

            ChannelName = channelName;
            UserKicked  = userKicked;
        }
Example #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.TopicAuthorEventArgs"/> class.
        /// </summary>
        /// <param name="channelName">The channel on which the topic was set.</param>
        /// <param name="author">The nickname of the user that set the topic.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelName or author are null.</exception>
        public TopicAuthorEventArgs(IrcChannelName channelName, IrcNickname author)
        {
            if (channelName == null)
            {
                throw new ArgumentNullException(nameof(channelName));
            }
            if (author == null)
            {
                throw new ArgumentNullException(nameof(author));
            }

            ChannelName = channelName;
            Author      = author;
        }
Example #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.PartEventArgs"/> class.
        /// </summary>
        /// <param name="channelParted">The name of the channel that a user has left.</param>
        /// <param name="partingUser">The nickname of a user that has left the channel.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelParted or partingUser are null.</exception>
        public PartEventArgs(IrcChannelName channelParted, IrcNickname partingUser)
            : base(partingUser)
        {
            if (channelParted == null)
            {
                throw new ArgumentNullException(nameof(channelParted));
            }
            if (partingUser == null)
            {
                throw new ArgumentNullException(nameof(partingUser));
            }

            ChannelName = channelParted;
        }
Example #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.InviteEventArgs"/> class.
        /// </summary>
        /// <param name="channelName">The channel the user is being invited to.</param>
        /// <param name="sender">The nickname of the user sending the invitation.</param>
        /// <param name="recipient">The nickname of the recipient of the invitation.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if channelName, sender, or recipient are null.</exception>
        public InviteEventArgs(IrcChannelName channelName, IrcNickname sender, IrcNickname recipient) : base(sender)
        {
            if (channelName == null)
            {
                throw new ArgumentNullException(nameof(channelName));
            }
            if (sender == null)
            {
                throw new ArgumentNullException(nameof(sender));
            }
            if (recipient == null)
            {
                throw new ArgumentNullException(nameof(recipient));
            }

            ChannelName   = channelName;
            RecipientName = recipient;
        }
Example #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.User"/> class.
        /// </summary>
        /// <param name="nickname">The nickname of the user.</param>
        /// <param name="client">The connection to the network on which the user exists.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if nickname or connection is null.</exception>
        public User(IrcNickname nickname, IIrcxProtocol client)
        {
            if (nickname == null)
            {
                throw new ArgumentNullException(nameof(nickname));
            }
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            Nickname = nickname;
            Client   = client;
            Channels = new ReadOnlyCollection <IrcChannelName>(new IrcChannelName[0]);

            Client.WhoIsReceived   += new EventHandler <WhoIsEventArgs>(OnWhoIsReceived);
            Client.NicknameChanged += new EventHandler <NickChangeEventArgs>(OnNicknameChanged);
            Client.UserIsAway      += new EventHandler <AwayEventArgs>(OnUserIsAway);
        }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.WhoIsEventArgs"/> class.
 /// </summary>
 /// <param name="searchedUser">The nickname of the user searched for with a WHOIS command.</param>
 /// <exception cref="System.ArgumentNullException">Thrown if searchedUser is null.</exception>
 public WhoIsEventArgs(IrcNickname searchedUser) : base(searchedUser)
 {
 }
Example #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.ClientModeEventArgs"/> class.
 /// </summary>
 /// <param name="modeChanger">The nickname of the user changing the mode.</param>
 /// <param name="modeString">The mode string.</param>
 public ClientModeEventArgs(IrcNickname modeChanger, ClientModeString modeString)
     : base(modeChanger)
 {
     ModeString = modeString;
 }
Example #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.Friend"/> class.
 /// </summary>
 /// <param name="nickname">The nickname of the user.</param>
 /// <param name="client">A client connection to an IRC network.</param>
 /// <exception cref="System.ArgumentNullException">Thrown if nickname or connection is null.</exception>
 public Friend(IrcNickname nickname, IIrcxProtocol client) : base(nickname, client)
 {
     Client.FriendSignedOn         += new EventHandler <WatchEventArgs>(OnUserSignedOn);
     Client.FriendSignedOff        += new EventHandler <WatchEventArgs>(OnUserSignedOff);
     Client.ConnectionStateChanged += new EventHandler(OnConnectionStateChanged);
 }
Example #20
0
 /// <summary>
 /// Removes a friend to automatically register in the friends list.
 /// </summary>
 /// <param name="nickname">The name of the friend to remove.  Sad face.</param>
 public void RemoveFriend(IrcNickname nickname)
 {
     _friends.Remove(nickname);
 }
Example #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.UserNotFoundException"/> class.
 /// </summary>
 /// <param name="nickname">The nickname of the user that could not be found.</param>
 /// <param name="message">A message that describes the error.</param>
 /// <param name="innerException">The exception that is the cause of the current exception, or a null reference is no inner exception is specified.</param>
 public UserNotFoundException(IrcNickname nickname, string message, Exception innerException)
     : base(message, innerException)
 {
     Nickname = nickname;
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.UserNotFoundException"/> class.
 /// </summary>
 /// <param name="nickname">The nickname of the user that could not be found.</param>
 /// <param name="message">A message that describes the error.</param>
 public UserNotFoundException(IrcNickname nickname, string message)
     : base(message)
 {
     Nickname = nickname;
 }
Example #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.UserNotFoundException"/> class.
 /// </summary>
 /// <param name="nickname">The nickname of the user that could not be found.</param>
 public UserNotFoundException(IrcNickname nickname)
     : base(Properties.Resources.UserNotFound)
 {
     Nickname = nickname;
 }