From f36915790674275627cf8eb68024e17539ee04fa Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 11 Apr 2014 16:10:30 -0400 Subject: Use OnChanRegistered instead of OnCreateChan to set default mlocks. Because OnCreateChan is called from ChannelInfo's constructor, during DB loading it could cause mode locks to be unserialized without having all channels loaded, which breaks things. --- modules/commands/cs_mode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index a13610d23..941a6d183 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -951,7 +951,7 @@ class CSMode : public Module } } - void OnCreateChan(ChannelInfo *ci) anope_override + void OnChanRegistered(ChannelInfo *ci) anope_override { ModeLocks *ml = modelocks.Require(ci); Anope::string mlock; -- cgit From d52cc7bcbcf9b99a58eedc823418a91f85e8cab9 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Apr 2014 01:24:05 -0400 Subject: Bug #1587 - fix bot change not properly reintroducing clients --- modules/commands/bs_bot.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp index e25ba8ff0..69fa7f8fe 100644 --- a/modules/commands/bs_bot.cpp +++ b/modules/commands/bs_bot.cpp @@ -189,7 +189,10 @@ class CommandBSBot : public Command } if (!user.empty()) + { IRCD->SendQuit(bi, "Quit: Be right back"); + bi->introduced = false; + } else IRCD->SendNickChange(bi, nick); @@ -204,18 +207,7 @@ class CommandBSBot : public Command bi->realname = real; if (!user.empty()) - { - IRCD->SendClientIntroduction(bi); - unsigned minusers = Config->GetBlock("botserv")->Get("minusers"); - const std::set &channels = bi->GetChannels(); - for (std::set::const_iterator it = channels.begin(), it_end = channels.end(); it != it_end; ++it) - { - const ChannelInfo *ci = *it; - - if (ci->c && ci->c->users.size() >= minusers) - bi->Join(ci->c); - } - } + bi->OnKill(); source.Reply(_("Bot \002%s\002 has been changed to %s!%s@%s (%s)."), oldnick.c_str(), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str()); Log(LOG_ADMIN, source, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname; -- cgit From 00b2cc9ce6b9e4d4869d986ada1cf64d22b95455 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Apr 2014 01:38:45 -0400 Subject: Require at least user@host format for akills. Fix XLine::GetHost() not returning anything if an xline only has a host --- modules/commands/os_akill.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/commands') diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index c81a6b515..af8573752 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -160,6 +160,11 @@ class CommandOSAKill : public Command source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); return; } + else if (mask.find('@') == Anope::string::npos) + { + source.Reply(BAD_USERHOST_MASK); + return; + } if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) reason = "[" + source.GetNick() + "] " + reason; -- cgit From f010ab7dbf020ae218dbd7390af4bcff4bac6fbe Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Apr 2014 01:40:56 -0400 Subject: Resend ircd login name on /ns set display --- modules/commands/ns_set.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index 063b7c4dd..e8abf762f 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -330,7 +330,7 @@ class CommandNSSetDisplay : public Command return; } - const NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param); + NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param); if (Config->GetModule("nickserv")->Get("nonicknameownership")) { @@ -356,6 +356,8 @@ class CommandNSSetDisplay : public Command Log(user_na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->nc->display << " to " << na->nick; user_na->nc->SetDisplay(na); + if (source.GetUser()) + IRCD->SendLogin(source.GetUser(), na); source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str()); } -- cgit From 75ed5a9b59dd29b2e63d502eb3425696d93765fd Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Apr 2014 01:50:50 -0400 Subject: Fix os_stats counters not saving with db_sql_live. Bleh. --- modules/commands/os_stats.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/commands') diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index 85088f385..bd868b903 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -258,6 +258,12 @@ class OSStats : public Module { } + + void OnUserConnect(User *u, bool &exempt) anope_override + { + if (UserListByNick.size() == MaxUserCount && Anope::CurTime == MaxUserTime) + stats_saver.QueueUpdate(); + } }; MODULE_INIT(OSStats) -- cgit From c9473bcc67e0259b0aa79c95424e6fc044777ccc Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Apr 2014 17:10:06 -0400 Subject: Fix botserv/kick/bolds desc --- modules/commands/bs_kick.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index c08376e3c..f3f000474 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -325,7 +325,7 @@ class CommandBSKickBolds : public CommandBSKickBase public: CommandBSKickBolds(Module *creator) : CommandBSKickBase(creator, "botserv/kick/bolds", 2, 3) { - this->SetDesc(_("Configures badwords kicker")); + this->SetDesc(_("Configures bolds kicker")); this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037]")); } -- cgit From 82008d507cccbf24c73502bc97bc492d21305549 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Apr 2014 16:46:37 -0400 Subject: Fix Stas::Unserialize to return the instance --- modules/commands/os_stats.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index bd868b903..baa349db4 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -14,7 +14,12 @@ struct Stats : Serializable { - Stats() : Serializable("Stats") { } + static Stats *me; + + Stats() : Serializable("Stats") + { + me = this; + } void Serialize(Serialize::Data &data) const anope_override { @@ -26,7 +31,7 @@ struct Stats : Serializable { data["maxusercnt"] >> MaxUserCount; data["maxusertime"] >> MaxUserTime; - return NULL; + return me; } }; -- cgit From 6a03eb69ebbe773f1d4139ff88d74ecdb2b0af4b Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Apr 2014 16:51:06 -0400 Subject: Add "virtual mode" support This allows fully tracking extbans and other modes set by a different underlying mode, such as InspIRCd's namedmodes Add two configuration options to cs_ban to configure which mode is set and whether or not to kick banned users. Add default "mute" fantasy command to botserv.example.conf --- modules/commands/cs_ban.cpp | 47 ++++++++++++++++++++++++++----------------- modules/commands/cs_mode.cpp | 3 +-- modules/commands/cs_unban.cpp | 15 +++++++++++--- 3 files changed, 41 insertions(+), 24 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 0395ddd92..648e379e3 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -19,15 +19,16 @@ class TempBan : public Timer private: Anope::string channel; Anope::string mask; + Anope::string mode; public: - TempBan(time_t seconds, Channel *c, const Anope::string &banmask) : Timer(me, seconds), channel(c->name), mask(banmask) { } + TempBan(time_t seconds, Channel *c, const Anope::string &banmask, const Anope::string &mod) : Timer(me, seconds), channel(c->name), mask(banmask), mode(mod) { } void Tick(time_t ctime) anope_override { Channel *c = Channel::Find(this->channel); if (c) - c->RemoveMode(NULL, "BAN", this->mask); + c->RemoveMode(NULL, mode, this->mask); } }; @@ -43,6 +44,8 @@ class CommandCSBan : public Command void Execute(CommandSource &source, const std::vector ¶ms) anope_override { const Anope::string &chan = params[0]; + Configuration::Block *block = Config->GetCommand(source); + const Anope::string &mode = block->Get("mode", "BAN"); ChannelInfo *ci = ChannelInfo::Find(chan); if (ci == NULL) @@ -57,9 +60,9 @@ class CommandCSBan : public Command source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); return; } - else if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c)) + else if (IRCD->GetMaxListFor(c) && c->HasMode(mode) >= IRCD->GetMaxListFor(c)) { - source.Reply(_("The ban list for %s is full."), c->name.c_str()); + source.Reply(_("The %s list for %s is full."), mode.lower().c_str(), c->name.c_str()); return; } @@ -126,12 +129,12 @@ class CommandCSBan : public Command bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask; - if (!c->HasMode("BAN", mask)) + if (!c->HasMode(mode, mask)) { - c->SetMode(NULL, "BAN", mask); + c->SetMode(NULL, mode, mask); if (ban_time) { - new TempBan(ban_time, c, mask); + new TempBan(ban_time, c, mask, mode); source.Reply(_("Ban on \002%s\002 expires in %s."), mask.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str()); } } @@ -140,10 +143,13 @@ class CommandCSBan : public Command if (!c->FindUser(u2)) return; - if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) - c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); - else - c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + if (block->Get("kick", "yes")) + { + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) + c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); + else + c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + } } } else @@ -152,12 +158,12 @@ class CommandCSBan : public Command bool override = !founder && !u_access.HasPriv("BAN"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << target; - if (!c->HasMode("BAN", target)) + if (!c->HasMode(mode, target)) { - c->SetMode(NULL, "BAN", target); + c->SetMode(NULL, mode, target); if (ban_time) { - new TempBan(ban_time, c, target); + new TempBan(ban_time, c, target, mode); source.Reply(_("Ban on \002%s\002 expires in %s."), target.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str()); } } @@ -183,11 +189,14 @@ class CommandCSBan : public Command else if (uc->user->IsProtected()) continue; - ++kicked; - if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) - c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str()); - else - c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str()); + if (block->Get("kick", "yes")) + { + ++kicked; + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) + c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str()); + else + c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str()); + } } } diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 941a6d183..2943c64a3 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -488,8 +488,7 @@ class CommandCSMode : public Command for (unsigned j = 0; j < ModeManager::GetChannelModes().size(); ++j) { ChannelMode *cm = ModeManager::GetChannelModes()[j]; - if (!cm) - continue; + if (!u || cm->CanSet(u) || can_override) { if (cm->type == MODE_REGULAR || (!adding && cm->type == MODE_PARAM)) diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp index 56a482985..9fd6400a8 100644 --- a/modules/commands/cs_unban.cpp +++ b/modules/commands/cs_unban.cpp @@ -22,6 +22,13 @@ class CommandCSUnban : public Command void Execute(CommandSource &source, const std::vector ¶ms) anope_override { + ChannelMode *cm = ModeManager::FindChannelModeByName("BAN"); + if (!cm) + return; + + std::vector modes = cm->listeners; + modes.push_back(cm); + if (params.empty()) { if (!source.GetUser()) @@ -38,8 +45,9 @@ class CommandCSUnban : public Command if (!ci->c || !source.AccessFor(ci).HasPriv("UNBAN")) continue; - if (ci->c->Unban(source.GetUser(), true)) - ++count; + for (unsigned j = 0; j < modes.size(); ++j) + if (ci->c->Unban(source.GetUser(), modes[j]->name, true)) + ++count; } Log(LOG_COMMAND, source, this, NULL) << "on all channels"; @@ -80,7 +88,8 @@ class CommandCSUnban : public Command bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unban " << u2->nick; - ci->c->Unban(u2, source.GetUser() == u2); + for (unsigned i = 0; i < modes.size(); ++i) + ci->c->Unban(u2, modes[i]->name, source.GetUser() == u2); if (u2 == source.GetUser()) source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str()); else -- cgit From 2ee496b8ac2aff980103237331514f31b7fdc039 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 26 Apr 2014 17:30:58 -0400 Subject: Change the "does not expire" string in ns_group to NO_EXPIRE which is translatable --- modules/commands/ns_group.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index 04842b3e3..9b3f425e9 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -321,7 +321,7 @@ class CommandNSGList : public Command Anope::string expires; if (na2->HasExt("NS_NO_EXPIRE")) - expires = "Does not expire"; + expires = NO_EXPIRE; else if (!nickserv_expire || Anope::NoExpire) ; else if (na2->nc->HasExt("UNCONFIRMED") && unconfirmed_expire) -- cgit From 8021a53ac47d95f874cc50bd2a0a73715164fae3 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 26 Apr 2014 18:30:54 -0400 Subject: Fix misc help output to not be case sensitive --- modules/commands/cs_set_misc.cpp | 2 +- modules/commands/ns_set_misc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp index 481b54cb9..81b8c72fa 100644 --- a/modules/commands/cs_set_misc.cpp +++ b/modules/commands/cs_set_misc.cpp @@ -13,7 +13,7 @@ static Module *me; -static std::map descriptions; +static Anope::map descriptions; struct CSMiscData; static Anope::map *> items; diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp index 496e3a4e2..455a651fb 100644 --- a/modules/commands/ns_set_misc.cpp +++ b/modules/commands/ns_set_misc.cpp @@ -14,7 +14,7 @@ static Module *me; -static std::map descriptions; +static Anope::map descriptions; struct NSMiscData; static Anope::map *> items; -- cgit From 3049916ade0c31c2edf2fca98456bccc14d06270 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 30 Apr 2014 01:15:10 +0200 Subject: Fix undefined symbol error when loading os_stats, caused by 82008d507cccbf24c73502bc97bc492d21305549 --- modules/commands/os_stats.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/commands') diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index baa349db4..e5cae1dcc 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -35,6 +35,8 @@ struct Stats : Serializable } }; +Stats *Stats::me; + /** * Count servers connected to server s * @param s The server to start counting from -- cgit From d79dd0b7d705e8f18ae0d6494a8bc65c2b0c2819 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 1 May 2014 18:38:17 -0400 Subject: Pass password to nick register event so modules like m_ldap_authentication can create the respective account using the decrypted password which might not always be available --- modules/commands/ns_access.cpp | 2 +- modules/commands/ns_register.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp index dfafdb37f..d01f6dc9b 100644 --- a/modules/commands/ns_access.cpp +++ b/modules/commands/ns_access.cpp @@ -196,7 +196,7 @@ class NSAccess : public Module { } - void OnNickRegister(User *u, NickAlias *na) anope_override + void OnNickRegister(User *u, NickAlias *na, const Anope::string &) anope_override { if (u && Config->GetModule(this)->Get("addaccessonreg")) na->nc->AddAccess(u->Mask()); diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index c3d678cf1..8e916c4d7 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -198,7 +198,7 @@ class CommandNSRegister : public Command Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")"; - FOREACH_MOD(OnNickRegister, (source.GetUser(), na)); + FOREACH_MOD(OnNickRegister, (source.GetUser(), na, pass)); if (na->nc->GetAccessCount()) source.Reply(_("Nickname \002%s\002 registered under your user@host-mask: %s"), u_nick.c_str(), na->nc->GetAccess(0).c_str()); -- cgit From 1f2c385bb9b7a78094024d226440a2ec4cfb6b80 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 1 May 2014 21:03:32 -0400 Subject: Add config options to ns_suspend and cs_suspend to configure which information is shown to non opers --- modules/commands/cs_suspend.cpp | 37 +++++++++++++++++++++++----------- modules/commands/ns_suspend.cpp | 44 ++++++++++++++++++++++++++++++----------- 2 files changed, 59 insertions(+), 22 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp index 4ebb6eecb..faec2a8c1 100644 --- a/modules/commands/cs_suspend.cpp +++ b/modules/commands/cs_suspend.cpp @@ -200,6 +200,20 @@ class CSSuspend : public Module CommandCSUnSuspend commandcsunsuspend; ExtensibleItem suspend; Serialize::Type suspend_type; + std::vector show; + + struct trim + { + Anope::string operator()(Anope::string s) const + { + return s.trim(); + } + }; + + bool Show(CommandSource &source, const Anope::string &what) const + { + return source.IsOper() || std::find(show.begin(), show.end(), what) != show.end(); + } public: CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), @@ -211,18 +225,19 @@ class CSSuspend : public Module void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_hidden) anope_override { CSSuspendInfo *si = suspend.Get(ci); - if (si) - { + if (!si) + return; + + if (show_hidden || Show(source, "suspended")) info[_("Suspended")] = _("This channel is \002suspended\002."); - if (!si->by.empty()) - info[_("Suspended by")] = si->by; - if (!si->reason.empty()) - info[_("Suspend reason")] = si->reason; - if (si->when) - info[_("Suspended on")] = Anope::strftime(si->when, source.GetAccount(), true); - if (si->expires) - info[_("Suspension expires")] = Anope::strftime(si->expires, source.GetAccount(), true); - } + if (!si->by.empty() && (show_hidden || Show(source, "by"))) + info[_("Suspended by")] = si->by; + if (!si->reason.empty() && (show_hidden || Show(source, "reason"))) + info[_("Suspend reason")] = si->reason; + if (si->when && (show_hidden || Show(source, "on"))) + info[_("Suspended on")] = Anope::strftime(si->when, source.GetAccount(), true); + if (si->expires && (show_hidden || Show(source, "expires"))) + info[_("Suspension expires")] = Anope::strftime(si->expires, source.GetAccount(), true); } void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_override diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp index 241997d1c..72e82cadf 100644 --- a/modules/commands/ns_suspend.cpp +++ b/modules/commands/ns_suspend.cpp @@ -207,6 +207,20 @@ class NSSuspend : public Module CommandNSUnSuspend commandnsunsuspend; ExtensibleItem suspend; Serialize::Type suspend_type; + std::vector show; + + struct trim + { + Anope::string operator()(Anope::string s) const + { + return s.trim(); + } + }; + + bool Show(CommandSource &source, const Anope::string &what) const + { + return source.IsOper() || std::find(show.begin(), show.end(), what) != show.end(); + } public: NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), @@ -215,21 +229,29 @@ class NSSuspend : public Module { } + void OnReload(Configuration::Conf *conf) anope_override + { + Anope::string s = conf->GetModule(this)->Get("show"); + commasepstream(s).GetTokens(show); + std::transform(show.begin(), show.end(), show.begin(), trim()); + } + void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override { NSSuspendInfo *s = suspend.Get(na->nc); - if (s) - { + if (!s) + return; + + if (show_hidden || Show(source, "suspended")) info[_("Suspended")] = _("This nickname is \002suspended\002."); - if (!s->by.empty()) - info[_("Suspended by")] = s->by; - if (!s->reason.empty()) - info[_("Suspend reason")] = s->reason; - if (s->when) - info[_("Suspended on")] = Anope::strftime(s->when, source.GetAccount(), true); - if (s->expires) - info[_("Suspension expires")] = Anope::strftime(s->expires, source.GetAccount(), true); - } + if (!s->by.empty() && (show_hidden || Show(source, "by"))) + info[_("Suspended by")] = s->by; + if (!s->reason.empty() && (show_hidden || Show(source, "reason"))) + info[_("Suspend reason")] = s->reason; + if (s->when && (show_hidden || Show(source, "on"))) + info[_("Suspended on")] = Anope::strftime(s->when, source.GetAccount(), true); + if (s->expires && (show_hidden || Show(source, "expires"))) + info[_("Suspension expires")] = Anope::strftime(s->expires, source.GetAccount(), true); } void OnPreNickExpire(NickAlias *na, bool &expire) anope_override -- cgit From 91c7862579f5c5a9ad9d939fd7a7b8fbfa6213a4 Mon Sep 17 00:00:00 2001 From: Cronus89 Date: Tue, 13 May 2014 11:12:00 -0500 Subject: Update Paramater length for os_dns to fix DNS SET --- modules/commands/os_dns.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index 6a930980f..b8077b7e9 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -653,7 +653,7 @@ class CommandOSDNS : public Command } public: - CommandOSDNS(Module *creator) : Command(creator, "operserv/dns", 0, 3) + CommandOSDNS(Module *creator) : Command(creator, "operserv/dns", 0, 4) { this->SetDesc(_("Manage DNS zones for this network")); this->SetSyntax(_("ADDZONE \037zone.name\037")); -- cgit From 0c7d53f81ee87a3fb15145de985503d9dc429dae Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 13 May 2014 18:38:14 -0400 Subject: Don't show both online from's if they have the same mask in ns_info --- modules/commands/ns_info.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp index 5d9ff8c7a..443b6a9b7 100644 --- a/modules/commands/ns_info.cpp +++ b/modules/commands/ns_info.cpp @@ -62,9 +62,13 @@ class CommandNSInfo : public Command if (nick_online) { + bool shown = false; if (show_hidden && !na->last_realhost.empty()) + { info[_("Online from")] = na->last_realhost; - if (show_hidden || !na->nc->HasExt("HIDE_MASK")) + shown = true; + } + if ((show_hidden || !na->nc->HasExt("HIDE_MASK")) && (!shown || na->last_usermask != na->last_realhost)) info[_("Online from")] = na->last_usermask; else source.Reply(_("%s is currently online."), na->nick.c_str()); -- cgit From 1c8a77ab9f4adfd0afd8217bc462bb338925dcea Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 13 May 2014 19:52:01 -0400 Subject: Accept an optional reason for svspart --- modules/commands/os_svs.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/os_svs.cpp b/modules/commands/os_svs.cpp index 35ad1aa1e..ee8c60114 100644 --- a/modules/commands/os_svs.cpp +++ b/modules/commands/os_svs.cpp @@ -117,10 +117,10 @@ class CommandOSSVSJoin : public Command class CommandOSSVSPart : public Command { public: - CommandOSSVSPart(Module *creator) : Command(creator, "operserv/svspart", 2, 2) + CommandOSSVSPart(Module *creator) : Command(creator, "operserv/svspart", 2, 3) { this->SetDesc(_("Forcefully part a user from a channel")); - this->SetSyntax(_("\037nick\037 \037channel\037")); + this->SetSyntax(_("\037nick\037 \037channel\037 [\037reason\037]")); } void Execute(CommandSource &source, const std::vector ¶ms) anope_override @@ -133,6 +133,7 @@ class CommandOSSVSPart : public Command User *target = User::Find(params[0], true); Channel *c = Channel::Find(params[1]); + const Anope::string &reason = params.size() > 2 ? params[2] : ""; if (target == NULL) source.Reply(NICK_X_NOT_IN_USE, params[0].c_str()); else if (source.GetUser() != target && (target->IsProtected() || target->server == Me)) @@ -143,8 +144,11 @@ class CommandOSSVSPart : public Command source.Reply(_("\002%s\002 is not in \002%s\002."), target->nick.c_str(), c->name.c_str()); else { - IRCD->SendSVSPart(*source.service, target, params[1], ""); - Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name; + IRCD->SendSVSPart(*source.service, target, params[1], reason); + if (!reason.empty()) + Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name << " with reason " << reason; + else + Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name; source.Reply(_("\002%s\002 has been parted from \002%s\002."), target->nick.c_str(), c->name.c_str()); } } -- cgit From df321a118e7dd44dcd3a389f8ee75e9ff915b55e Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 14 May 2014 19:10:23 -0400 Subject: Fix access lists showing the wrong mask if the display nick for a group expires but the group still exists. This can cause access entries for nicks to not be deleted whenever the nicks are deleted. --- modules/commands/cs_access.cpp | 31 +++++++++++++++---------------- modules/commands/cs_clone.cpp | 9 ++++----- modules/commands/cs_flags.cpp | 15 +++++++-------- modules/commands/cs_seen.cpp | 2 +- modules/commands/cs_status.cpp | 2 +- modules/commands/cs_xop.cpp | 23 +++++++++++------------ 6 files changed, 39 insertions(+), 43 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index b4f682c66..d5f934862 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -180,7 +180,7 @@ class CommandCSAccess : public Command for (unsigned i = ci->GetAccessCount(); i > 0; --i) { const ChanAccess *access = ci->GetAccess(i - 1); - if (mask.equals_ci(access->mask)) + if (mask.equals_ci(access->Mask())) { /* Don't allow lowering from a level >= u_level */ if ((!highest || *access >= *highest) && !u_access.founder && !source.HasPriv("chanserv/access/modify")) @@ -204,8 +204,7 @@ class CommandCSAccess : public Command if (!provider) return; AccessChanAccess *access = anope_dynamic_static_cast(provider->Create()); - access->ci = ci; - access->mask = mask; + access->SetMask(mask, ci); access->creator = source.GetNick(); access->level = level; access->last_seen = 0; @@ -216,9 +215,9 @@ class CommandCSAccess : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level; if (p != NULL) - source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->mask.c_str(), ci->name.c_str(), p->name.c_str(), level); + source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->Mask().c_str(), ci->name.c_str(), p->name.c_str(), level); else - source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level); + source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->Mask().c_str(), ci->name.c_str(), level); } void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector ¶ms) @@ -284,7 +283,7 @@ class CommandCSAccess : public Command AccessGroup ag = source.AccessFor(ci); const ChanAccess *u_highest = ag.Highest(); - if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && !access->mask.equals_ci(source.nc->display)) + if ((!u_highest || *u_highest <= *access) && !ag.founder && !this->override && access->GetAccount() != source.nc) { denied = true; return; @@ -292,9 +291,9 @@ class CommandCSAccess : public Command ++deleted; if (!Nicks.empty()) - Nicks += ", " + access->mask; + Nicks += ", " + access->Mask(); else - Nicks = access->mask; + Nicks = access->Mask(); ci->EraseAccess(Number - 1); @@ -313,15 +312,15 @@ class CommandCSAccess : public Command for (unsigned i = ci->GetAccessCount(); i > 0; --i) { ChanAccess *access = ci->GetAccess(i - 1); - if (mask.equals_ci(access->mask)) + if (mask.equals_ci(access->Mask())) { - if (!access->mask.equals_ci(source.nc->display) && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify")) + if (access->GetAccount() != source.nc && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify")) source.Reply(ACCESS_DENIED); else { - source.Reply(_("\002%s\002 deleted from %s access list."), access->mask.c_str(), ci->name.c_str()); - bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->mask.equals_ci(source.nc->display); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask; + source.Reply(_("\002%s\002 deleted from %s access list."), access->Mask().c_str(), ci->name.c_str()); + bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && access->GetAccount() != source.nc; + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->Mask(); ci->EraseAccess(i - 1); FOREACH_MOD(OnAccessDel, (ci, source, access)); @@ -381,7 +380,7 @@ class CommandCSAccess : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(number); entry["Level"] = access->AccessSerialize(); - entry["Mask"] = access->mask; + entry["Mask"] = access->Mask(); entry["By"] = access->creator; entry["Last seen"] = timebuf; this->list.AddEntry(entry); @@ -396,7 +395,7 @@ class CommandCSAccess : public Command { const ChanAccess *access = ci->GetAccess(i); - if (!nick.empty() && !Anope::Match(access->mask, nick)) + if (!nick.empty() && !Anope::Match(access->Mask(), nick)) continue; Anope::string timebuf; @@ -418,7 +417,7 @@ class CommandCSAccess : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); entry["Level"] = access->AccessSerialize(); - entry["Mask"] = access->mask; + entry["Mask"] = access->Mask(); entry["By"] = access->creator; entry["Last seen"] = timebuf; list.AddEntry(entry); diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp index e93029466..8365091cf 100644 --- a/modules/commands/cs_clone.cpp +++ b/modules/commands/cs_clone.cpp @@ -111,7 +111,7 @@ public: unsigned count = 0; for (unsigned i = 0; i < target_ci->GetAccessCount(); ++i) - masks.insert(target_ci->GetAccess(i)->mask); + masks.insert(target_ci->GetAccess(i)->Mask()); for (unsigned i = 0; i < ci->GetAccessCount(); ++i) { @@ -121,13 +121,12 @@ public: if (access_max && target_ci->GetDeepAccessCount() >= access_max) break; - if (masks.count(taccess->mask)) + if (masks.count(taccess->Mask())) continue; - masks.insert(taccess->mask); + masks.insert(taccess->Mask()); ChanAccess *newaccess = provider->Create(); - newaccess->ci = target_ci; - newaccess->mask = taccess->mask; + newaccess->SetMask(taccess->Mask(), target_ci); newaccess->creator = taccess->creator; newaccess->last_seen = taccess->last_seen; newaccess->created = taccess->created; diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp index 01314e2d3..e3f3da978 100644 --- a/modules/commands/cs_flags.cpp +++ b/modules/commands/cs_flags.cpp @@ -142,7 +142,7 @@ class CommandCSFlags : public Command for (current_idx = ci->GetAccessCount(); current_idx > 0; --current_idx) { ChanAccess *access = ci->GetAccess(current_idx - 1); - if (mask.equals_ci(access->mask)) + if (mask.equals_ci(access->Mask())) { // Flags allows removing others that have the same access as you, // but no other access system does. @@ -260,8 +260,7 @@ class CommandCSFlags : public Command if (!provider) return; FlagsChanAccess *access = anope_dynamic_static_cast(provider->Create()); - access->ci = ci; - access->mask = mask; + access->SetMask(mask, ci); access->creator = source.GetNick(); access->last_seen = current ? current->last_seen : 0; access->created = Anope::CurTime; @@ -278,12 +277,12 @@ class CommandCSFlags : public Command if (p != NULL) { if (add) - source.Reply(_("Privilege \002%s\002 added to \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); + source.Reply(_("Privilege \002%s\002 added to \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); else - source.Reply(_("Privilege \002%s\002 removed from \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); + source.Reply(_("Privilege \002%s\002 removed from \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); } else - source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); + source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->Mask().c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); } void DoList(CommandSource &source, ChannelInfo *ci, const std::vector ¶ms) @@ -317,14 +316,14 @@ class CommandCSFlags : public Command if (pass == false) continue; } - else if (!Anope::Match(access->mask, arg)) + else if (!Anope::Match(access->Mask(), arg)) continue; } ListFormatter::ListEntry entry; ++count; entry["Number"] = stringify(i + 1); - entry["Mask"] = access->mask; + entry["Mask"] = access->Mask(); entry["Flags"] = flags; entry["Creator"] = access->creator; entry["Created"] = Anope::strftime(access->created, source.nc, true); diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index c6dbec9a9..923edb361 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -241,7 +241,7 @@ class CommandSeen : public Command { ChanAccess *a = ag[i]; - if (*a->nc == na->nc && a->last_seen > last) + if (a->GetAccount() == na->nc && a->last_seen > last) last = a->last_seen; } diff --git a/modules/commands/cs_status.cpp b/modules/commands/cs_status.cpp index 2ecaf8e9f..115085e83 100644 --- a/modules/commands/cs_status.cpp +++ b/modules/commands/cs_status.cpp @@ -61,7 +61,7 @@ public: { ChanAccess *acc = ag[i]; - source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->AccessSerialize().c_str()); + source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->Mask().c_str(), acc->AccessSerialize().c_str()); } } diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index 72b1e0def..4c48dcc01 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -182,7 +182,7 @@ class CommandCSXOP : public Command { const ChanAccess *a = ci->GetAccess(i); - if (a->mask.equals_ci(mask)) + if (a->Mask().equals_ci(mask)) { if ((!highest || *a >= *highest) && !access.founder && !source.HasPriv("chanserv/access/modify")) { @@ -206,8 +206,7 @@ class CommandCSXOP : public Command if (!provider) return; XOPChanAccess *acc = anope_dynamic_static_cast(provider->Create()); - acc->ci = ci; - acc->mask = mask; + acc->SetMask(mask, ci); acc->creator = source.GetNick(); acc->type = source.command.upper(); acc->last_seen = 0; @@ -217,7 +216,7 @@ class CommandCSXOP : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask; FOREACH_MOD(OnAccessAdd, (ci, source, acc)); - source.Reply(_("\002%s\002 added to %s %s list."), acc->mask.c_str(), ci->name.c_str(), source.command.c_str()); + source.Reply(_("\002%s\002 added to %s %s list."), acc->Mask().c_str(), ci->name.c_str(), source.command.c_str()); } void DoDel(CommandSource &source, ChannelInfo *ci, const std::vector ¶ms) @@ -320,9 +319,9 @@ class CommandCSXOP : public Command ++deleted; if (!nicks.empty()) - nicks += ", " + caccess->mask; + nicks += ", " + caccess->Mask(); else - nicks = caccess->mask; + nicks = caccess->Mask(); ci->EraseAccess(number - 1); FOREACH_MOD(OnAccessDel, (ci, source, caccess)); @@ -341,11 +340,11 @@ class CommandCSXOP : public Command if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize()) continue; - if (a->mask.equals_ci(mask)) + if (a->Mask().equals_ci(mask)) { - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->mask; + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << a->Mask(); - source.Reply(_("\002%s\002 deleted from %s %s list."), a->mask.c_str(), ci->name.c_str(), source.command.c_str()); + source.Reply(_("\002%s\002 deleted from %s %s list."), a->Mask().c_str(), ci->name.c_str(), source.command.c_str()); ci->EraseAccess(i); FOREACH_MOD(OnAccessDel, (ci, source, a)); @@ -405,7 +404,7 @@ class CommandCSXOP : public Command ListFormatter::ListEntry entry; entry["Number"] = stringify(Number); - entry["Mask"] = a->mask; + entry["Mask"] = a->Mask(); this->list.AddEntry(entry); } } nl_list(list, ci, nick, source); @@ -419,12 +418,12 @@ class CommandCSXOP : public Command if (a->provider->name != "access/xop" || source.command.upper() != a->AccessSerialize()) continue; - else if (!nick.empty() && !Anope::Match(a->mask, nick)) + else if (!nick.empty() && !Anope::Match(a->Mask(), nick)) continue; ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); - entry["Mask"] = a->mask; + entry["Mask"] = a->Mask(); list.AddEntry(entry); } } -- cgit From 01021131ca2f8e3808b1f3d284147e759a466f04 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 20 May 2014 09:52:26 -0400 Subject: Also search channel descriptions and topics in /cs list --- modules/commands/cs_list.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_list.cpp b/modules/commands/cs_list.cpp index d58d105b7..fb056f9b2 100644 --- a/modules/commands/cs_list.cpp +++ b/modules/commands/cs_list.cpp @@ -10,6 +10,7 @@ */ #include "module.h" +#include "modules/cs_mode.h" class CommandCSList : public Command { @@ -87,6 +88,11 @@ class CommandCSList : public Command continue; if (ci->c && ci->c->HasMode("SECRET")) continue; + + ModeLocks *ml = ci->GetExt("modelocks"); + const ModeLock *secret = ml ? ml->GetMLock("SECRET") : NULL; + if (secret && secret->set) + continue; } if (suspended && !ci->HasExt("CS_SUSPENDED")) @@ -95,7 +101,7 @@ class CommandCSList : public Command if (channoexpire && !ci->HasExt("CS_NO_EXPIRE")) continue; - if (pattern.equals_ci(ci->name) || ci->name.equals_ci(spattern) || Anope::Match(ci->name, pattern, false, true) || Anope::Match(ci->name, spattern, false, true)) + if (pattern.equals_ci(ci->name) || ci->name.equals_ci(spattern) || Anope::Match(ci->name, pattern, false, true) || Anope::Match(ci->name, spattern, false, true) || Anope::Match(ci->desc, pattern, false, true) || Anope::Match(ci->last_topic, pattern, false, true)) { if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nchans <= listmax) { -- cgit From 4034b3054aaff28da1db5545063cf8b3c2e8aa24 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 20 May 2014 11:41:05 -0400 Subject: Add English language file which users can edit to modify language strings --- modules/commands/ns_set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index e8abf762f..f4ecd044b 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -794,7 +794,7 @@ class CommandNSSetLanguage : public Command if (MOD_RESULT == EVENT_STOP) return; - if (param != "en") + if (param != "en_US") for (unsigned j = 0; j < Language::Languages.size(); ++j) { if (Language::Languages[j] == param) @@ -826,7 +826,7 @@ class CommandNSSetLanguage : public Command "\037language\037 should be chosen from the following list of\n" "supported languages:")); - source.Reply(" en (English)"); + source.Reply(" en_US (English)"); for (unsigned j = 0; j < Language::Languages.size(); ++j) { const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English")); -- cgit From 866f3f32ab3713e9867747f150df3698e456744e Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 20 May 2014 21:10:49 -0400 Subject: Speed up akill xline checks Cache xline nick, user, host, etc instead of rebuilding it everytime its requested. Store users ip in sockaddr form and not string form to prevent having to rebuild sockaddrs when checking xlines. Also do not try to convert empty config values in Config::Get as this can be rather common if a non string configuration value is not set, and the cost of the ConvertException is great. --- modules/commands/os_defcon.cpp | 4 ++-- modules/commands/os_list.cpp | 2 +- modules/commands/os_session.cpp | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index afd5dc7d6..c5074fd44 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -502,7 +502,7 @@ class OSDefcon : public Module if (DConfig.sessionlimit <= 0 || !session_service) return; - Session *session = session_service->FindSession(u->ip); + Session *session = session_service->FindSession(u->ip.addr()); Exception *exception = session_service->FindException(u); if (DConfig.Check(DEFCON_REDUCE_SESSION) && !exception) @@ -511,7 +511,7 @@ class OSDefcon : public Module { if (!DConfig.sle_reason.empty()) { - Anope::string message = DConfig.sle_reason.replace_all_cs("%IP%", u->ip); + Anope::string message = DConfig.sle_reason.replace_all_cs("%IP%", u->ip.addr()); u->SendMessage(OperServ, message); } if (!DConfig.sle_detailsloc.empty()) diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp index 7bafd8b4d..b0c5fb339 100644 --- a/modules/commands/os_list.cpp +++ b/modules/commands/os_list.cpp @@ -180,7 +180,7 @@ class CommandOSUserList : public Command if (!pattern.empty()) { - Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + (!u2->ip.empty() ? u2->ip : u2->host); + Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + u2->ip.addr(); if (!Anope::Match(mask, pattern) && !Anope::Match(mask2, pattern) && !Anope::Match(mask3, pattern)) continue; if (!modes.empty()) diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index edf9458f8..40412494e 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -64,10 +64,10 @@ class MySessionService : public SessionService for (std::vector::const_iterator it = this->Exceptions->begin(), it_end = this->Exceptions->end(); it != it_end; ++it) { Exception *e = *it; - if (Anope::Match(u->host, e->mask) || Anope::Match(u->ip, e->mask)) + if (Anope::Match(u->host, e->mask) || Anope::Match(u->ip.addr(), e->mask)) return e; - if (cidr(e->mask).match(sockaddrs(u->ip))) + if (cidr(e->mask).match(u->ip)) return e; } return NULL; @@ -109,9 +109,9 @@ class MySessionService : public SessionService return NULL; } - SessionMap::iterator FindSessionIterator(const Anope::string &ip) + SessionMap::iterator FindSessionIterator(const sockaddrs &ip) { - cidr c(ip, ip.find(':') != Anope::string::npos ? ipv6_cidr : ipv4_cidr); + cidr c(ip, ip.ipv6() ? ipv6_cidr : ipv4_cidr); if (!c.valid()) return this->Sessions.end(); return this->Sessions.find(c); @@ -668,7 +668,7 @@ class OSSession : public Module if (u->Quitting() || !session_limit || exempt || !u->server || u->server->IsULined()) return; - cidr u_ip(u->ip, u->ip.find(':') != Anope::string::npos ? ipv6_cidr : ipv4_cidr); + cidr u_ip(u->ip, u->ip.ipv6() ? ipv6_cidr : ipv4_cidr); if (!u_ip.valid()) return; @@ -705,7 +705,7 @@ class OSSession : public Module { if (!sle_reason.empty()) { - Anope::string message = sle_reason.replace_all_cs("%IP%", u->ip); + Anope::string message = sle_reason.replace_all_cs("%IP%", u->ip.addr()); u->SendMessage(OperServ, message); } if (!sle_detailsloc.empty()) @@ -729,7 +729,7 @@ class OSSession : public Module } else { - session = new Session(u->ip, u->ip.find(':') != Anope::string::npos ? ipv6_cidr : ipv4_cidr); + session = new Session(u->ip, u->ip.ipv6() ? ipv6_cidr : ipv4_cidr); } } -- cgit From f627a3bacd0d058e94260dac1555790cafd9a926 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 21 May 2014 08:50:40 -0400 Subject: Core prep for p10 stuff --- modules/commands/os_jupe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp index 7d9c2dd6a..d3b25905e 100644 --- a/modules/commands/os_jupe.cpp +++ b/modules/commands/os_jupe.cpp @@ -36,7 +36,7 @@ class CommandOSJupe : public Command { Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : ""); /* Generate the new sid before quitting the old server, so they can't collide */ - Anope::string sid = Servers::TS6_SID_Retrieve(); + Anope::string sid = IRCD->SID_Retrieve(); if (server) { IRCD->SendSquit(server, rbuf); -- cgit From d6e600f74baede47c073dd4032eb7d6427421e0d Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 30 May 2014 10:54:54 -0400 Subject: Fix access check in ns_group --- modules/commands/ns_group.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index 9b3f425e9..11e4091cd 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -139,12 +139,12 @@ class CommandNSGroup : public Command Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick; source.Reply(NICK_X_SUSPENDED, target->nick.c_str()); } + else if (na && Config->GetModule(this->owner)->Get("nogroupchange")) + source.Reply(_("Your nick is already registered.")); else if (na && *target->nc == *na->nc) source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str()); else if (na && na->nc != u->Account()) source.Reply(NICK_IDENTIFY_REQUIRED); - else if (na && Config->GetModule(this->owner)->Get("nogroupchange")) - source.Reply(_("Your nick is already registered.")); else if (maxaliases && target->nc->aliases->size() >= maxaliases && !target->nc->IsServicesOper()) source.Reply(_("There are too many nicks in your group.")); else if (u->nick.length() <= guestnick.length() + 7 && @@ -156,7 +156,7 @@ class CommandNSGroup : public Command else { bool ok = false; - if (!na && u->Account()) + if (!na && u->Account() == target->nc) ok = true; NSCertList *cl = target->nc->GetExt("certificates"); -- cgit From 56c6ef4449b59f22533aaa80fa4fb7e19072b8ee Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 9 Jun 2014 16:36:49 -0400 Subject: Fix information leak in cs_updown --- modules/commands/cs_updown.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules/commands') diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp index b0488de26..4524a9831 100644 --- a/modules/commands/cs_updown.cpp +++ b/modules/commands/cs_updown.cpp @@ -81,6 +81,7 @@ class CommandCSUp : public Command } User *u = User::Find(nick, true); + User *srcu = source.GetUser(); bool override = false; if (u == NULL) @@ -88,6 +89,11 @@ class CommandCSUp : public Command source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); return; } + else if (srcu && !srcu->FindChannel(c)) + { + source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str()); + return; + } else if (!u->FindChannel(c)) { source.Reply(NICK_X_NOT_ON_CHAN, nick.c_str(), channel.c_str()); @@ -173,6 +179,7 @@ class CommandCSDown : public Command } User *u = User::Find(nick, true); + User *srcu = source.GetUser(); bool override = false; if (u == NULL) @@ -180,6 +187,11 @@ class CommandCSDown : public Command source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); return; } + else if (srcu && !srcu->FindChannel(c)) + { + source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str()); + return; + } else if (!u->FindChannel(c)) { source.Reply(NICK_X_NOT_ON_CHAN, nick.c_str(), channel.c_str()); -- cgit From 08edb15bea67599926ec83ae60ffe022135094c9 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 9 Jun 2014 16:44:15 -0400 Subject: Fix help log output example --- modules/commands/cs_log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp index 03342ebcf..ec6f102e7 100644 --- a/modules/commands/cs_log.cpp +++ b/modules/commands/cs_log.cpp @@ -271,7 +271,7 @@ public: "To remove a logging method use the same syntax as you would to add it.\n" " \n" "Example:\n" - " %s #anope chanserv/access MESSAGE @%\n" + " %s #anope chanserv/access MESSAGE @\n" " Would message any channel operators whenever someone used the\n" " ACCESS command on ChanServ on the channel."), source.command.upper().c_str(), source.command.upper().c_str()); -- cgit From 9a947fa4359c667be58ebae4634d9ac0e53d5db4 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 16 Jun 2014 20:41:07 -0400 Subject: Correct some language strings --- modules/commands/cs_info.cpp | 10 +++++----- modules/commands/cs_xop.cpp | 5 ----- modules/commands/ms_check.cpp | 2 +- modules/commands/ns_cert.cpp | 10 +++++----- 4 files changed, 11 insertions(+), 16 deletions(-) (limited to 'modules/commands') diff --git a/modules/commands/cs_info.cpp b/modules/commands/cs_info.cpp index af12aba78..48824669a 100644 --- a/modules/commands/cs_info.cpp +++ b/modules/commands/cs_info.cpp @@ -74,11 +74,11 @@ class CommandCSInfo : public Command this->SendSyntax(source); source.Reply(" "); source.Reply(_("Lists information about the named registered channel,\n" - "including its founder, time of registration, and last\n" - "time used. If the user issuing the command has the\n" - "appropriate access for it, then the description, successor,\n" - "last topic set, settings and expiration time will also\n" - "be displayed when applicable.")); + "including its founder, time of registration, last\n" + "time used, and description. If the user issuing the\n" + "command has the appropriate access for it, then the" + "successor, last topic set, settings and expiration" + "time will also be displayed when applicable.")); return true; } }; diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index 4c48dcc01..340369901 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -562,11 +562,6 @@ class CommandCSXOP : public Command "The \002%s CLEAR\002 command clears all entries of the\n" "%s list."), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str()); - source.Reply(_(" \n" - "The \002%s\002 commands are limited to founders\n" - "(unless SECUREOPS is off). However, any user on the\n" - "VOP list or above may use the \002%s LIST\002 command.\n" - " \n"), cmd.c_str(), cmd.c_str()); BotInfo *access_bi, *flags_bi; Anope::string access_cmd, flags_cmd; Command::FindCommandFromService("chanserv/access", access_bi, access_cmd); diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp index c0deabf65..6fab8919a 100644 --- a/modules/commands/ms_check.cpp +++ b/modules/commands/ms_check.cpp @@ -67,7 +67,7 @@ class CommandMSCheck : public Command this->SendSyntax(source); source.Reply(" "); source.Reply(_("Checks whether the _last_ memo you sent to \037nick\037 has been read\n" - "or not. Note that this does only work with nicks, not with channels.")); + "or not. Note that this only works with nicks, not with channels.")); return true; } }; diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index 81a782045..aedb816d2 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -318,19 +318,19 @@ class CommandNSCert : public Command source.Reply(" "); source.Reply(_("Modifies or displays the certificate list for your nick.\n" "If you connect to IRC and provide a client certificate with a\n" - "matching fingerprint in the cert list, your nick will be\n" + "matching fingerprint in the cert list, you will be\n" "automatically identified to services. Services Operators\n" "may provide a nick to modify other users' certificate lists.\n" " \n")); source.Reply(_("Examples:\n" " \n" - " \002CERT ADD \002\n" - " Adds this fingerprint to the certificate list and\n" + " \002CERT ADD\002\n" + " Adds your current fingerprint to the certificate list and\n" " automatically identifies you when you connect to IRC\n" - " using this certificate.\n" + " using this fingerprint.\n" " \n" " \002CERT DEL \002\n" - " Reverses the previous command.\n" + " Removes the fingerprint from your certificate list.\n" " \n" " \002CERT LIST\002\n" " Displays the current certificate list.")); -- cgit