From e7dd7159b1e1ab5b3edabc44ece5338672f8fbb4 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 9 Oct 2016 19:51:39 -0400 Subject: Make vhosts assignable to accounts, not nicks. Allow multiple vhosts per account. --- modules/nickserv/info.cpp | 18 +++++++----------- modules/nickserv/main/nick.cpp | 9 --------- modules/nickserv/main/nick.h | 4 ---- modules/nickserv/main/nicktype.cpp | 1 - modules/nickserv/main/nicktype.h | 2 -- 5 files changed, 7 insertions(+), 27 deletions(-) (limited to 'modules/nickserv') diff --git a/modules/nickserv/info.cpp b/modules/nickserv/info.cpp index e782edbaa..447554afb 100644 --- a/modules/nickserv/info.cpp +++ b/modules/nickserv/info.cpp @@ -107,15 +107,11 @@ class CommandNSInfo : public Command if (!na->GetAccount()->GetEmail().empty() && (show_hidden || !na->GetAccount()->HasFieldS("HIDE_EMAIL"))) info[_("Email address")] = na->GetAccount()->GetEmail(); - if (show_hidden) + if (source.HasPriv("hostserv/auspex")) { - HostServ::VHost *vhost = na->GetVHost(); - if (vhost != nullptr) + for (HostServ::VHost *vhost : na->GetAccount()->GetRefs()) { - if (IRCD->CanSetVIdent && !vhost->GetIdent().empty()) - info[_("VHost")] = vhost->GetIdent() + "@" + vhost->GetHost(); - else - info[_("VHost")] = vhost->GetHost(); + info[_("VHost")] = vhost->Mask() + (vhost->IsDefault() ? " (default)" : ""); } } @@ -132,10 +128,10 @@ class CommandNSInfo : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Displays information about the given nickname, such as\n" - "the nick's owner, last seen address and time, and nick\n" - "options. If no nick is given, and you are identified,\n" - "your account name is used, else your current nickname is\n" + source.Reply(_("Displays information about the given nickname, such as " + "the nick's owner, last seen address and time, and nick " + "options. If no nick is given, and you are identified, " + "your account name is used, else your current nickname is " "used.")); return true; diff --git a/modules/nickserv/main/nick.cpp b/modules/nickserv/main/nick.cpp index 88f618855..0f94e63af 100644 --- a/modules/nickserv/main/nick.cpp +++ b/modules/nickserv/main/nick.cpp @@ -136,12 +136,3 @@ void NickImpl::SetAccount(NickServ::Account *acc) Set(&NickType::nc, acc); } -HostServ::VHost *NickImpl::GetVHost() -{ - return Get(&NickType::vhost); -} - -void NickImpl::SetVHost(HostServ::VHost *vhost) -{ - 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 6c174739a..69f47efe8 100644 --- a/modules/nickserv/main/nick.h +++ b/modules/nickserv/main/nick.h @@ -24,7 +24,6 @@ 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; - HostServ::VHost *vhost = nullptr; public: NickImpl(Serialize::TypeBase *type) : NickServ::Nick(type) { } @@ -55,7 +54,4 @@ class NickImpl : public NickServ::Nick NickServ::Account *GetAccount() override; void SetAccount(NickServ::Account *acc) 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 f27d27e18..7b72f3e42 100644 --- a/modules/nickserv/main/nicktype.cpp +++ b/modules/nickserv/main/nicktype.cpp @@ -29,7 +29,6 @@ NickType::NickType(Module *me) : Serialize::Type(me) , time_registered(this, "time_registered", &NickImpl::time_registered) , last_seen(this, "last_seen", &NickImpl::last_seen) , 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 08e556b0a..d94265132 100644 --- a/modules/nickserv/main/nicktype.h +++ b/modules/nickserv/main/nicktype.h @@ -40,8 +40,6 @@ class NickType : public Serialize::Type /* Account this nick is tied to. Multiple nicks can be tied to a single account. */ Serialize::ObjectField nc; - Serialize::ObjectField vhost; - NickType(Module *); NickServ::Nick *FindNick(const Anope::string &nick); -- cgit