summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/cs_access.cpp4
-rw-r--r--modules/commands/cs_akick.cpp6
-rw-r--r--modules/commands/hs_off.cpp3
-rw-r--r--modules/commands/hs_on.cpp2
-rw-r--r--modules/commands/ns_getemail.cpp11
-rw-r--r--modules/commands/os_news.cpp16
6 files changed, 26 insertions, 16 deletions
diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp
index 2fba96a9a..2e8212383 100644
--- a/modules/commands/cs_access.cpp
+++ b/modules/commands/cs_access.cpp
@@ -891,9 +891,9 @@ class CSAccess : public Module
{
if (group->ci == NULL)
return EVENT_CONTINUE;
- /* Special case. Allows a level of < 0 to match anyone, and a level of 0 to match anyone identified. */
+ /* Special case. Allows a level of -1 to match anyone, and a level of 0 to match anyone identified. */
int16_t level = group->ci->GetLevel(priv);
- if (level < 0)
+ if (level == -1)
return EVENT_ALLOW;
else if (level == 0 && group->nc)
return EVENT_ALLOW;
diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp
index 03db4c623..327b98b09 100644
--- a/modules/commands/cs_akick.cpp
+++ b/modules/commands/cs_akick.cpp
@@ -554,7 +554,11 @@ class CSAKick : public Module
mask = autokick->mask;
reason = autokick->reason;
if (reason.empty())
- reason = Language::Translate(u, Config->GetModule(this)->Get<const Anope::string>("autokickreason").c_str());
+ {
+ reason = Language::Translate(u, Config->GetModule(this)->Get<const Anope::string>("autokickreason").c_str())
+ .replace_all_cs("%n", u->nick)
+ .replace_all_cs("%c", c->name);
+ }
if (reason.empty())
reason = Language::Translate(u, _("User has been banned from the channel"));
return EVENT_STOP;
diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp
index 603b863c1..d0a64fb5b 100644
--- a/modules/commands/hs_off.cpp
+++ b/modules/commands/hs_off.cpp
@@ -23,7 +23,10 @@ class CommandHSOff : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
User *u = source.GetUser();
+
const NickAlias *na = NickAlias::Find(u->nick);
+ if (!na || na->nc != u->Account() || !na->HasVhost())
+ na = NickAlias::Find(u->Account()->display);
if (!na || !na->HasVhost())
source.Reply(HOST_NOT_ASSIGNED);
diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp
index d59206e27..26fa6266f 100644
--- a/modules/commands/hs_on.cpp
+++ b/modules/commands/hs_on.cpp
@@ -27,6 +27,8 @@ class CommandHSOn : public Command
User *u = source.GetUser();
const NickAlias *na = NickAlias::Find(u->nick);
+ if (!na || na->nc != u->Account() || !na->HasVhost())
+ na = NickAlias::Find(u->Account()->display);
if (na && u->Account() == na->nc && na->HasVhost())
{
if (!na->GetVhostIdent().empty())
diff --git a/modules/commands/ns_getemail.cpp b/modules/commands/ns_getemail.cpp
index 8d7976bb0..39239e86f 100644
--- a/modules/commands/ns_getemail.cpp
+++ b/modules/commands/ns_getemail.cpp
@@ -35,16 +35,16 @@ class CommandNSGetEMail : public Command
{
const NickCore *nc = it->second;
- if (!nc->email.empty() && nc->email.equals_ci(email))
+ if (!nc->email.empty() && Anope::Match(nc->email, email))
{
++j;
- source.Reply(_("Email matched: \002%s\002 to \002%s\002."), nc->display.c_str(), email.c_str());
+ source.Reply(_("Email matched: \002%s\002 (\002%s\002) to \002%s\002."), nc->display.c_str(), nc->email.c_str(), email.c_str());
}
}
if (j <= 0)
{
- source.Reply(_("No nick registrations matching \002%s\002 found."), email.c_str());
+ source.Reply(_("No registrations matching \002%s\002 were found."), email.c_str());
return;
}
@@ -55,10 +55,7 @@ class CommandNSGetEMail : public Command
{
this->SendSyntax(source);
source.Reply(" ");
- source.Reply(_("Returns the matching nicks that used given email. \002Note\002 that\n"
- "you can not use wildcards. Whenever this command is used, a message\n"
- "including the person who issued the command and the email it was used\n"
- "on will be logged."));
+ source.Reply(_("Returns the matching accounts that used given email."));
return true;
}
};
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index b74ca3b57..a0dc13407 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -403,23 +403,27 @@ class OSNews : public Module
else if (Type == NEWS_RANDOM)
msg = _("[\002Random News\002 - %s] %s");
- unsigned displayed = 0;
- for (unsigned i = 0, end = newsList.size(); i < end; ++i)
+ int start = 0;
+
+ if (type != NEWS_RANDOM)
+ {
+ start = newsList.size() - news_count;
+ if (start < 0)
+ start = 0;
+ }
+
+ for (unsigned i = start, end = newsList.size(); i < end; ++i)
{
if (Type == NEWS_RANDOM && i != cur_rand_news)
continue;
u->SendMessage(bi, msg.c_str(), Anope::strftime(newsList[i]->time, u->Account(), true).c_str(), newsList[i]->text.c_str());
- ++displayed;
-
if (Type == NEWS_RANDOM)
{
++cur_rand_news;
break;
}
- else if (displayed >= news_count)
- break;
}
/* Reset to head of list to get first random news value */