summaryrefslogtreecommitdiff
path: root/modules/commands/cs_register.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-11-24 14:27:23 -0500
committerAdam <Adam@anope.org>2014-11-24 14:27:23 -0500
commit42238034490fb5479d787bd1695750387d508200 (patch)
treec93c62e0e1c936e656ae5b9ee1b62380ce2a194c /modules/commands/cs_register.cpp
parentd492923610d9c9146b2a2b63de38deab2cfd4ca7 (diff)
Rewrite serializable to have field level granularity
Represent serializable objects in a digraph, and as a result made most object relationships implicitly defined, and use the graph to trace references between objects to determine relationships. Edges may also be marked as having a dependency of the object they point to, which allows for automatic cleanup and deletion of most objects when no longer needed. Additionally, this allows not having to require in-memory copies of everything when using external databases. db_sql has been rewritten for this and now always requires a database to function. db_sql with MySQL now requires InnoDB to make use of transactions and foreign key constraints.
Diffstat (limited to 'modules/commands/cs_register.cpp')
-rw-r--r--modules/commands/cs_register.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp
index 36803e608..33b271ce5 100644
--- a/modules/commands/cs_register.cpp
+++ b/modules/commands/cs_register.cpp
@@ -34,7 +34,7 @@ class CommandCSRegister : public Command
return;
}
- if (nc->HasExt("UNCONFIRMED"))
+ if (nc->HasFieldS("UNCONFIRMED"))
{
source.Reply(_("You must confirm your account before you can register a channel."));
return;
@@ -79,9 +79,9 @@ class CommandCSRegister : public Command
}
unsigned maxregistered = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
- if (maxregistered && nc->channelcount >= maxregistered && !source.HasPriv("chanserv/no-register-limit"))
+ if (maxregistered && nc->GetChannelCount() >= maxregistered && !source.HasPriv("chanserv/no-register-limit"))
{
- if (nc->channelcount > maxregistered)
+ if (nc->GetChannelCount() > maxregistered)
source.Reply(_("Sorry, you have already exceeded your limit of \002{0}\002 channels."), maxregistered);
else
source.Reply(_("Sorry, you have already reached your limit of \002{0}\002 channels."), maxregistered);
@@ -90,21 +90,22 @@ class CommandCSRegister : public Command
if (!ChanServ::service)
return;
- ci = ChanServ::service->Create(chan);
+ ci = ChanServ::channel.Create();
+ ci->SetName(chan);
ci->SetFounder(nc);
- ci->desc = chdesc;
+ ci->SetDesc(chdesc);
if (c && !c->topic.empty())
{
- ci->last_topic = c->topic;
- ci->last_topic_setter = c->topic_setter;
- ci->last_topic_time = c->topic_time;
+ ci->SetLastTopic(c->topic);
+ ci->SetLastTopicSetter(c->topic_setter);
+ ci->SetLastTopicTime(c->topic_time);
}
else
- ci->last_topic_setter = source.service->nick;
+ ci->SetLastTopicSetter(source.service->nick);
Log(LOG_COMMAND, source, this, ci);
- source.Reply(_("Channel \002{0}\002 registered under your account: \002{1}\002"), chan, nc->display);
+ source.Reply(_("Channel \002{0}\002 registered under your account: \002{1}\002"), chan, nc->GetDisplay());
/* Implement new mode lock */
if (c)
@@ -129,7 +130,7 @@ class CommandCSRegister : public Command
" The channel founder is allowed to change all of the channel settings for the channel,"
" and will automatically be given channel operator status when entering the channel."));
- BotInfo *bi;
+ ServiceBot *bi;
Anope::string cmd;
CommandInfo *help = source.service->FindCommand("generic/help");
if (Command::FindCommandFromService("chanserv/access", bi, cmd) && help)