diff options
| author | Adam <Adam@anope.org> | 2016-10-09 12:00:15 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-10-09 12:00:15 -0400 |
| commit | 5fd2d0ee3e136e01926f21edc759a4ab9fd48806 (patch) | |
| tree | 6666be3d14db12fe66a3576e889423f64e5229cc /modules/nickserv | |
| parent | cffbf4e8fd93ae28f1c6d6fde221e72d70015942 (diff) | |
Split vhosts into its own structure
Diffstat (limited to 'modules/nickserv')
| -rw-r--r-- | modules/nickserv/info.cpp | 9 | ||||
| -rw-r--r-- | modules/nickserv/main/nick.cpp | 62 | ||||
| -rw-r--r-- | modules/nickserv/main/nick.h | 17 | ||||
| -rw-r--r-- | modules/nickserv/main/nicktype.cpp | 5 | ||||
| -rw-r--r-- | modules/nickserv/main/nicktype.h | 7 |
5 files changed, 16 insertions, 84 deletions
diff --git a/modules/nickserv/info.cpp b/modules/nickserv/info.cpp index 593cfa116..e782edbaa 100644 --- a/modules/nickserv/info.cpp +++ b/modules/nickserv/info.cpp @@ -109,12 +109,13 @@ class CommandNSInfo : public Command if (show_hidden) { - if (na->HasVhost()) + HostServ::VHost *vhost = na->GetVHost(); + if (vhost != nullptr) { - if (IRCD->CanSetVIdent && !na->GetVhostIdent().empty()) - info[_("VHost")] = na->GetVhostIdent() + "@" + na->GetVhostHost(); + if (IRCD->CanSetVIdent && !vhost->GetIdent().empty()) + info[_("VHost")] = vhost->GetIdent() + "@" + vhost->GetHost(); else - info[_("VHost")] = na->GetVhostHost(); + info[_("VHost")] = vhost->GetHost(); } } diff --git a/modules/nickserv/main/nick.cpp b/modules/nickserv/main/nick.cpp index 3fc1e6b05..88f618855 100644 --- a/modules/nickserv/main/nick.cpp +++ b/modules/nickserv/main/nick.cpp @@ -136,64 +136,12 @@ void NickImpl::SetAccount(NickServ::Account *acc) Set(&NickType::nc, acc); } -void NickImpl::SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created) +HostServ::VHost *NickImpl::GetVHost() { - Set(&NickType::vhost_ident, ident); - Set(&NickType::vhost_host, host); - Set(&NickType::vhost_creator, creator); - Set(&NickType::vhost_created, created); + return Get(&NickType::vhost); } -void NickImpl::RemoveVhost() +void NickImpl::SetVHost(HostServ::VHost *vhost) { - Anope::string e; - Set(&NickType::vhost_ident, e); - Set(&NickType::vhost_host, e); - Set(&NickType::vhost_creator, e); - Set(&NickType::vhost_created, 0); -} - -bool NickImpl::HasVhost() -{ - return !GetVhostHost().empty(); -} - -Anope::string NickImpl::GetVhostIdent() -{ - return Get(&NickType::vhost_ident); -} - -void NickImpl::SetVhostIdent(const Anope::string &i) -{ - Set(&NickType::vhost_ident, i); -} - -Anope::string NickImpl::GetVhostHost() -{ - return Get(&NickType::vhost_host); -} - -void NickImpl::SetVhostHost(const Anope::string &h) -{ - Set(&NickType::vhost_host, h); -} - -Anope::string NickImpl::GetVhostCreator() -{ - return Get(&NickType::vhost_creator); -} - -void NickImpl::SetVhostCreator(const Anope::string &c) -{ - Set(&NickType::vhost_creator, c); -} - -time_t NickImpl::GetVhostCreated() -{ - return Get(&NickType::vhost_created); -} - -void NickImpl::SetVhostCreated(const time_t &cr) -{ - Set(&NickType::vhost_created, cr); -} + Set(&NickType::vhost, vhost); +}
\ No newline at end of file diff --git a/modules/nickserv/main/nick.h b/modules/nickserv/main/nick.h index ce0111b59..6c174739a 100644 --- a/modules/nickserv/main/nick.h +++ b/modules/nickserv/main/nick.h @@ -24,8 +24,7 @@ class NickImpl : public NickServ::Nick NickServ::Account *account = nullptr; Anope::string nick, last_quit, last_realname, last_usermask, last_realhost; time_t time_registered = 0, last_seen = 0; - Anope::string vhost_ident, vhost_host, vhost_creator; - time_t vhost_created = 0; + HostServ::VHost *vhost = nullptr; public: NickImpl(Serialize::TypeBase *type) : NickServ::Nick(type) { } @@ -57,16 +56,6 @@ class NickImpl : public NickServ::Nick NickServ::Account *GetAccount() override; void SetAccount(NickServ::Account *acc) override; - void SetVhost(const Anope::string &ident, const Anope::string &host, const Anope::string &creator, time_t created = Anope::CurTime) override; - void RemoveVhost() override; - bool HasVhost() override; - - Anope::string GetVhostIdent() override; - void SetVhostIdent(const Anope::string &) override; - Anope::string GetVhostHost() override; - void SetVhostHost(const Anope::string &) override; - Anope::string GetVhostCreator() override; - void SetVhostCreator(const Anope::string &) override; - time_t GetVhostCreated() override; - void SetVhostCreated(const time_t &) override; + HostServ::VHost *GetVHost() override; + void SetVHost(HostServ::VHost *) override; }; diff --git a/modules/nickserv/main/nicktype.cpp b/modules/nickserv/main/nicktype.cpp index 465cf2062..f27d27e18 100644 --- a/modules/nickserv/main/nicktype.cpp +++ b/modules/nickserv/main/nicktype.cpp @@ -28,11 +28,8 @@ 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) - , vhost_ident(this, "vhost_ident", &NickImpl::vhost_ident) - , vhost_host(this, "vhost_host", &NickImpl::vhost_host) - , vhost_creator(this, "vhost_creator", &NickImpl::vhost_creator) - , vhost_created(this, "vhost_created", &NickImpl::vhost_created) , nc(this, "nc", &NickImpl::account) + , vhost(this, "vhost", &NickImpl::vhost) { } diff --git a/modules/nickserv/main/nicktype.h b/modules/nickserv/main/nicktype.h index cd875953a..08e556b0a 100644 --- a/modules/nickserv/main/nicktype.h +++ b/modules/nickserv/main/nicktype.h @@ -37,14 +37,11 @@ class NickType : public Serialize::Type<NickImpl> Serialize::Field<NickImpl, time_t> time_registered; Serialize::Field<NickImpl, time_t> last_seen; - Serialize::Field<NickImpl, Anope::string> vhost_ident; - Serialize::Field<NickImpl, Anope::string> vhost_host; - Serialize::Field<NickImpl, Anope::string> vhost_creator; - Serialize::Field<NickImpl, time_t> vhost_created; - /* Account this nick is tied to. Multiple nicks can be tied to a single account. */ Serialize::ObjectField<NickImpl, NickServ::Account *> nc; + Serialize::ObjectField<NickImpl, HostServ::VHost *> vhost; + NickType(Module *); NickServ::Nick *FindNick(const Anope::string &nick); |
