summaryrefslogtreecommitdiff
path: root/modules/chanserv
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-10-15 16:25:57 -0400
committerAdam <Adam@anope.org>2016-10-15 16:25:57 -0400
commit1ba242179fee46583098f48421af39ce9a8985a1 (patch)
treea276cd7bd53e7270c86ab3744bd6a568a016501b /modules/chanserv
parent696239e93391f3dfd6459857fb02a6006048093a (diff)
Various improvements/bugfixes to extdb stuff
Diffstat (limited to 'modules/chanserv')
-rw-r--r--modules/chanserv/main/channeltype.cpp8
-rw-r--r--modules/chanserv/main/channeltype.h2
-rw-r--r--modules/chanserv/main/chanserv.cpp16
3 files changed, 14 insertions, 12 deletions
diff --git a/modules/chanserv/main/channeltype.cpp b/modules/chanserv/main/channeltype.cpp
index fa5e03e4c..37c290ef1 100644
--- a/modules/chanserv/main/channeltype.cpp
+++ b/modules/chanserv/main/channeltype.cpp
@@ -37,12 +37,12 @@ ChannelType::ChannelType(Module *me) : Serialize::Type<ChannelImpl>(me)
}
-void ChannelType::Name::SetField(ChannelImpl *c, const Anope::string &value)
+void ChannelType::Name::OnSet(ChannelImpl *c, const Anope::string &value)
{
ChanServ::registered_channel_map& map = ChanServ::service->GetChannels();
- map.erase(GetField(c));
-
- Serialize::Field<ChannelImpl, Anope::string>::SetField(c, value);
+ Anope::string *old = this->Get_(c);
+ if (old != nullptr)
+ map.erase(*old);
map[value] = c;
}
diff --git a/modules/chanserv/main/channeltype.h b/modules/chanserv/main/channeltype.h
index 95158427a..1f1c92201 100644
--- a/modules/chanserv/main/channeltype.h
+++ b/modules/chanserv/main/channeltype.h
@@ -27,7 +27,7 @@ class ChannelType : public Serialize::Type<ChannelImpl>
{
using Serialize::Field<ChannelImpl, Anope::string>::Field;
- void SetField(ChannelImpl *c, const Anope::string &value) override;
+ void OnSet(ChannelImpl *c, const Anope::string &value) override;
} name;
Serialize::Field<ChannelImpl, Anope::string> desc;
Serialize::Field<ChannelImpl, time_t> time_registered;
diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp
index ec2e8a623..dc44173a0 100644
--- a/modules/chanserv/main/chanserv.cpp
+++ b/modules/chanserv/main/chanserv.cpp
@@ -322,7 +322,7 @@ class ChanServCore : public Module
{
::Log(LOG_NORMAL, "chanserv/drop", ChanServ) << "Deleting channel " << ci->GetName() << " owned by deleted nick " << nc->GetDisplay();
- delete ci;
+ ci->Delete();
continue;
}
}
@@ -330,6 +330,7 @@ class ChanServCore : public Module
if (ci->GetSuccessor() == nc)
ci->SetSuccessor(NULL);
+#warning "these arent necessary?"
/* are these necessary? */
for (unsigned j = 0; j < ci->GetAccessCount(); ++j)
{
@@ -338,7 +339,7 @@ class ChanServCore : public Module
if (anc && anc == nc)
{
- delete ca;
+ ca->Delete();
break;
}
}
@@ -348,7 +349,7 @@ class ChanServCore : public Module
AutoKick *ak = ci->GetAkick(j);
if (ak->GetAccount() == nc)
{
- delete ak;
+ ak->Delete();
break;
}
}
@@ -359,6 +360,7 @@ class ChanServCore : public Module
{
/* remove access entries that are this channel */
+#warning "also not necessary?"
for (ChanServ::Channel *c : ci->GetRefs<ChanServ::Channel *>())
{
for (unsigned j = 0; j < c->GetAccessCount(); ++j)
@@ -367,7 +369,7 @@ class ChanServCore : public Module
if (a->Mask().equals_ci(ci->GetName()))
{
- delete a;
+ a->Delete();
break;
}
}
@@ -465,7 +467,7 @@ class ChanServCore : public Module
if (!chanserv_expire || Anope::NoExpire || Anope::ReadOnly)
return;
- for (ChanServ::Channel *ci : channel_type.List<ChanServ::Channel *>())
+ for (ChanServ::Channel *ci : Serialize::GetObjects<ChanServ::Channel *>())
{
bool expire = false;
@@ -488,7 +490,7 @@ class ChanServCore : public Module
{
::Log(LOG_NORMAL, "chanserv/expire", ChanServ) << "Expiring channel " << ci->GetName() << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)") << ")";
EventManager::Get()->Dispatch(&ChanServ::Event::ChanExpire::OnChanExpire, ci);
- delete ci;
+ ci->Delete();
}
}
}
@@ -505,7 +507,7 @@ class ChanServCore : public Module
void OnPreUplinkSync(Server *serv) override
{
/* Find all persistent channels and create them, as we are about to finish burst to our uplink */
- for (ChanServ::Channel *ci : channel_type.List<ChanServ::Channel *>())
+ for (ChanServ::Channel *ci : Serialize::GetObjects<ChanServ::Channel *>())
{
if (ci->HasFieldS("PERSIST"))
{