aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-09-11 09:18:43 +0100
committerGravatar Sadie Powell2023-09-13 07:56:59 +0100
commite60736583e6b2b99a7024fb9e4930fa586dabd9a (patch)
treec181a20eb2e063de9d1762510cfc95dbc3e14560 /src/modules
parentAllow using SSLINFO with no params to view your own cert details. (diff)
Make the permchannels database easier to read.
Adding the extra keys for list modes made the database a lot harder to read because of the extra line length. To work around this put each key on its own line and indent them to the same level.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_permchannels.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 9dc1c829f..62c89ecce 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -89,6 +89,7 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes, unsign
<< "# Any changes to this file will be automatically overwritten." << std::endl
<< std::endl;
+ const static std::string indent(14, ' ');
for (const auto& [_, chan] : ServerInstance->Channels.GetChans())
{
if (!chan->IsModeSet(permchanmode))
@@ -136,15 +137,15 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes, unsign
}
}
- stream << "<permchannels channel=\"" << ServerConfig::Escape(chan->name)
- << "\" ts=\"" << chan->age;
+ stream << "<permchannels channel=\"" << ServerConfig::Escape(chan->name) << "\"" << std::endl
+ << indent << "ts=\"" << chan->age << "\"" << std::endl;
if (!chan->topic.empty())
{
// Only store the topic if one is set.
- stream << "\" topic=\"" << ServerConfig::Escape(chan->topic)
- << "\" topicts=\"" << chan->topicset
- << "\" topicsetby=\"" << ServerConfig::Escape(chan->setby);
+ stream << indent << "topic=\"" << ServerConfig::Escape(chan->topic) << "\"" << std::endl
+ << indent << "topicts=\"" << chan->topicset << "\"" << std::endl
+ << indent << "topicsetby=\"" << ServerConfig::Escape(chan->setby) << "\"" << std::endl;
}
if (save_listmodes && writeversion >= 2)
@@ -155,18 +156,18 @@ static bool WriteDatabase(PermChannel& permchanmode, bool save_listmodes, unsign
if (!list || list->empty())
continue;
- stream << "\" " << lm->name << "list=\"";
+ stream << indent << lm->name << "list=\"";
for (auto entry = list->begin(); entry != list->end(); ++entry)
{
if (entry != list->begin())
stream << ' ';
stream << entry->mask << ' ' << entry->setter << ' ' << entry->time;
}
+ stream << "\"" << std::endl;
}
}
- stream << "\" modes=\"" << ServerConfig::Escape(chanmodes)
- << "\">" << std::endl;
+ stream << indent << "modes=\"" << ServerConfig::Escape(chanmodes) << "\">" << std::endl;
}
if (stream.fail())