コード例 #1
0
        public void JoinChannel()
        {
            //channel.JoinChannel(_session);
            if (_channel.Property.ChannelMode.IsInviteOnly)
            {
                //invited only
                _errorCode = ChatError.IRCError;
                return;
            }

            if (_channel.IsUserBanned(_user))
            {
                _errorCode = ChatError.IRCError;
                return;
            }

            //if all pass, it mean  we excute join channel
            _user.SetDefaultProperties();


            //simple check for avoiding program crash
            if (!_channel.IsUserExisted(_user))
            {
                _channel.AddBindOnUserAndChannel(_user);
            }

            //first we send join information to all user in this channel
            _channel.MultiCastJoin(_user);

            //then we send user list which already in this channel ???????????
            _channel.SendChannelUsersToJoiner(_user);

            //send channel mode to joiner
            _channel.SendChannelModesToJoiner(_user);
        }
コード例 #2
0
        public void CreateChannel()
        {
            _channel = new ChatChannelBase();

            if (IsPeerServer(_cmd.ChannelName))
            {
                _channel.Property.SetPeerServerFlag(true);
            }

            _user.SetDefaultProperties(true);

            _channel.Property.SetDefaultProperties(_user, _cmd);

            //simple check for avoiding program crash
            if (!_channel.IsUserExisted(_user))
            {
                _channel.AddBindOnUserAndChannel(_user);
            }

            //first we send join information to all user in this channel
            _channel.MultiCastJoin(_user);

            //then we send user list which already in this channel ???????????
            _channel.SendChannelUsersToJoiner(_user);

            //send channel mode to joiner
            _channel.SendChannelModesToJoiner(_user);

            ChatChannelManager.AddChannel(_cmd.ChannelName, _channel);
        }