diff options
author | Sadie Powell <sadie@witchery.services> | 2024-03-04 10:36:10 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-03-04 10:36:10 +0000 |
commit | db4f845fe78f82bca4bdb9e44cc785a5a3947d37 (patch) | |
tree | 63f1b943fe2baa3f1fbfbabaa63bf805803b3e8c | |
parent | d15ac93a8f5fb5c939807807be52108f7d49f8ed (diff) |
Add NickAlias::GetVhostMask for getting the vident@vhost.
-rw-r--r-- | include/account.h | 5 | ||||
-rw-r--r-- | language/anope.en_US.po | 20 | ||||
-rw-r--r-- | modules/hostserv/hostserv.cpp | 12 | ||||
-rw-r--r-- | modules/hostserv/hs_group.cpp | 6 | ||||
-rw-r--r-- | modules/hostserv/hs_list.cpp | 10 | ||||
-rw-r--r-- | modules/hostserv/hs_on.cpp | 7 | ||||
-rw-r--r-- | modules/hostserv/hs_set.cpp | 10 | ||||
-rw-r--r-- | modules/nickserv/ns_info.cpp | 7 | ||||
-rw-r--r-- | modules/webcpanel/pages/hostserv/request.cpp | 7 | ||||
-rw-r--r-- | modules/webcpanel/pages/nickserv/info.cpp | 7 | ||||
-rw-r--r-- | src/nickalias.cpp | 8 |
11 files changed, 30 insertions, 69 deletions
diff --git a/include/account.h b/include/account.h index acc5a1624..55ed44669 100644 --- a/include/account.h +++ b/include/account.h @@ -85,6 +85,11 @@ public: */ const Anope::string &GetVhostHost() const; + /** Retrieve the vhost mask + * @param the mask + */ + Anope::string GetVhostMask() const; + /** Retrieve the vhost creator * @return the creator */ diff --git a/language/anope.en_US.po b/language/anope.en_US.po index 4c7e5601f..eb63da3e5 100644 --- a/language/anope.en_US.po +++ b/language/anope.en_US.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-29 21:53+0000\n" -"PO-Revision-Date: 2024-02-29 21:53+0000\n" +"POT-Creation-Date: 2024-03-04 10:34+0000\n" +"PO-Revision-Date: 2024-03-04 10:34+0000\n" "Last-Translator: Sadie Powell <sadie@witchery.services>\n" "Language-Team: English\n" "Language: en_US\n" @@ -1939,10 +1939,6 @@ msgstr "All user modes on %s have been synced." msgid "All vhosts in the group %s have been set to %s." msgstr "All vhosts in the group %s have been set to %s." -#, c-format -msgid "All vhosts in the group %s have been set to %s@%s." -msgstr "All vhosts in the group %s have been set to %s@%s." - msgid "Allowed to (de)halfop themself" msgstr "Allowed to (de)halfop themself" @@ -8077,17 +8073,9 @@ msgid "VHost for %s set to %s." msgstr "VHost for %s set to %s." #, c-format -msgid "VHost for %s set to %s@%s." -msgstr "VHost for %s set to %s@%s." - -#, c-format msgid "VHost for group %s set to %s." msgstr "VHost for group %s set to %s." -#, c-format -msgid "VHost for group %s set to %s@%s." -msgstr "VHost for group %s set to %s@%s." - msgid "VIEW host" msgstr "VIEW host" @@ -8609,10 +8597,6 @@ msgstr "Your vHost has been requested." msgid "Your vhost of %s is now activated." msgstr "Your vhost of %s is now activated." -#, c-format -msgid "Your vhost of %s@%s is now activated." -msgstr "Your vhost of %s@%s is now activated." - msgid "Your vhost was removed and the normal cloaking restored." msgstr "Your vhost was removed and the normal cloaking restored." diff --git a/modules/hostserv/hostserv.cpp b/modules/hostserv/hostserv.cpp index 17c820377..bdd1920e1 100644 --- a/modules/hostserv/hostserv.cpp +++ b/modules/hostserv/hostserv.cpp @@ -59,10 +59,8 @@ public: if (HostServ) { - if (!na->GetVhostIdent().empty()) - u->SendMessage(HostServ, _("Your vhost of \002%s\002@\002%s\002 is now activated."), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str()); - else - u->SendMessage(HostServ, _("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str()); + u->SendMessage(HostServ, _("Your vhost of \002%s\002 is now activated."), + na->GetVhostMask().c_str()); } } } @@ -107,10 +105,8 @@ public: if (HostServ) { - if (!na->GetVhostIdent().empty()) - u->SendMessage(HostServ, _("Your vhost of \002%s\002@\002%s\002 is now activated."), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str()); - else - u->SendMessage(HostServ, _("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str()); + u->SendMessage(HostServ, _("Your vhost of \002%s\002 is now activated."), + na->GetVhostMask().c_str()); } } } diff --git a/modules/hostserv/hs_group.cpp b/modules/hostserv/hs_group.cpp index 9db0bbb00..2877fa16d 100644 --- a/modules/hostserv/hs_group.cpp +++ b/modules/hostserv/hs_group.cpp @@ -54,10 +54,8 @@ public: if (na && source.GetAccount() == na->nc && na->HasVhost()) { this->Sync(na); - if (!na->GetVhostIdent().empty()) - source.Reply(_("All vhosts in the group \002%s\002 have been set to \002%s\002@\002%s\002."), source.nc->display.c_str(), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str()); - else - source.Reply(_("All vhosts in the group \002%s\002 have been set to \002%s\002."), source.nc->display.c_str(), na->GetVhostHost().c_str()); + source.Reply(_("All vhosts in the group \002%s\002 have been set to \002%s\002."), + source.nc->display.c_str(), na->GetVhostMask().c_str()); } else source.Reply(HOST_NOT_ASSIGNED); diff --git a/modules/hostserv/hs_list.cpp b/modules/hostserv/hs_list.cpp index 8cda26c38..7b85bead3 100644 --- a/modules/hostserv/hs_list.cpp +++ b/modules/hostserv/hs_list.cpp @@ -72,10 +72,7 @@ public: ListFormatter::ListEntry entry; entry["Number"] = stringify(display_counter); entry["Nick"] = na->nick; - if (!na->GetVhostIdent().empty()) - entry["Vhost"] = na->GetVhostIdent() + "@" + na->GetVhostHost(); - else - entry["Vhost"] = na->GetVhostHost(); + entry["Vhost"] = na->GetVhostMask(); entry["Creator"] = na->GetVhostCreator(); entry["Created"] = Anope::strftime(na->GetVhostCreated(), NULL, true); list.AddEntry(entry); @@ -93,10 +90,7 @@ public: ListFormatter::ListEntry entry; entry["Number"] = stringify(display_counter); entry["Nick"] = na->nick; - if (!na->GetVhostIdent().empty()) - entry["Vhost"] = na->GetVhostIdent() + "@" + na->GetVhostHost(); - else - entry["Vhost"] = na->GetVhostHost(); + entry["Vhost"] = na->GetVhostMask(); entry["Creator"] = na->GetVhostCreator(); entry["Created"] = Anope::strftime(na->GetVhostCreated(), NULL, true); list.AddEntry(entry); diff --git a/modules/hostserv/hs_on.cpp b/modules/hostserv/hs_on.cpp index c8c01b7b2..e37b1278e 100644 --- a/modules/hostserv/hs_on.cpp +++ b/modules/hostserv/hs_on.cpp @@ -32,11 +32,8 @@ public: na = NickAlias::Find(u->Account()->display); if (na && u->Account() == na->nc && na->HasVhost()) { - if (!na->GetVhostIdent().empty()) - source.Reply(_("Your vhost of \002%s\002@\002%s\002 is now activated."), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str()); - else - source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str()); - Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost(); + source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVhostMask().c_str()); + Log(LOG_COMMAND, source, this) << "to enable their vhost of " << na->GetVhostMask(); IRCD->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost()); u->vhost = na->GetVhostHost(); if (IRCD->CanSetVIdent && !na->GetVhostIdent().empty()) diff --git a/modules/hostserv/hs_set.cpp b/modules/hostserv/hs_set.cpp index 665e24467..261e1e51f 100644 --- a/modules/hostserv/hs_set.cpp +++ b/modules/hostserv/hs_set.cpp @@ -87,10 +87,7 @@ public: na->SetVhost(user, host, source.GetNick()); FOREACH_MOD(OnSetVhost, (na)); - if (!user.empty()) - source.Reply(_("VHost for \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str()); - else - source.Reply(_("VHost for \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str()); + source.Reply(_("VHost for \002%s\002 set to \002%s\002."), nick.c_str(), na->GetVhostMask().c_str()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -194,10 +191,7 @@ public: na->SetVhost(user, host, source.GetNick()); this->Sync(na); FOREACH_MOD(OnSetVhost, (na)); - if (!user.empty()) - source.Reply(_("VHost for group \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str()); - else - source.Reply(_("VHost for group \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str()); + source.Reply(_("VHost for group \002%s\002 set to \002%s\002."), nick.c_str(), na->GetVhostMask().c_str()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/nickserv/ns_info.cpp b/modules/nickserv/ns_info.cpp index 33efbc24f..09769345c 100644 --- a/modules/nickserv/ns_info.cpp +++ b/modules/nickserv/ns_info.cpp @@ -102,12 +102,7 @@ public: if (show_hidden) { if (na->HasVhost()) - { - if (IRCD->CanSetVIdent && !na->GetVhostIdent().empty()) - info[_("VHost")] = na->GetVhostIdent() + "@" + na->GetVhostHost(); - else - info[_("VHost")] = na->GetVhostHost(); - } + info[_("VHost")] = na->GetVhostMask(); } FOREACH_MOD(OnNickInfo, (source, na, info, show_hidden)); diff --git a/modules/webcpanel/pages/hostserv/request.cpp b/modules/webcpanel/pages/hostserv/request.cpp index 373686600..0a8513c76 100644 --- a/modules/webcpanel/pages/hostserv/request.cpp +++ b/modules/webcpanel/pages/hostserv/request.cpp @@ -22,12 +22,7 @@ bool WebCPanel::HostServ::Request::OnRequest(HTTPProvider *server, const Anope:: } if (na->HasVhost()) - { - if (!na->GetVhostIdent().empty()) - replacements["VHOST"] = na->GetVhostIdent() + "@" + na->GetVhostHost(); - else - replacements["VHOST"] = na->GetVhostHost(); - } + replacements["VHOST"] = na->GetVhostMask(); if (ServiceReference<Command>("Command", "hostserv/request")) replacements["CAN_REQUEST"] = "YES"; TemplateFileServer page("hostserv/request.html"); diff --git a/modules/webcpanel/pages/nickserv/info.cpp b/modules/webcpanel/pages/nickserv/info.cpp index 54b9c75c5..6a47e541c 100644 --- a/modules/webcpanel/pages/nickserv/info.cpp +++ b/modules/webcpanel/pages/nickserv/info.cpp @@ -81,12 +81,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str replacements["EMAIL"] = na->nc->email; replacements["TIME_REGISTERED"] = Anope::strftime(na->time_registered, na->nc); if (na->HasVhost()) - { - if (!na->GetVhostIdent().empty()) - replacements["VHOST"] = na->GetVhostIdent() + "@" + na->GetVhostHost(); - else - replacements["VHOST"] = na->GetVhostHost(); - } + replacements["VHOST"] = na->GetVhostMask(); Anope::string *greet = na->nc->GetExt<Anope::string>("greet"); if (greet) replacements["GREET"] = *greet; diff --git a/src/nickalias.cpp b/src/nickalias.cpp index 0b60a13f4..15d700ea0 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -109,6 +109,14 @@ const Anope::string &NickAlias::GetVhostHost() const return this->vhost_host; } +Anope::string NickAlias::GetVhostMask() const +{ + if (this->GetVhostIdent().empty()) + return this->GetVhostIdent(); + + return this->GetVhostIdent() + "@" + this->GetVhostHost(); +} + const Anope::string &NickAlias::GetVhostCreator() const { return this->vhost_creator; |