diff options
Diffstat (limited to 'modules/nickserv')
| -rw-r--r-- | modules/nickserv/cert.cpp | 19 | ||||
| -rw-r--r-- | modules/nickserv/main/accounttype.cpp | 13 | ||||
| -rw-r--r-- | modules/nickserv/main/accounttype.h | 2 | ||||
| -rw-r--r-- | modules/nickserv/main/nickserv.cpp | 9 | ||||
| -rw-r--r-- | modules/nickserv/main/nicktype.cpp | 9 | ||||
| -rw-r--r-- | modules/nickserv/main/nicktype.h | 2 |
6 files changed, 25 insertions, 29 deletions
diff --git a/modules/nickserv/cert.cpp b/modules/nickserv/cert.cpp index ea0c41f51..94978fd88 100644 --- a/modules/nickserv/cert.cpp +++ b/modules/nickserv/cert.cpp @@ -31,6 +31,7 @@ class CertServiceImpl : public CertService NickServ::Account* FindAccountFromCert(const Anope::string &cert) override { +#warning "use serialize find" Anope::hash_map<NickServ::Account *>::iterator it = certmap.find(cert); if (it != certmap.end()) return it->second; @@ -78,15 +79,11 @@ class NSCertEntryType : public Serialize::Type<NSCertEntryImpl> { using Serialize::ObjectField<NSCertEntryImpl, NickServ::Account *>::ObjectField; - void SetField(NSCertEntryImpl *s, NickServ::Account *acc) override + void OnSet(NSCertEntryImpl *s, NickServ::Account *acc) override { const Anope::string &cert = s->GetCert(); - if (!cert.empty()) - certmap.erase(cert); - - Serialize::ObjectField<NSCertEntryImpl, NickServ::Account *>::SetField(s, acc); - if (!cert.empty() && s->GetAccount()) + if (!cert.empty()) certmap[cert] = acc; } } nc; @@ -95,13 +92,11 @@ class NSCertEntryType : public Serialize::Type<NSCertEntryImpl> { using Serialize::Field<NSCertEntryImpl, Anope::string>::Field; - void SetField(NSCertEntryImpl *s, const Anope::string &m) override + void OnSet(NSCertEntryImpl *s, const Anope::string &m) override { - const Anope::string &old = GetField(s); - if (!old.empty()) - certmap.erase(old); - - Serialize::Field<NSCertEntryImpl, Anope::string>::SetField(s, m); + Anope::string *old = this->Get_(s); + if (old != nullptr) + certmap.erase(*old); if (!m.empty() && s->GetAccount()) certmap[m] = s->GetAccount(); diff --git a/modules/nickserv/main/accounttype.cpp b/modules/nickserv/main/accounttype.cpp index 16abea415..6ea32cd83 100644 --- a/modules/nickserv/main/accounttype.cpp +++ b/modules/nickserv/main/accounttype.cpp @@ -29,18 +29,17 @@ AccountType::AccountType(Module *me) : Serialize::Type<AccountImpl>(me) } -void AccountType::Display::SetField(AccountImpl *acc, const Anope::string &disp) +void AccountType::Display::OnSet(AccountImpl *acc, const Anope::string &disp) { NickServ::nickcore_map& map = NickServ::service->GetAccountMap(); - if (!acc->GetDisplay().empty()) - map.erase(acc->GetDisplay()); + Anope::string *old = this->Get_(acc); + if (old != nullptr) + map.erase(*old); - Serialize::Field<AccountImpl, Anope::string>::SetField(acc, disp); - - if (!disp.empty()) - map[disp] = acc; + map[disp] = acc; +#warning "this is all wrong" acc->o = Oper::Find(disp); } diff --git a/modules/nickserv/main/accounttype.h b/modules/nickserv/main/accounttype.h index 4cdba74b0..27efd90dd 100644 --- a/modules/nickserv/main/accounttype.h +++ b/modules/nickserv/main/accounttype.h @@ -27,7 +27,7 @@ class AccountType : public Serialize::Type<AccountImpl> { using Serialize::Field<AccountImpl, Anope::string>::Field; - void SetField(AccountImpl *s, const Anope::string &) override; + void OnSet(AccountImpl *s, const Anope::string &) override; } display; /* User password in form of hashm:data */ Serialize::Field<AccountImpl, Anope::string> pass; diff --git a/modules/nickserv/main/nickserv.cpp b/modules/nickserv/main/nickserv.cpp index 2e766a9e2..461925927 100644 --- a/modules/nickserv/main/nickserv.cpp +++ b/modules/nickserv/main/nickserv.cpp @@ -219,7 +219,7 @@ class NickServCore : public Module, public NickServ::NickServService /* On shutdown, restart, or mod unload, remove all of our holds for nicks (svshold or qlines) * because some IRCds do not allow us to have these automatically expire */ - for (NickServ::Nick *na : nick_type.List<NickServ::Nick *>()) + for (NickServ::Nick *na : Serialize::GetObjects<NickServ::Nick *>()) this->Release(na); } @@ -362,7 +362,7 @@ class NickServCore : public Module, public NickServ::NickServService std::vector<NickServ::Nick *> GetNickList() override { - return nick_type.List<NickServ::Nick *>(); + return Serialize::GetObjects<NickServ::Nick *>(); } NickServ::nickalias_map& GetNickMap() override @@ -372,7 +372,7 @@ class NickServCore : public Module, public NickServ::NickServService std::vector<NickServ::Account *> GetAccountList() override { - return account_type.List<NickServ::Account *>(); + return Serialize::GetObjects<NickServ::Account *>(); } NickServ::nickcore_map& GetAccountMap() override @@ -532,6 +532,7 @@ class NickServCore : public Module, public NickServ::NickServService { if (u->HasMode("REGISTERED") && !u->IsIdentified(true)) u->RemoveMode(NickServ, "REGISTERED"); + if (!u->IsIdentified()) this->Validate(u); } @@ -640,7 +641,7 @@ class NickServCore : public Module, public NickServ::NickServService time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "21d"); - for (NickServ::Nick *na : nick_type.List<NickServ::Nick *>()) + for (NickServ::Nick *na : Serialize::GetObjects<NickServ::Nick *>()) { User *u = User::Find(na->GetNick(), true); if (u && (u->IsIdentified(true) || u->IsRecognized())) diff --git a/modules/nickserv/main/nicktype.cpp b/modules/nickserv/main/nicktype.cpp index 7b72f3e42..2cf1b2027 100644 --- a/modules/nickserv/main/nicktype.cpp +++ b/modules/nickserv/main/nicktype.cpp @@ -28,18 +28,19 @@ NickType::NickType(Module *me) : Serialize::Type<NickImpl>(me) , last_realhost(this, "last_realhost", &NickImpl::last_realhost) , time_registered(this, "time_registered", &NickImpl::time_registered) , last_seen(this, "last_seen", &NickImpl::last_seen) +#warning "this should depend?" , nc(this, "nc", &NickImpl::account) { } -void NickType::Nick::SetField(NickImpl *na, const Anope::string &value) +void NickType::Nick::OnSet(NickImpl *na, const Anope::string &value) { /* Remove us from the aliases list */ NickServ::nickalias_map &map = NickServ::service->GetNickMap(); - map.erase(GetField(na)); - - Serialize::Field<NickImpl, Anope::string>::SetField(na, value); + Anope::string *old = this->Get_(na); + if (old != nullptr) + map.erase(*old); map[value] = na; } diff --git a/modules/nickserv/main/nicktype.h b/modules/nickserv/main/nicktype.h index d94265132..0779b08da 100644 --- a/modules/nickserv/main/nicktype.h +++ b/modules/nickserv/main/nicktype.h @@ -26,7 +26,7 @@ class NickType : public Serialize::Type<NickImpl> { using Serialize::Field<NickImpl, Anope::string>::Field; - void SetField(NickImpl *s, const Anope::string &value) override; + void OnSet(NickImpl *s, const Anope::string &value) override; } nick; Serialize::Field<NickImpl, Anope::string> last_quit; Serialize::Field<NickImpl, Anope::string> last_realname; |
