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/hostserv/on.cpp | |
parent | cffbf4e8fd93ae28f1c6d6fde221e72d70015942 (diff) |
Split vhosts into its own structure
Diffstat (limited to 'modules/hostserv/on.cpp')
-rw-r--r-- | modules/hostserv/on.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/modules/hostserv/on.cpp b/modules/hostserv/on.cpp index 1332c7e7a..c911ec206 100644 --- a/modules/hostserv/on.cpp +++ b/modules/hostserv/on.cpp @@ -35,26 +35,30 @@ class CommandHSOn : public Command User *u = source.GetUser(); NickServ::Nick *na = NickServ::FindNick(u->nick); + HostServ::VHost *vhost = nullptr; - if (!na || na->GetAccount() != u->Account() || !na->HasVhost()) - na = NickServ::FindNick(u->Account()->GetDisplay()); + if (na && na->GetAccount() == source.GetAccount()) + vhost = na->GetVHost(); - if (!na || !na->HasVhost() || na->GetAccount() != u->Account()) + if (vhost == nullptr) + vhost = NickServ::FindNick(u->Account()->GetDisplay())->GetVHost(); + + if (vhost == nullptr) { source.Reply(_("There is no vhost assigned to this nickname.")); return; } - if (!na->GetVhostIdent().empty()) - source.Reply(_("Your vhost of \002{0}\002@\002{1}\002 is now activated."), na->GetVhostIdent(), na->GetVhostHost()); + if (!vhost->GetIdent().empty()) + source.Reply(_("Your vhost of \002{0}\002@\002{1}\002 is now activated."), vhost->GetIdent(), vhost->GetHost()); else - source.Reply(_("Your vhost of \002{0}\002 is now activated."), na->GetVhostHost()); + source.Reply(_("Your vhost of \002{0}\002 is now activated."), vhost->GetHost()); - Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost(); - IRCD->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost()); - u->vhost = na->GetVhostHost(); - if (IRCD->CanSetVIdent && !na->GetVhostIdent().empty()) - u->SetVIdent(na->GetVhostIdent()); + Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!vhost->GetIdent().empty() ? vhost->GetIdent() + "@" : "") << vhost->GetHost(); + IRCD->SendVhost(u, vhost->GetIdent(), vhost->GetHost()); + u->vhost = vhost->GetHost(); + if (IRCD->CanSetVIdent && !vhost->GetIdent().empty()) + u->SetVIdent(vhost->GetIdent()); u->UpdateHost(); } |