From 4a1d38fc2f0dc6e228fe6bcace36f2bfde55620a Mon Sep 17 00:00:00 2001 From: Stephen Badger Date: Sun, 30 Jun 2013 00:46:12 +0100 Subject: [PATCH] Removes un-ncessary persistence from the chan save. This change removes un-necessary persistence from the channel save/load mechanism, just saying bans and mute instead. Along with this, auto_start has been removed, along with super node and max node concepts. --- code/controllers/managers/chanman.dm | 198 ++++++++++----------------- code/models/bot.dm | 8 -- code/models/channel.dm | 7 - data/saves/server.cfg | 55 +------- 4 files changed, 73 insertions(+), 195 deletions(-) diff --git a/code/controllers/managers/chanman.dm b/code/controllers/managers/chanman.dm index 6272b7c..046b4e2 100644 --- a/code/controllers/managers/chanman.dm +++ b/code/controllers/managers/chanman.dm @@ -41,43 +41,12 @@ ChannelManager SaveChan(Channel/Chan) var/savefile/S = new("./data/saves/channels/[ckey(Chan.name)].sav") - S["founder"] << Chan.founder - S["name"] << Chan.name - S["publicity"] << Chan.publicity - S["desc"] << Chan.desc - S["room_desc"] << Chan.room_desc - S["room_desc_size"] << Chan.room_desc_size - S["topic"] << Chan.topic - S["pass"] << Chan.pass - S["locked"] << Chan.locked - S["telpass"] << Chan.telnet_pass - S["telatmpts"] << Chan.telnet_attempts S["mute"] << Chan.mute S["banned"] << Chan.banned - if(Chan.operators && Chan.operators.len) - var/list/ops = new() - for(var/cKey in Chan.operators) - var/Op/O = Chan.operators[cKey] - ops += O.name - ops[O.name] = O.Rank.pos - S["operators"] << ops - - LoadChan(chan, telpass, telatmpts) + + LoadChan(chan) var/savefile/S = new("./data/saves/channels/[ckey(chan)].sav") var/Channel/Chan = new() - S["founder"] >> Chan.founder - S["name"] >> Chan.name - S["publicity"] >> Chan.publicity - S["desc"] >> Chan.desc - S["room_desc"] >> Chan.room_desc - S["room_desc_size"] >> Chan.room_desc_size - S["topic"] >> Chan.topic - S["pass"] >> Chan.pass - S["locked"] >> Chan.locked - Chan.telnet_pass = telnet_pass - Chan.telnet_attempts = telnet_attempts - if(!Chan.telnet_pass && telpass) Chan.telnet_pass = telpass - if(!Chan.telnet_attempts && telatmpts) Chan.telnet_attempts = telatmpts S["mute"] >> Chan.mute S["banned"] >> Chan.banned return Chan @@ -101,99 +70,72 @@ ChannelManager var/list/S = params2list(config["server"]) if(S && S.len) - telnet_pass = S["telnet_pass"] - telnet_attempts = (text2num(S["telnet_attempts"]) || -1) - - var/AutoStart = text2num(S["auto_start"]) ? 1 : 0 - if(AutoStart) - var/HomeChan = S["home_chan"] - if(!HomeChan) - return - else if(!fexists("./data/saves/channels/[ckey(HomeChan)].sav")) - var/Password = S["password"] - var/Founder = S["founder"] - var/ChanDesc = S["desc"] - var/ChanTopic = S["topic"] - var/SuperNode = text2num(S["super_name"]) ? 1 : 0 - var/MaxNodes = text2num(S["max_nodes"]) - var/Publicity = S["publicity"] - var/Locked = S["locked"] - - var/botName = S["bot_name"] - var/botNameColor = S["bot_name_color"] - var/botTextColor = S["bot_text_color"] - - var/botSpamControls= text2num(S["bot_spam_control"]) ? 1 : 0 - var/botSpamLimit = text2num(S["bot_spam_limit"]) - var/botFloodLimit = text2num(S["bot_flood_limit"]) - var/botSmileysLimit= text2num(S["bot_smileys_limit"]) - var/botMaxMsgs = text2num(S["bot_max_msgs"]) - var/botMinDelay = text2num(S["bot_min_delay"]) - - Home = new(list( - "Founder"=Founder, - "Name"=HomeChan, - "Publicity"=Publicity, - "Desc"=ChanDesc, - "Topic"=ChanTopic, - "Pass"=Password, - "Locked"=Locked, - "TelPass"=telnet_pass, - "TelAtmpts"=telnet_attempts, - "SuperNode"=SuperNode, - "MaxNodes"=MaxNodes)) - if(Publicity != "public") world.visibility = 0 - - Home.chanbot.SetName(botName) - Home.chanbot.SetNameColor("#"+botNameColor) - Home.chanbot.SetTextColor("#"+botTextColor) - Home.chanbot.SetSpamControl(botSpamControls) - Home.chanbot.SetSpamLimit(botSpamLimit) - Home.chanbot.SetFloodLimit(botFloodLimit) - Home.chanbot.SetSmileysLimit(botSmileysLimit) - Home.chanbot.SetMaxMsgs(botMaxMsgs) - Home.chanbot.SetMinDelay(botMinDelay) - - if(muteList && muteList.len) - Home.mute = new - for(var/i in muteList) + telnet_pass = S["telnet_pass"] + telnet_attempts = (text2num(S["telnet_attempts"]) || -1) + + var/ChanName = S["name"] + var/Founder = S["founder"] + var/ChanDesc = S["desc"] + var/ChanTopic = S["topic"] + var/Publicity = S["publicity"] + var/Locked = S["locked"] + + var/botName = S["bot_name"] + var/botNameColor = S["bot_name_color"] + var/botTextColor = S["bot_text_color"] + + var/botSpamControls= text2num(S["bot_spam_control"]) ? 1 : 0 + var/botSpamLimit = text2num(S["bot_spam_limit"]) + var/botFloodLimit = text2num(S["bot_flood_limit"]) + var/botSmileysLimit= text2num(S["bot_smileys_limit"]) + var/botMaxMsgs = text2num(S["bot_max_msgs"]) + var/botMinDelay = text2num(S["bot_min_delay"]) + + Home = new(list( + "Founder"=Founder, + "Name"=ChanName, + "Publicity"=Publicity, + "Desc"=ChanDesc, + "Topic"=ChanTopic, + "Locked"=Locked, + "TelPass"=telnet_pass, + "TelAtmpts"=telnet_attempts)) + if(Publicity != "public") world.visibility = 0 + + Home.chanbot.SetName(botName) + Home.chanbot.SetNameColor("#"+botNameColor) + Home.chanbot.SetTextColor("#"+botTextColor) + Home.chanbot.SetSpamControl(botSpamControls) + Home.chanbot.SetSpamLimit(botSpamLimit) + Home.chanbot.SetFloodLimit(botFloodLimit) + Home.chanbot.SetSmileysLimit(botSmileysLimit) + Home.chanbot.SetMaxMsgs(botMaxMsgs) + Home.chanbot.SetMinDelay(botMinDelay) + + if(muteList && muteList.len) + Home.mute = new + for(var/i in muteList) + Home.mute += ckey(i) + if(banList && banList.len) + Home.banned = new + for(var/i in banList) + Home.banned += ckey(i) + + if(opList && opList.len) + Home.operators = new + for(var/Name in opList) + if(!findtext(Name, "_")) + var/opKey = ckey(opList[Name]) + var/rankIndex = text2num(opList["[Name]_level"]) + var/OpRank/Rank = Home.op_ranks[rankIndex] + Home.operators[opKey] = new/Op(opList[Name], Rank) + if (fexists("./data/saves/channels/[ckey(Home.name)].sav")) + var/Channel/Chan = LoadChan(Home.name) + if (length(Chan.mute)) + for (var/i in Chan.mute) + if (!Home.mute.Find(ckey(i))) Home.mute += ckey(i) - - if(banList && banList.len) - Home.banned = new - for(var/i in banList) - Home.banned += ckey(i) - - if(opList && opList.len) - Home.operators = new - for(var/Name in opList) - if(!findtext(Name, "_")) - var/opKey = ckey(opList[Name]) - var/rankIndex = text2num(opList["[Name]_level"]) - var/OpRank/Rank = Home.op_ranks[rankIndex] - Home.operators[opKey] = new/Op(opList[Name], Rank) - else - Home = LoadChan(HomeChan, telnet_pass, telnet_attempts) - Home.chanbot = BotMan.LoadBot(Home) - Home.LoadOps() - if(muteList && muteList.len) - Home.mute = listOpen(Home.mute) - for(var/i in muteList) - var/cval = ckey(i) - if(!(cval in Home.mute)) Home.mute += cval - - if(banList && banList.len) - Home.banned = listOpen(Home.banned) - for(var/i in banList) - var/cval = ckey(i) - if(!(cval in Home.banned)) Home.banned += cval - - if(opList && opList.len) - Home.operators = listOpen(Home.operators) - for(var/Name in opList) - if(!findtext(Name, "_")) - var/opKey = ckey(opList[Name]) - var/rankIndex = text2num(opList["[Name]_level"]) - - var/OpRank/Rank = Home.op_ranks[rankIndex] - Home.operators[opKey] = new/Op(opList[Name], Rank) \ No newline at end of file + if (length(Chan.banned)) + for (var/i in Chan.banned) + if (!Home.banned.Find(ckey(i))) + Home.banned += ckey(i) \ No newline at end of file diff --git a/code/models/bot.dm b/code/models/bot.dm index b9e4e2e..f32588a 100644 --- a/code/models/bot.dm +++ b/code/models/bot.dm @@ -76,9 +76,6 @@ Bot if("topic") if(value) Home.chanbot.SetTopic(value,1) usr << output("@edit: Chan topic [Home.topic]", "console.output") - if("pass") - if(value) Home.chanbot.SetPass(value,1) - usr << output("@edit: Chan pass [Home.pass]", "console.output") if("locked") if(value) Home.chanbot.SetLocked(value,1) usr << output("@edit: Chan locked [(Home.locked ? Home.locked : "0")]", "console.output") @@ -413,11 +410,6 @@ _____________________ \[end of announcement\] _____________________ if(save) ChanMan.SaveChan(src.Chan) - SetPass(newValue,save) - Chan.pass = newValue - if(save) ChanMan.SaveChan(src.Chan) - - SetLocked(newValue,save) Chan.locked = newValue if(save) ChanMan.SaveChan(src.Chan) diff --git a/code/models/channel.dm b/code/models/channel.dm index 102621e..6598340 100644 --- a/code/models/channel.dm +++ b/code/models/channel.dm @@ -5,13 +5,10 @@ Channel publicity desc topic - pass locked telnet_pass telnet_attempts QOTD - SuperNode - MaxNodes // spam controls spam_control =1 @@ -63,15 +60,11 @@ Channel publicity = params["Publicity"] desc = params["Desc"] topic = params["Topic"] - pass = params["Pass"] locked = text2num(params["Locked"]) ? 1 : 0 telnet_pass = params["TelPass"] telnet_attempts = (text2num(params["TelAtmpts"]) || -1) - SuperNode = text2num(params["SuperNode"]) ? 1 : 0 - MaxNodes = text2num(params["MaxNodes"]) ..() chanbot = new /Bot(src) - if(SuperNode) nodes = new() proc LoadOps() diff --git a/data/saves/server.cfg b/data/saves/server.cfg index a61f895..2c5545b 100644 --- a/data/saves/server.cfg +++ b/data/saves/server.cfg @@ -53,37 +53,10 @@ # starting up. Use these variables if you plan to run your channel through # DreamDaemon, and don't wish to have to login to start your channel. [server] - ; If autostart is set to 1, the Channel Server - ; will attempt to load the channel named below. + ; The name for your server. This is the name which will be + ; displayed on the BYOND hub for your instance of Chatters. - auto_start = 1 - - - ; If you set auto_start to 1, you must also - ; set the name of the default channel to load. - ; If the channel does't exist, one will be - ; created with the name and settings provided - ; below. If the name is taken, you will be - ; supplied with an alternate by the Network - ; Server. If you do not provide a default - ; home_chan to load, no channel will be loaded, - ; even if auto_start is set to 1. - - - ; Uncomment the following line and set your - ; default channel's name if you plan to use - ; auto_start to load your Channel Server. - - home_chan = The Lounge - - - ; In order for your channel to be published on the - ; Network Server and the BYOND Hub, you must supply - ; a password. Channels that have a password set - ; also reserve their name, so no other public - ; channels may use it. Set you password below. - - password = myPass + name = The Lounge ; The channel founder is usually set to the host @@ -109,28 +82,6 @@ topic = Welcome to The Lounge! Please make yourself at home. - ; Super Nodes act as a gateway between the - ; Network Server and a small group of channels. - ; Super Nodes track a small subsection of the - ; network, and alieviate some of the burden - ; from the Network Server. Set the following - ; variable to 1 if you would like to run your - ; channel as a Super Node. - - super_node = 1 - - - ; If you choose to run as a Super Node, you - ; can set the maximum number of subordinate - ; nodes you will allow with the following. - ; the Network Server will attempt to evenly - ; distribute new nodes amongst the Super - ; Nodes available, but will not asign more - ; than your max_nodes variable. - - max_nodes = 5 - - ; Publicity determines if your channel appears ; on the Network and BYOND Hub listings, or if ; it is advertised to your friends, or not listed