diff options
| author | Adam <Adam@anope.org> | 2014-06-25 11:02:19 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2014-06-25 11:02:19 -0400 |
| commit | ee3289029d61da12013e0f5a3e4faf2d07543a0e (patch) | |
| tree | df7391c321a913fc56db2d075292c0a6ddb0536d /modules/commands/hs_on.cpp | |
| parent | fd9bb0ea7e3c8a39f1632c2ebbdc25d0fac192a0 (diff) | |
Remove the rest of the 1.8 logic "let's write all of the command handler with no return statement!"
Fix if (something) else if (!something) tests
Remove returns at the bottom of void functions
Diffstat (limited to 'modules/commands/hs_on.cpp')
| -rw-r--r-- | modules/commands/hs_on.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp index c9e686131..8ec26f565 100644 --- a/modules/commands/hs_on.cpp +++ b/modules/commands/hs_on.cpp @@ -27,21 +27,24 @@ class CommandHSOn : public Command User *u = source.GetUser(); const NickServ::Nick *na = NickServ::FindNick(u->nick); - if (na && u->Account() == na->nc && na->HasVhost()) + + if (!na || !na->HasVhost() || na->nc != u->Account()) { - if (!na->GetVhostIdent().empty()) - source.Reply(_("Your vhost of \002{0}\002@\002{1}\002 is now activated."), na->GetVhostIdent(), na->GetVhostHost()); - else - source.Reply(_("Your vhost of \002{0}\002 is now activated."), na->GetVhostHost()); - 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()); - u->UpdateHost(); + 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()); else - source.Reply(_("There is no vhost assigned to this nickname.")); + source.Reply(_("Your vhost of \002{0}\002 is now activated."), na->GetVhostHost()); + + 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()); + u->UpdateHost(); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override |
