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;
}