예제 #1
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;
         }
     }
 }
예제 #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>
 /// <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;
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Irc.PrivateMessage"/> class.
        /// </summary>
        /// <param name="user">The remote user the message is open with.</param>
        /// <param name="connection">The server connection the message belongs to.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if user or connection are null.</exception>
        public PrivateMessage(User user, IIrcxProtocol connection)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            Name       = user.Nickname;
            RemoteUser = user;
            Client     = connection;
        }
예제 #4
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);
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the Relirc.IgnoredUser class.
        /// </summary>
        public IgnoredUser(string mask, string networkName, IIrcxProtocol connection)
        {
            if (string.IsNullOrWhiteSpace(mask))
            {
                throw new ArgumentNullException(nameof(mask));
            }
            if (string.IsNullOrWhiteSpace(networkName))
            {
                throw new ArgumentNullException(nameof(networkName));
            }
            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            Mask        = mask;
            NetworkName = networkName;
            Connection  = connection;
        }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Irc.PrivateMessage"/> class.
 /// </summary>
 /// <param name="user">The remote user the message is open with.</param>
 /// <param name="connection">The server connection the message belongs to.</param>
 /// <param name="incomingMessage">The incoming message that initiated the private message conversation.</param>
 /// <exception cref="System.ArgumentNullException">Thrown if user or connection are null.</exception>
 public PrivateMessage(User user, IIrcxProtocol connection, PrivateMessageEventArgs incomingMessage)
     : this(user, connection)
 {
     OpeningMessage = incomingMessage;
 }
예제 #7
0
파일: Friend.cs 프로젝트: zmilliron/Irc
 /// <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);
 }