From 76142b1970d6fd68d001e9972833046c79483a49 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 3 Dec 2017 14:40:01 -0500 Subject: serialize: set and cache new value before calling OnSet and pass old value to OnSet --- modules/chanserv/main/channeltype.cpp | 3 +-- modules/chanserv/main/channeltype.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'modules/chanserv') diff --git a/modules/chanserv/main/channeltype.cpp b/modules/chanserv/main/channeltype.cpp index e3de67357..4cbda871e 100644 --- a/modules/chanserv/main/channeltype.cpp +++ b/modules/chanserv/main/channeltype.cpp @@ -53,10 +53,9 @@ ChannelType::ChannelType(Module *me) : Serialize::Type(me) } -void ChannelType::Name::OnSet(ChannelImpl *c, const Anope::string &value) +void ChannelType::Name::OnSet(ChannelImpl *c, Anope::string *old, const Anope::string &value) { ChanServ::registered_channel_map& map = ChanServ::service->GetChannels(); - Anope::string *old = this->Get_(c); if (old != nullptr) map.erase(*old); diff --git a/modules/chanserv/main/channeltype.h b/modules/chanserv/main/channeltype.h index c8515b289..437eba133 100644 --- a/modules/chanserv/main/channeltype.h +++ b/modules/chanserv/main/channeltype.h @@ -27,7 +27,7 @@ class ChannelType : public Serialize::Type { using Serialize::Field::Field; - void OnSet(ChannelImpl *c, const Anope::string &value) override; + void OnSet(ChannelImpl *c, Anope::string *old, const Anope::string &value) override; } name; Serialize::Field desc; Serialize::Field time_registered; -- cgit