diff options
| author | Adam <Adam@anope.org> | 2016-11-11 12:58:14 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-11-11 12:58:14 -0500 |
| commit | ef5b6919e3508cc9d4c722285d9d56f5a275f650 (patch) | |
| tree | 56497f0a4f5d1847bae511c72bdb2d3581df58ef /modules/nickserv/main | |
| parent | 8dd6e3195ed7600e39935e887df2626215733dfb (diff) | |
Fix opers not really being serializable
Diffstat (limited to 'modules/nickserv/main')
| -rw-r--r-- | modules/nickserv/main/account.cpp | 15 | ||||
| -rw-r--r-- | modules/nickserv/main/account.h | 14 | ||||
| -rw-r--r-- | modules/nickserv/main/accounttype.cpp | 4 | ||||
| -rw-r--r-- | modules/nickserv/main/accounttype.h | 2 |
4 files changed, 17 insertions, 18 deletions
diff --git a/modules/nickserv/main/account.cpp b/modules/nickserv/main/account.cpp index 1c2266e59..1cd868194 100644 --- a/modules/nickserv/main/account.cpp +++ b/modules/nickserv/main/account.cpp @@ -77,6 +77,16 @@ void AccountImpl::SetLanguage(const Anope::string &lang) Set(&AccountType::language, lang); } +Oper *AccountImpl::GetOper() +{ + return Get(&AccountType::oper); +} + +void AccountImpl::SetOper(Oper *oper) +{ + Set(&AccountType::oper, oper); +} + MemoServ::MemoInfo *AccountImpl::GetMemos() { return GetRef<MemoServ::MemoInfo *>(); @@ -103,11 +113,6 @@ void AccountImpl::SetDisplay(NickServ::Nick *na) nc = this; } -bool AccountImpl::IsServicesOper() const -{ - return this->o != NULL; -} - bool AccountImpl::IsOnAccess(User *u) { Anope::string buf = u->GetIdent() + "@" + u->host, buf2, buf3; diff --git a/modules/nickserv/main/account.h b/modules/nickserv/main/account.h index 461a3d865..611233261 100644 --- a/modules/nickserv/main/account.h +++ b/modules/nickserv/main/account.h @@ -24,10 +24,10 @@ class AccountImpl : public NickServ::Account friend class AccountType; Anope::string display, password, email, language; + Oper *oper = nullptr; public: - AccountImpl(Serialize::TypeBase *type) : NickServ::Account(type) { } - AccountImpl(Serialize::TypeBase *type, Serialize::ID id) : NickServ::Account(type, id) { } + using NickServ::Account::Account; ~AccountImpl(); void Delete() override; @@ -43,16 +43,12 @@ class AccountImpl : public NickServ::Account Anope::string GetLanguage() override; void SetLanguage(const Anope::string &) override; + Oper *GetOper() override; + void SetOper(Oper *) override; + MemoServ::MemoInfo *GetMemos() override; void SetDisplay(NickServ::Nick *na) override; - bool IsServicesOper() const override; - /*void AddAccess(const Anope::string &entry) override; - Anope::string GetAccess(unsigned entry) const override; - unsigned GetAccessCount() const override; - bool FindAccess(const Anope::string &entry) override; - void EraseAccess(const Anope::string &entry) override; - void ClearAccess() override;*/ bool IsOnAccess(User *u) override; unsigned int GetChannelCount() override; }; diff --git a/modules/nickserv/main/accounttype.cpp b/modules/nickserv/main/accounttype.cpp index 6ea32cd83..ec37c18d4 100644 --- a/modules/nickserv/main/accounttype.cpp +++ b/modules/nickserv/main/accounttype.cpp @@ -25,6 +25,7 @@ AccountType::AccountType(Module *me) : Serialize::Type<AccountImpl>(me) , pass(this, "pass", &AccountImpl::password) , email(this, "email", &AccountImpl::email) , language(this, "language", &AccountImpl::language) + , oper(this, "oper", &AccountImpl::oper) { } @@ -38,9 +39,6 @@ void AccountType::Display::OnSet(AccountImpl *acc, const Anope::string &disp) map.erase(*old); map[disp] = acc; - -#warning "this is all wrong" - acc->o = Oper::Find(disp); } NickServ::Account *AccountType::FindAccount(const Anope::string &acc) diff --git a/modules/nickserv/main/accounttype.h b/modules/nickserv/main/accounttype.h index 27efd90dd..8e831ed2c 100644 --- a/modules/nickserv/main/accounttype.h +++ b/modules/nickserv/main/accounttype.h @@ -34,7 +34,7 @@ class AccountType : public Serialize::Type<AccountImpl> Serialize::Field<AccountImpl, Anope::string> email; /* Locale name of the language of the user. Empty means default language */ Serialize::Field<AccountImpl, Anope::string> language; - + Serialize::ObjectField<AccountImpl, Oper *> oper; AccountType(Module *); |
