コード例 #1
0
        /// <summary>
        /// Returns the mask that matches the given user.
        /// </summary>
        public Mask GetMatch(IrcUser user)
        {
            var match = Masks.FirstOrDefault(m => user.Match(m.Value));

            if (match == null)
            {
                throw new KeyNotFoundException("No mask matches the specified user.");
            }
            return(match);
        }
コード例 #2
0
ファイル: WhoX.cs プロジェクト: Unreal-System/mo_blacklist
 internal ExtendedWho()
 {
     QueryType = -1;
     Channel   = "*";
     User      = new IrcUser();
     IP        = string.Empty;
     Server    = string.Empty;
     Flags     = string.Empty;
     Hops      = -1;
     TimeIdle  = -1;
     OpLevel   = "n/a";
 }
コード例 #3
0
        /// <summary>
        /// Creates a new IRC client, but will not connect until ConnectAsync is called.
        /// </summary>
        /// <param name="serverAddress">Server address including port in the form of "hostname:port".</param>
        /// <param name="user">The IRC user to connect as.</param>
        /// <param name="useSSL">Connect with SSL if true.</param>
        public IrcClient(string serverAddress, IrcUser user, bool useSSL = false)
        {
            if (serverAddress == null)
            {
                throw new ArgumentNullException("serverAddress");
            }
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            User          = user;
            ServerAddress = serverAddress;
            Encoding      = Encoding.UTF8;
            Settings      = new ClientSettings();
            Handlers      = new Dictionary <string, MessageHandler>();
            MessageHandlers.RegisterDefaultHandlers(this);
            RequestManager = new RequestManager();
            UseSSL         = useSSL;
            WriteQueue     = new ConcurrentQueue <string>();
            ServerInfo     = new ServerInfo();
            PrivmsgPrefix  = "";
            Channels       = User.Channels = new ChannelCollection(this);
            Users          = new UserPool();
            Users.Add(User); // Add self to user pool
            Capabilities = new CapabilityPool();

            // List of supported capabilities
            Capabilities.AddRange(new string[] {
                "server-time", "multi-prefix", "cap-notify", "znc.in/server-time", "znc.in/server-time-iso",
                "account-notify", "chghost", "userhost-in-names", "sasl"
            });

            IsNegotiatingCapabilities = false;
            IsAuthenticatingSasl      = false;

            RandomNumber = new Random();
        }
コード例 #4
0
ファイル: Mask.cs プロジェクト: Unreal-System/mo_blacklist
 internal Mask(string value, IrcUser creator, DateTime creationTime)
 {
     Value        = value;
     Creator      = creator;
     CreationTime = creationTime;
 }
コード例 #5
0
 /// <summary>
 /// True if any mask matches the given user.
 /// </summary>
 public bool ContainsMatch(IrcUser user)
 {
     return(Masks.Any(m => user.Match(m.Value)));
 }