Aselia.Core.Channel.SetModes C# (CSharp) Method

SetModes() public method

public SetModes ( UserBase user, string modes ) : void
user UserBase
modes string
return void
        public override void SetModes(UserBase user, string modes)
        {
            string[] tok = modes.Split(new char[] { ' ' }, 2);
            SetModes(user, tok[0], tok.Length > 1 ? tok[1] : string.Empty);
        }

Same methods

Channel::SetModes ( UserBase user, string flags, string arguments ) : void

Usage Example

Exemplo n.º 1
0
        public override ChannelBase CreateChannel(string name, UserBase user)
        {
            Channel channel = new Channel(this, name, name.ToLower());

            if (Cache.Channels.ContainsKey(channel.Id))
            {
                channel.Load(Cache.Channels[channel.Id]);
            }
            else
            {
                if (channel.IsSystem && user.Level < Authorizations.NetworkOperator)
                {
                    user.SendNumeric(Numerics.ERR_UNIQOPRIVSNEEDED, ":You need to be a network operator to register a system channel.");
                    return null;
                }

                if (channel.IsRegistered && user.Level < Authorizations.Registered)
                {
                    user.SendNumeric(Numerics.ERR_NOLOGIN, ":You need to be registered to own a channel.  To create a temporary channel, prefix the channel name with # instead of !.");
                    return null;
                }

                channel.AddPrefix(user, '~');

                switch (channel.Name[0])
                {
                case '!':
                    channel.SetModes(null, Settings.DefaultChannelModesReg);
                    break;

                case '#':
                    channel.SetModes(null, Settings.DefaultChannelModesTemp);
                    break;

                case '&':
                    channel.SetModes(null, Settings.DefaultChannelModesLoc);
                    break;
                }
            }

            if (channel != null)
            {
                Channels.Add(channel.Id, channel);
            }

            return channel;
        }