Beispiel #1
0
 internal void SetLocalUserModes(IrcLocalUser user, string modes)
 {
     SendMessageUserMode(user.NickName, modes);
 }
Beispiel #2
0
        private void HandleClientConnected(IrcRegistrationInfo regInfo)
        {
            DebugUtilities.WriteEvent(string.Format("Connected to server at '{0}'.",
                ((IPEndPoint)this.socket.RemoteEndPoint).Address));

            if (regInfo.Password != null)
                // Authenticate with server using password.
                SendMessagePassword(regInfo.Password);

            // Check if client is registering as service or normal user.
            if (regInfo is IrcServiceRegistrationInfo)
            {
                // Register client as service.
                var serviceRegInfo = (IrcServiceRegistrationInfo)regInfo;
                SendMessageService(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);

                this.localUser = new IrcLocalUser(serviceRegInfo.NickName, serviceRegInfo.Distribution,
                    serviceRegInfo.Description);
            }
            else
            {
                // Register client as normal user.
                var userRegInfo = (IrcUserRegistrationInfo)regInfo;
                SendMessageNick(userRegInfo.NickName);
                SendMessageUser(userRegInfo.UserName, GetNumericUserMode(userRegInfo.UserModes),
                    userRegInfo.RealName);

                this.localUser = new IrcLocalUser(userRegInfo.NickName, userRegInfo.UserName, userRegInfo.RealName,
                    userRegInfo.UserModes);
            }
            this.localUser.Client = this;

            // Add local user to list of known users.
            lock (((ICollection)this.usersReadOnly).SyncRoot)
                this.users.Add(this.localUser);

            OnConnected(new EventArgs());
        }
Beispiel #3
0
 internal void GetLocalUserModes(IrcLocalUser user)
 {
     SendMessageUserMode(user.NickName);
 }
Beispiel #4
0
        private void ResetState()
        {
            // Reset network I/O objects.
            if (this.receiveStream != null)
                this.receiveStream.Dispose();
            if (this.dataStream != null)
                this.dataStream.Dispose();
            if (this.dataStreamReader != null)
                this.dataStreamReader = null;

            // Reset fully state of client.
            this.servers = new Collection<IrcServer>();
            this.isRegistered = false;
            this.localUser = null;
            this.serverSupportedFeatures = new Dictionary<string, string>();
            this.serverSupportedFeaturesReadOnly = new ReadOnlyDictionary<string, string>(this.serverSupportedFeatures);
            this.channelUserModes = new Collection<char>() {
                'o', 'v' };
            this.channelUserModesReadOnly = new ReadOnlyCollection<char>(this.channelUserModes);
            this.channelUserModesPrefixes = new Dictionary<char, char>() {
                { '@', 'o' }, { '+', 'v' } };
            this.motdBuilder = new StringBuilder();
            this.networkInformation = new IrcNetworkInfo();
            this.channels = new Collection<IrcChannel>();
            this.channelsReadOnly = new IrcChannelCollection(this, this.channels);
            this.users = new Collection<IrcUser>();
            this.usersReadOnly = new IrcUserCollection(this, this.users);
            this.listedChannels = new List<IrcChannelInfo>();
            this.listedServerLinks = new List<IrcServerInfo>();
            this.listedStatsEntries = new List<IrcServerStatisticalEntry>();
        }