From e67c2d563295701ac098bf186b7c1847f579f590 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 4 Jun 2021 02:12:09 +0100 Subject: Add support for per-mode list limits. --- modules/commands/cs_ban.cpp | 7 +++++-- modules/commands/cs_mode.cpp | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 113873d2c..648651dfa 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -42,10 +42,13 @@ 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"); + ChannelMode *cm = ModeManager::FindChannelModeByName(mode); + if (cm == NULL) + return; + const Anope::string &chan = params[0]; ChannelInfo *ci = ChannelInfo::Find(chan); if (ci == NULL) { @@ -59,7 +62,7 @@ class CommandCSBan : public Command source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); return; } - else if (IRCD->GetMaxListFor(c) && c->HasMode(mode) >= IRCD->GetMaxListFor(c)) + else if (IRCD->GetMaxListFor(c, cm) && c->HasMode(mode) >= IRCD->GetMaxListFor(c, cm)) { source.Reply(_("The %s list for %s is full."), mode.lower().c_str(), c->name.c_str()); return; diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index d5129fdc6..0f6378036 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -336,7 +336,7 @@ class CommandCSMode : public Command continue; } - if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c)) + if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c, cm) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c, cm)) { source.Reply(_("List for mode %c is full."), cm->mchar); continue; @@ -660,7 +660,7 @@ class CommandCSMode : public Command if (adding) { - if (IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) < IRCD->GetMaxListFor(ci->c)) + if (IRCD->GetMaxListFor(ci->c, cm) && ci->c->HasMode(cm->name) < IRCD->GetMaxListFor(ci->c, cm)) ci->c->SetMode(NULL, cm, param); } else -- cgit From 8d1bc95faf095984dcc39b4c51de5bc5051b9a12 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 4 Jun 2021 02:12:21 +0100 Subject: Use the InspIRCd-sent maxlist size instead of networkinfo:modelistsize. --- modules/protocol/inspircd3.cpp | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/protocol/inspircd3.cpp b/modules/protocol/inspircd3.cpp index 9d0a12969..e56b66b56 100644 --- a/modules/protocol/inspircd3.cpp +++ b/modules/protocol/inspircd3.cpp @@ -13,6 +13,8 @@ #include "modules/cs_mode.h" #include "modules/sasl.h" +typedef std::map ListLimits; + struct SASLUser { Anope::string uid; @@ -54,7 +56,9 @@ class InspIRCd3Proto : public IRCDProto } public: - InspIRCd3Proto(Module *creator) : IRCDProto(creator, "InspIRCd 3") + PrimitiveExtensibleItem maxlist; + + InspIRCd3Proto(Module *creator) : IRCDProto(creator, "InspIRCd 3"), maxlist(creator, "maxlist") { DefaultPseudoclientModes = "+I"; CanSVSNick = true; @@ -71,6 +75,20 @@ class InspIRCd3Proto : public IRCDProto MaxLine = 4096; } + unsigned GetMaxListFor(Channel *c, ChannelMode *cm) + { + ListLimits *limits = maxlist.Get(c); + if (limits) + { + ListLimits::const_iterator limit = limits->find(cm->mchar); + if (limit != limits->end()) + return limit->second; + } + + // Fall back to the config limit if we can't find the mode. + return IRCDProto::GetMaxListFor(c, cm); + } + void SendConnect() anope_override { UplinkSocket::Message() << "CAPAB START 1205"; @@ -1326,9 +1344,10 @@ class IRCDMessageMetadata : IRCDMessage { const bool &do_topiclock; const bool &do_mlock; + PrimitiveExtensibleItem &maxlist; public: - IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock) : IRCDMessage(creator, "METADATA", 3), do_topiclock(handle_topiclock), do_mlock(handle_mlock) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock, PrimitiveExtensibleItem &listlimits) : IRCDMessage(creator, "METADATA", 3), do_topiclock(handle_topiclock), do_mlock(handle_mlock), maxlist(listlimits) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector ¶ms) anope_override { @@ -1338,9 +1357,9 @@ class IRCDMessageMetadata : IRCDMessage if ((params[0][0] == '#') && (params.size() > 3) && (!source.GetServer()->IsSynced())) { Channel *c = Channel::Find(params[0]); - if (c && c->ci) + if (c) { - if ((do_mlock) && (params[2] == "mlock")) + if ((c->ci) && (do_mlock) && (params[2] == "mlock")) { ModeLocks *modelocks = c->ci->GetExt("modelocks"); Anope::string modes; @@ -1351,13 +1370,24 @@ class IRCDMessageMetadata : IRCDMessage if (modes != params[3]) UplinkSocket::Message(Me) << "METADATA " << c->name << " " << c->creation_time << " mlock :" << modes; } - else if ((do_topiclock) && (params[2] == "topiclock")) + else if ((c->ci) && (do_topiclock) && (params[2] == "topiclock")) { bool mystate = c->ci->HasExt("TOPICLOCK"); bool serverstate = (params[3] == "1"); if (mystate != serverstate) UplinkSocket::Message(Me) << "METADATA " << c->name << " " << c->creation_time << " topiclock :" << (mystate ? "1" : ""); } + else if (params[2] == "maxlist") + { + ListLimits limits; + spacesepstream limitstream(params[3]); + Anope::string modechr, modelimit; + while (limitstream.GetToken(modechr) && limitstream.GetToken(modelimit)) + { + limits.insert(std::make_pair(modechr[0], convertTo(modelimit))); + } + maxlist.Set(c, limits); + } } } else if (isdigit(params[0][0])) @@ -1866,7 +1896,7 @@ class ProtoInspIRCd3 : public Module message_part(this), message_privmsg(this), message_quit(this), message_stats(this), message_away(this), message_capab(this), message_encap(this), message_endburst(this), message_fhost(this), message_fident(this), message_fjoin(this), message_fmode(this), message_ftopic(this), message_idle(this), - message_ijoin(this), message_kick(this), message_metadata(this, use_server_side_topiclock, use_server_side_mlock), + message_ijoin(this), message_kick(this), message_metadata(this, use_server_side_topiclock, use_server_side_mlock, ircd_proto.maxlist), message_mode(this), message_nick(this), message_opertype(this), message_ping(this), message_rsquit(this), message_save(this), message_server(this), message_squit(this), message_time(this), message_uid(this) { -- cgit From fd88b756fc20dedea15a8a08c21e8f7af6612e4e Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Thu, 17 Jun 2021 10:02:30 -0400 Subject: Fix various spelling issues (#274). Signed-off-by: Josh Soref . --- modules/CMakeLists.txt | 2 +- modules/commands/bs_kick.cpp | 2 +- modules/commands/ns_cert.cpp | 2 +- modules/commands/ns_group.cpp | 2 +- modules/database/db_old.cpp | 2 +- modules/encryption/enc_sha256.cpp | 4 ++-- modules/extra/m_mysql.cpp | 2 +- modules/protocol/plexus.cpp | 2 +- modules/pseudoclients/botserv.cpp | 2 +- modules/webcpanel/templates/default/chanserv/set.html | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) (limited to 'modules') diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 7894b8c11..4b0fd6eec 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -117,7 +117,7 @@ macro(build_subdir) # Append this source file's linker flags to the subdirectoy's linker flags, if there are any to append if(TEMP_DEPENDENCIES) - append_to_list(SUBDIR_EXTRA_DEPENDS ${TEMP_DEPDENCIES}) + append_to_list(SUBDIR_EXTRA_DEPENDS ${TEMP_DEPENDENCIES}) endif(TEMP_DEPENDENCIES) endif(HAS_FUNCTION) endforeach(SRC ${MODULES_SUBDIR_SRCS}) diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index 90842df01..1a0ec73df 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -1335,7 +1335,7 @@ class BSKick : public Module Anope::string nbuf = Anope::NormalizeBuffer(realbuf); bool casesensitive = Config->GetModule("botserv")->Get("casesensitive"); - /* Normalize can return an empty string if this only conains control codes etc */ + /* Normalize can return an empty string if this only contains control codes etc */ if (badwords && !nbuf.empty()) for (unsigned i = 0; i < badwords->GetBadWordCount(); ++i) { diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index ab8957011..fec857109 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -55,7 +55,7 @@ struct NSCertListImpl : NSCertList /** Get an entry from the nick's cert list by index * - * @param entry Index in the certificaate list vector to retrieve + * @param entry Index in the certificate list vector to retrieve * @return The fingerprint entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds * * Retrieves an entry from the certificate list corresponding to the given index. diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index c68e53157..aa2865776 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -282,7 +282,7 @@ class CommandNSUngroup : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("This command ungroups your nick, or if given, the specificed nick,\n" + source.Reply(_("This command ungroups your nick, or if given, the specified nick,\n" "from the group it is in. The ungrouped nick keeps its registration\n" "time, password, email, greet, language, and url. Everything else\n" "is reset. You may not ungroup yourself if there is only one nick in\n" diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp index 1e48ec42a..bf756678a 100644 --- a/modules/database/db_old.cpp +++ b/modules/database/db_old.cpp @@ -340,7 +340,7 @@ static dbFILE *open_db_read(const char *service, const char *filename, int versi } else if (myversion < version) { - Log() << "Unsuported database version (" << myversion << ") on " << f->filename << "."; + Log() << "Unsupported database version (" << myversion << ") on " << f->filename << "."; delete f; return NULL; } diff --git a/modules/encryption/enc_sha256.cpp b/modules/encryption/enc_sha256.cpp index 8690d513b..b425d6b9d 100644 --- a/modules/encryption/enc_sha256.cpp +++ b/modules/encryption/enc_sha256.cpp @@ -288,8 +288,8 @@ class ESHA256 : public Module else use_iv = false; - Encryption::IV initilization(this->iv, 8); - SHA256Context ctx(&initilization); + Encryption::IV initialization(this->iv, 8); + SHA256Context ctx(&initialization); ctx.Update(reinterpret_cast(src.c_str()), src.length()); ctx.Finalize(); diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp index fa6d924da..dcac30ebd 100644 --- a/modules/extra/m_mysql.cpp +++ b/modules/extra/m_mysql.cpp @@ -24,7 +24,7 @@ using namespace SQL; * * This module spawns a single thread that is used to execute blocking MySQL queries. * When a module requests a query to be executed it is added to a list for the thread - * (which never stops looping and sleeing) to pick up and execute, the result of which + * (which never stops looping and sleeping) to pick up and execute, the result of which * is inserted in to another queue to be picked up by the main thread. The main thread * uses Pipe to become notified through the socket engine when there are results waiting * to be sent back to the modules requesting the query diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index b2c5d0528..e88e5b7b2 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -115,7 +115,7 @@ class PlexusProto : public IRCDProto * KNOCK - Supports KNOCK * TBURST - Supports TBURST * PARA - Supports invite broadcasting for +p - * ENCAP - Supports encapsulization of protocol messages + * ENCAP - Supports encapsulation of protocol messages * SVS - Supports services protocol extensions */ UplinkSocket::Message() << "CAPAB :QS EX CHW IE EOB KLN UNKLN GLN HUB KNOCK TBURST PARA ENCAP SVS"; diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp index cadcad4bb..6aa75919c 100644 --- a/modules/pseudoclients/botserv.cpp +++ b/modules/pseudoclients/botserv.cpp @@ -119,7 +119,7 @@ class BotServCore : public Module if (inhabit && inhabit->HasExt(c)) return; - /* This is called prior to removing the user from the channnel, so c->users.size() - 1 should be safe */ + /* This is called prior to removing the user from the channel, so c->users.size() - 1 should be safe */ if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->GetModule(this)->Get("minusers") && c->FindUser(c->ci->bi)) c->ci->bi->Part(c->ci->c); } diff --git a/modules/webcpanel/templates/default/chanserv/set.html b/modules/webcpanel/templates/default/chanserv/set.html index 050c37f69..9437ca71a 100644 --- a/modules/webcpanel/templates/default/chanserv/set.html +++ b/modules/webcpanel/templates/default/chanserv/set.html @@ -25,7 +25,7 @@ {END IF} {IF EXISTS SUCCESSOR} - Succsesor + Successor {SUCCESSOR} {END IF} -- cgit From 91321bdf682eb5b512373bb56c722f943cbc8183 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 24 Jul 2021 12:09:12 -0400 Subject: webcpanel: fix command source ip to use extforward ip --- modules/webcpanel/webcpanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/webcpanel/webcpanel.cpp b/modules/webcpanel/webcpanel.cpp index 16b61e673..f95307f22 100644 --- a/modules/webcpanel/webcpanel.cpp +++ b/modules/webcpanel/webcpanel.cpp @@ -268,7 +268,7 @@ namespace WebPanel my_reply(r, key); CommandSource source(user, NULL, nc, &my_reply, bi); - source.ip = client->clientaddr.addr(); + source.ip = client->GetIP(); CommandInfo info; info.name = c; @@ -308,7 +308,7 @@ namespace WebPanel my_reply(r, key); CommandSource source(nc->display, NULL, nc, &my_reply, bi); - source.ip = client->clientaddr.addr(); + source.ip = client->GetIP(); cmd->Run(source, cmdname, *info, params); } -- cgit