Exemplo n.º 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;
         }
     }
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
 }
Exemplo n.º 7
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);
 }