From 20e521a9eade796b119b5f7e7bde45541149915c Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 12 Jun 2013 18:11:51 +0200 Subject: m_spanningtree FJOIN handler: Merge and take maxmodes into consideration when applying non-prefix modes --- src/modules/m_spanningtree/fjoin.cpp | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index c0475613a..ee18c8e87 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -121,19 +121,38 @@ CmdResult CommandFJoin::Handle(const std::vector& params, User *src /* First up, apply their modes if they won the TS war */ if (apply_other_sides_modes) { - unsigned int idx = 2; + // Need to use a modestacker here due to maxmodes + irc::modestacker stack(true); + std::vector::const_iterator paramit = params.begin() + 3; + const std::vector::const_iterator lastparamit = ((params.size() > 3) ? (params.end() - 1) : params.end()); + for (std::string::const_iterator i = params[2].begin(); i != params[2].end(); ++i) + { + ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL); + if (!mh) + continue; + + std::string modeparam; + if ((paramit != lastparamit) && (mh->GetNumParams(true))) + { + modeparam = *paramit; + ++paramit; + } + + stack.Push(*i, modeparam); + } + std::vector modelist; // Mode parser needs to know what channel to act on. modelist.push_back(params[0]); - /* Remember, params[params.size() - 1] is nicklist, and we don't want to apply *that* */ - for (idx = 2; idx != (params.size() - 1); idx++) + while (stack.GetStackedLine(modelist)) { - modelist.push_back(params[idx]); + ServerInstance->Modes->Process(modelist, srcuser, true); + modelist.erase(modelist.begin() + 1, modelist.end()); } - ServerInstance->SendMode(modelist, srcuser); + ServerInstance->Modes->Process(modelist, srcuser, true); } /* Now, process every 'modes,nick' pair */ -- cgit v1.2.3 From 913724d7319bcd6883e3755224ce66b963de4bf4 Mon Sep 17 00:00:00 2001 From: ElementalAlchemist Date: Thu, 20 Jun 2013 14:26:22 -0300 Subject: Prevent m_cgiirc from blocking indefinitely, resulting in registration timeouts on e.g. Mibbit when webirc is not used --- src/modules/m_cgiirc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index d4ef602b3..ccbaaae32 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -207,8 +207,8 @@ class ModuleCgiIRC : public Module { bool cached; CGIResolver* r = new CGIResolver(this, cmd.notify, newip, user, (was_pass ? "PASS" : "IDENT"), cached, waiting); - ServerInstance->AddResolver(r, cached); waiting.set(user, waiting.get(user) + 1); + ServerInstance->AddResolver(r, cached); } catch (...) { -- cgit v1.2.3 From be23ca74e47887d5e4306a82c214db42fff0a944 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 9 Jul 2013 17:34:10 +0200 Subject: m_userip Fix incorrect "variable may be used uninitialized" warning shown by older GCC versions --- src/modules/m_userip.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index bfac36b1a..5ea84c04a 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -38,7 +38,7 @@ class CommandUserip : public Command std::string retbuf = "340 " + user->nick + " :"; int nicks = 0; bool checked_privs = false; - bool has_privs; + bool has_privs = false; for (int i = 0; i < (int)parameters.size(); i++) { -- cgit v1.2.3 From 561f4f642e5bc391300dd33989c3624986808ed8 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 16 Jul 2013 22:30:18 +0200 Subject: m_ssl_openssl Fix inverted check that prevented certificates from being recognized as trusted --- src/modules/extra/m_ssl_openssl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index b63fcd376..7b7de023c 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -615,7 +615,7 @@ class ModuleSSLOpenSSL : public Module certinfo->invalid = (SSL_get_verify_result(session->sess) != X509_V_OK); - if (SelfSigned) + if (!SelfSigned) { certinfo->unknownsigner = false; certinfo->trusted = true; -- cgit v1.2.3 From 1be212b865b3cab816cd3cb49b527add3cac6826 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 26 Jul 2013 07:33:45 -0400 Subject: Use server ids when propagating squits --- src/modules/m_spanningtree/treesocket1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 6582ba060..cb2c93548 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -189,9 +189,9 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) if (!Current->GetSocket() || Current->GetSocket()->Introduced()) { parameterlist params; - params.push_back(Current->GetName()); + params.push_back(Current->GetID()); params.push_back(":"+reason); - Utils->DoOneToAllButSender(Current->GetParent()->GetName(),"SQUIT",params,Current->GetName()); + Utils->DoOneToAllButSender(Current->GetParent()->GetID(),"SQUIT",params,Current->GetID()); } if (Current->GetParent() == Utils->TreeRoot) -- cgit v1.2.3 From 5f223beeaee91d8827454475c4ef6f679af4385d Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 13 Aug 2013 14:10:04 +0200 Subject: m_ssl_gnutls Fix feature testing and cipher suite related errors on older GnuTLS versions Use the (old) LIBGNUTLS_VERSION_* defines as a fallback when GNUTLS_VERSION_* is unavailable Fixes #595 reported by @rhylan --- src/modules/extra/m_ssl_gnutls.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 41e9d0c3d..1f1297ef9 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -44,8 +44,14 @@ /* $LinkerFlags: rpath("pkg-config --libs gnutls") pkgconflibs("gnutls","/libgnutls.so","-lgnutls") exec("libgcrypt-config --libs") */ /* $NoPedantic */ +#ifndef GNUTLS_VERSION_MAJOR +#define GNUTLS_VERSION_MAJOR LIBGNUTLS_VERSION_MAJOR +#define GNUTLS_VERSION_MINOR LIBGNUTLS_VERSION_MINOR +#define GNUTLS_VERSION_PATCH LIBGNUTLS_VERSION_PATCH +#endif + // These don't exist in older GnuTLS versions -#if ((GNUTLS_VERSION_MAJOR > 2) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR > 1) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR == 1 && GNUTLS_VERSION_MICRO >= 7)) +#if ((GNUTLS_VERSION_MAJOR > 2) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR > 1) || (GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR == 1 && GNUTLS_VERSION_PATCH >= 7)) #define GNUTLS_NEW_PRIO_API #endif @@ -570,6 +576,8 @@ class ModuleSSLGnuTLS : public Module #ifdef GNUTLS_NEW_PRIO_API gnutls_priority_set(session->sess, priority); + #else + gnutls_set_default_priority(session->sess); #endif gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred); gnutls_dh_set_prime_bits(session->sess, dh_bits); -- cgit v1.2.3 From 3afddb6a34ec7be67d5e9f49de1919ac40770d73 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 21 Aug 2013 16:35:29 +0200 Subject: m_dnsbl Fix possible use-after-free after a rehash --- src/modules/m_dnsbl.cpp | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 5e02dd0a5..3a9360380 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -27,7 +27,7 @@ /* $ModDesc: Provides handling of DNS blacklists */ /* Class holding data for a single entry */ -class DNSBLConfEntry +class DNSBLConfEntry : public refcountbase { public: enum EnumBanaction { I_UNKNOWN, I_KILL, I_ZLINE, I_KLINE, I_GLINE, I_MARK }; @@ -51,11 +51,11 @@ class DNSBLResolver : public Resolver std::string theiruid; LocalStringExt& nameExt; LocalIntExt& countExt; - DNSBLConfEntry *ConfEntry; + reference ConfEntry; public: - DNSBLResolver(Module *me, LocalStringExt& match, LocalIntExt& ctr, const std::string &hostname, LocalUser* u, DNSBLConfEntry *conf, bool &cached) + DNSBLResolver(Module *me, LocalStringExt& match, LocalIntExt& ctr, const std::string &hostname, LocalUser* u, reference conf, bool &cached) : Resolver(hostname, DNS_QUERY_A, cached, me), theiruid(u->uuid), nameExt(match), countExt(ctr), ConfEntry(conf) { } @@ -209,7 +209,7 @@ class DNSBLResolver : public Resolver class ModuleDNSBL : public Module { - std::vector DNSBLConfEntries; + std::vector > DNSBLConfEntries; LocalStringExt nameExt; LocalIntExt countExt; @@ -243,36 +243,22 @@ class ModuleDNSBL : public Module ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual ~ModuleDNSBL() - { - ClearEntries(); - } - Version GetVersion() { return Version("Provides handling of DNS blacklists", VF_VENDOR); } - /** Clear entries and free the mem it was using - */ - void ClearEntries() - { - for (std::vector::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++) - delete *i; - DNSBLConfEntries.clear(); - } - /** Fill our conf vector with data */ void ReadConf() { - ClearEntries(); + DNSBLConfEntries.clear(); ConfigTagList dnsbls = ServerInstance->Config->ConfTags("dnsbl"); for(ConfigIter i = dnsbls.first; i != dnsbls.second; ++i) { ConfigTag* tag = i->second; - DNSBLConfEntry *e = new DNSBLConfEntry(); + reference e = new DNSBLConfEntry(); e->name = tag->getString("name"); e->ident = tag->getString("ident"); @@ -337,11 +323,7 @@ class ModuleDNSBL : public Module /* add it, all is ok */ DNSBLConfEntries.push_back(e); - continue; } - - /* delete and drop it, error somewhere */ - delete e; } } @@ -420,7 +402,7 @@ class ModuleDNSBL : public Module unsigned long total_hits = 0, total_misses = 0; - for (std::vector::iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); i++) + for (std::vector >::const_iterator i = DNSBLConfEntries.begin(); i != DNSBLConfEntries.end(); ++i) { total_hits += (*i)->stats_hits; total_misses += (*i)->stats_misses; -- cgit v1.2.3 From d3b6538f955e824d46141f64fc081ce19fc081ef Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 21 Aug 2013 16:38:33 +0200 Subject: m_spanningtree When an IOHook goes away close all pending connections that use it --- src/modules/m_spanningtree/main.cpp | 7 +++++++ src/modules/m_spanningtree/utils.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 7c93e7d45..ce1792a02 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -815,6 +815,13 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod) sock->Close(); } } + + for (SpanningTreeUtilities::TimeoutList::const_iterator i = Utils->timeoutlist.begin(); i != Utils->timeoutlist.end(); ++i) + { + TreeSocket* sock = i->first; + if (sock->GetIOHook() == mod) + sock->Close(); + } } // note: the protocol does not allow direct umode +o except diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 92a03428f..a0543b6bd 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -50,6 +50,8 @@ typedef std::map TreeServerList; class SpanningTreeUtilities : public classbase { public: + typedef std::map > TimeoutList; + /** Creator module */ ModuleSpanningTree* Creator; @@ -90,7 +92,7 @@ class SpanningTreeUtilities : public classbase server_hash sidlist; /** List of all outgoing sockets and their timeouts */ - std::map > timeoutlist; + TimeoutList timeoutlist; /** Holds the data from the tags in the conf */ std::vector > LinkBlocks; -- cgit v1.2.3 From 00cd97160ae8909ca12b8807a8114cad1f6a06b1 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 27 Aug 2013 18:30:59 +0200 Subject: Update example configs, README.md and more - Fix typos, remove misleading information, rephrase a few sentences - Add info about hmac- hash types - Remove (the code which used this was removed in 96e4434 - @SaberUK) - Change inspircd.github.org to inspircd.org --- README.md | 4 +- docs/conf/censor.conf.example | 8 +-- docs/conf/filter.conf.example | 2 +- docs/conf/helpop-full.conf.example | 2 +- docs/conf/helpop.conf.example | 2 +- docs/conf/inspircd.conf.example | 22 +++---- docs/conf/links.conf.example | 7 +-- docs/conf/modules.conf.example | 98 ++++++++++++++----------------- docs/conf/modules/charybdis.conf.example | 24 +++----- docs/conf/modules/unrealircd.conf.example | 28 ++++----- docs/conf/motd.txt.example | 2 +- docs/conf/opermotd.txt.example | 2 +- docs/conf/opers.conf.example | 14 +++-- src/modules/m_ircv3.cpp | 2 +- 14 files changed, 93 insertions(+), 124 deletions(-) (limited to 'src/modules') diff --git a/README.md b/README.md index 2f77c5c15..caadad82d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,6 @@ many different users. ### Links -* [Website](http://inspircd.github.com) -* [GitHub]( https://github.com/inspircd) +* [Website](http://inspircd.org) +* [GitHub](https://github.com/inspircd) * [IRC](irc://irc.chatspike.net/inspircd) \ No newline at end of file diff --git a/docs/conf/censor.conf.example b/docs/conf/censor.conf.example index 342ccd875..ea9e08147 100644 --- a/docs/conf/censor.conf.example +++ b/docs/conf/censor.conf.example @@ -1,11 +1,9 @@ -# Configuration file for m_censor.so (1.0.0.0) -# C.J.Edwards May 2004. -# +# Configuration file for m_censor.so # The tags for this module are formatted as follows: # -# +# # # You can specify # to block lines containing the word diff --git a/docs/conf/filter.conf.example b/docs/conf/filter.conf.example index 922f55fb6..8f5d20c24 100644 --- a/docs/conf/filter.conf.example +++ b/docs/conf/filter.conf.example @@ -1,4 +1,4 @@ -# Configuration file for m_filter.so and m_filter_pcre.so +# Configuration file for m_filter.so # The tags for this module are formatted as follows: # diff --git a/docs/conf/helpop-full.conf.example b/docs/conf/helpop-full.conf.example index bc9326e62..1b33004c4 100644 --- a/docs/conf/helpop-full.conf.example +++ b/docs/conf/helpop-full.conf.example @@ -764,7 +764,7 @@ Closes all unregistered connections to the local server."> c Blocks private messages and notices from users who do not share a common channel with you (requires commonchans module). - d Deaf mode. User will not recieve any messages or notices + d Deaf mode. User will not receive any messages or notices from channels they are in (requires deaf module). g In combination with /allow, provides for server side ignore (requires callerid module). diff --git a/docs/conf/helpop.conf.example b/docs/conf/helpop.conf.example index 02ddff8a2..2cccc5a2c 100644 --- a/docs/conf/helpop.conf.example +++ b/docs/conf/helpop.conf.example @@ -77,7 +77,7 @@ LOCKSERV UNLOCKSERV JUMPSERVER"> c Blocks private messages and notices from users who do not share a common channel with you (requires commonchans module). - d Deaf mode. User will not recieve any messages or notices + d Deaf mode. User will not receive any messages or notices from channels they are in (requires deaf module). g In combination with /allow, provides for server side ignore (requires callerid module). diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index ca61bb416..9512e17c4 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -132,12 +132,9 @@ # |_| \_\___|\__,_|\__,_| |_| |_| |_|_|___/ |____/|_|\__(_) # # # # If you want to link servers to InspIRCd you must load the # -# m_spanningtree.so module! Please see the modules list below for # +# m_spanningtree.so module! Please see the modules list for # # information on how to load this module! If you do not load this # -# module, server ports will NOT be bound! # -# # -# PLEASE NOTE: If you have build InspIRCd with IPv6 support, you MUST # -# specify a bind address if you want the IRCd to bind to a IPv4 IP. # +# module, server ports will NOT work! # #hash="sha256" @@ -626,13 +625,10 @@ # # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Block color module: Blocking color-coded messages with cmode +c +# Block color module: Blocking color-coded messages with chan mode +c # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -274,7 +274,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # CallerID module: Adds usermode +g which activates hybrid-style -# callerid (== block all private messages unless you /accept first) +# callerid: block all private messages unless you /accept first # # #-#-#-#-#-#-#-#-#-#-#- CALLERID CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# @@ -398,7 +398,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Channel Names module: Allows disabling channels which have certain -# characters in the channel name such as bold, colorcodes, etc which +# characters in the channel name such as bold, colorcodes, etc. which # can be quite annoying and allow users to on occasion have a channel # that looks like the name of another channel on the network. # @@ -530,8 +530,8 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Clones module: Adds an oper command /CLONES for detecting cloned -# users. Warning: This module may be resource intensive when its -# command is issued, use with care. +# users. Warning: This command may be resource intensive when it is +# issued, use with care. # This module is oper-only. # To use, CLONES must be in one of your oper class blocks. # @@ -580,7 +580,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Channel cycle module. Server side /hop, with +ilk etc bypass. +# Channel cycle module. Server side /hop, with +ilk etc. bypass. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -619,8 +619,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Custom prefixes: allows for channel prefixes to be added. -# This can replace m_chanprotect and m_halfop, except for services that -# recognise those modules by name +# This replaces m_chanprotect and m_halfop. # # # name The name of the mode, must be unique from other modes @@ -631,9 +630,11 @@ # ranktoset The numeric rank required to set/unset this mode. Defaults to rank. # depriv Can you remove the mode from yourself? Defaults to yes. # -# +# # # +# +# Do /reloadmodule m_customprefix.so after changing the settings of this module. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Custom title module: Adds the /TITLE command which allows for trusted @@ -722,7 +723,7 @@ # Glob masks are accepted here also. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Devoice Module: Let users devoice themselves. +# Devoice Module: Let users devoice themselves using /devoice #chan. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -829,7 +830,7 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# HIDECHANS module: Allows opers to hide their channels list from non- +# HIDECHANS module: Allows users to hide their channels list from non- # opers by setting user mode +I on themselves. # # @@ -937,7 +938,7 @@ # # The following block can be used to control which extensions are # enabled. -# +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Join flood module: Adds support for join flood protection (+j) @@ -1073,7 +1074,7 @@ # are specified in a tag that the oper is part of. This is so # # you can control who has access to this possible dangerous command. # # If your server is locked and you get disconnected, do a REHASH from # -# shell to open up again. +# shell to open up again. # # # This module is oper-only. # @@ -1082,7 +1083,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Map hiding module: replaces /MAP and /LINKS output to users with a # # message to see a website, set by maphide="http://link.to/site" in # -# the security tag, instead. # +# the tag, instead. # # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1175,10 +1176,10 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# No nicks module: Adds the +N channel mode, as well as the +b N: -# extended bantype. +N stops all users from changing their nick, -# the +b N: extban stops anyone from matching a +b N:nick!user@host -# mask from changing their nick. +# No nicks module: Adds the +N channel mode, as well as the N extban. +# +N stops all users from changing their nick, the N extban stops +# anyone from matching a +b N:nick!user@host mask from changing their +# nick. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1192,7 +1193,7 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Network buisness join module +# Network business join module # Allows an oper to join a channel using /OJOIN, giving them +Y on the # channel which makes them immune to kick/deop/etc. # @@ -1224,7 +1225,7 @@ # If you are using the m_operjoin.so module, specify options here: # # # # channel - The channel name to join, can also be a comma # -# seperated list eg. "#channel1,#channel2". # +# separated list eg. "#channel1,#channel2". # # # # override - Lets the oper join walking thru any modes that # # might be set, even bans. Use "yes" or "no". # @@ -1256,7 +1257,7 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Oper MOTD module: Provides support for seperate message of the day +# Oper MOTD module: Provides support for separate message of the day # on oper-up # This module is oper-only. # @@ -1288,7 +1289,7 @@ # Oper levels module: Gives each oper a level and prevents # actions being taken against higher level opers # Specify the level as the 'level' parameter of the tag -# # This module is oper-only. +# This module is oper-only. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1315,7 +1316,7 @@ # You can also use $user for the user ident string. forwardmsg="NOTICE $nick :*** Forwarding PASS to $nickrequired" - # cmd: Command for the nick to run when it recieves a connect + # cmd: Command for the nick to run when it receives a connect # password. cmd="PRIVMSG $nickrequired :IDENTIFY $pass"> @@ -1395,7 +1396,7 @@ # Optional - If you specify to use the m_randquote.so module, then # # specify below the path to the randquotes.conf file. # # # -# +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Redirect module: Adds channel redirection (mode +L) # @@ -1427,8 +1428,8 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Regular Expression Provider for POSIX Regular Expressions. # You shouldn't need any additional libraries on a POSIX-compatible -# system (ie: any Linux, BSD, but not Windows). You must have at least -# 1 provider loaded to use m_filter or m_rline. +# system (i.e.: any Linux, BSD, but not Windows). You must have at +# least 1 provider loaded to use m_filter or m_rline. # On POSIX-compliant systems, regex syntax can be found by using the # command: 'man 7 regex'. # @@ -1597,7 +1598,7 @@ # and is similar in operation to the way asuka and ircu handle services. # # At the same time, this offers +r for users and channels to mark them -# as identified seperately from the idea of a master account, which +# as identified separately from the idea of a master account, which # can be useful for services which are heavily nick-as-account centric. # # This replaces m_services from 1.1 and earlier. @@ -1624,8 +1625,6 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # SETNAME module: Adds the /SETNAME command -# This module is oper-only. -# To use, SETNAME must be in one of your oper class blocks. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1645,7 +1644,7 @@ # it directly affects the mode object itself. # @@ -1671,20 +1670,16 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# GnuTLS ssl module: Adds support for client-server SSL using GnuTLS, -# if enabled. You must copy the source for this module from the directory -# src/modules/extra, or answer 'yes' in ./configure when asked if you -# want to enable this, or it will not load. +# GnuTLS SSL module: Adds support for SSL connections using GnuTLS, +# if enabled. You must answer 'yes' in ./configure when asked or +# manually symlink the source for this module from the directory +# src/modules/extra, if you want to enable this, or it will not load. # # #-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# # # # m_ssl_gnutls.so is too complex it describe here, see the wiki: # # http://wiki.inspircd.org/Modules/ssl_gnutls # -# # -# NOTE: If you want to use this module to encrypt and sign your # -# server to server traffic, you MUST load it before m_spanningtree in # -# your configuration file! # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # SSL Info module: Allows users to retrieve information about other @@ -1702,20 +1697,16 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# OpenSSL ssl module: Adds support for client-server SSL using OpenSSL, -# if enabled. You must copy the source for this module from the directory -# src/modules/extra, or answer 'yes' in ./configure when asked if you -# want to enable this, or it will not load. +# OpenSSL SSL module: Adds support for SSL connections using OpenSSL, +# if enabled. You must answer 'yes' in ./configure when asked or symlink +# the source for this module from the directory src/modules/extra, if +# you want to enable this, or it will not load. # # #-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# # # # m_ssl_openssl.so is too complex it describe here, see the wiki: # # http://wiki.inspircd.org/Modules/ssl_openssl # -# # -# NOTE: If you want to use this module to encrypt and sign your # -# server to server traffic, you MUST load it before m_spanningtree in # -# your configuration file! # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Strip color module: Adds the channel mode +S @@ -1798,7 +1789,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Test line module: Adds the /TLINE command, used to test how many -# users a /GLINE or /ZLINE etc would match. +# users a /GLINE or /ZLINE etc. would match. # This module is oper-only. # To use, TLINE must be in one of your oper class blocks. # @@ -1811,10 +1802,9 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # UHNAMES support module: Adds support for the IRCX style UHNAMES # extension, which displays ident and hostname in the names list for -# each user, saving clients from doing a WHO on the channel. Note that -# this module is not widely supported yet. If a client does not support -# UHNAMES it will not enable it, this will not break incompatible -# clients. +# each user, saving clients from doing a WHO on the channel. +# If a client does not support UHNAMES it will not enable it, this will +# not break incompatible clients. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# @@ -1824,8 +1814,8 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Userip module: Adds the /USERIP command -# This module is oper-only. -# To use, USERIP must be in one of your oper class blocks. +# Allows users to query their own IP, also allows opers to query the IP +# of anyone else. # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# diff --git a/docs/conf/modules/charybdis.conf.example b/docs/conf/modules/charybdis.conf.example index 4490d5482..b456278bb 100644 --- a/docs/conf/modules/charybdis.conf.example +++ b/docs/conf/modules/charybdis.conf.example @@ -257,20 +257,16 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# GnuTLS ssl module: Adds support for client-server SSL using GnuTLS, -# if enabled. You must copy the source for this module from the directory -# src/modules/extra, or answer 'yes' in ./configure when asked if you -# want to enable this, or it will not load. +# GnuTLS SSL module: Adds support for SSL connections using GnuTLS, +# if enabled. You must answer 'yes' in ./configure when asked or +# manually symlink the source for this module from the directory +# src/modules/extra, if you want to enable this, or it will not load. # # #-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# # # # m_ssl_gnutls.so is too complex it describe here, see the wiki: # # http://wiki.inspircd.org/Modules/ssl_gnutls # -# # -# NOTE: If you want to use this module to encrypt and sign your # -# server to server traffic, you MUST load it before m_spanningtree in # -# your configuration file! # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # SSL Info module: Allows users to retrieve information about other @@ -288,20 +284,16 @@ # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# OpenSSL ssl module: Adds support for client-server SSL using OpenSSL, -# if enabled. You must copy the source for this module from the directory -# src/modules/extra, or answer 'yes' in ./configure when asked if you -# want to enable this, or it will not load. +# OpenSSL SSL module: Adds support for SSL connections using OpenSSL, +# if enabled. You must answer 'yes' in ./configure when asked or symlink +# the source for this module from the directory src/modules/extra, if +# you want to enable this, or it will not load. # # #-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# # # # m_ssl_openssl.so is too complex it describe here, see the wiki: # # http://wiki.inspircd.org/Modules/ssl_openssl # -# # -# NOTE: If you want to use this module to encrypt and sign your # -# server to server traffic, you MUST load it before m_spanningtree in # -# your configuration file! # diff --git a/docs/conf/modules/unrealircd.conf.example b/docs/conf/modules/unrealircd.conf.example index fa5d652f1..65896808f 100644 --- a/docs/conf/modules/unrealircd.conf.example +++ b/docs/conf/modules/unrealircd.conf.example @@ -248,7 +248,7 @@ # If you are using the m_operjoin.so module, specify options here: # # # # channel - The channel name to join, can also be a comma # -# seperated list eg. "#channel1,#channel2". # +# separated list eg. "#channel1,#channel2". # # # # override - Lets the oper join walking thru any modes that # # might be set, even bans. Use "yes" or "no". # @@ -263,7 +263,7 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# Oper MOTD module: Provides support for seperate message of the day +# Oper MOTD module: Provides support for separate message of the day # on oper-up # This module is oper-only. # @@ -374,38 +374,30 @@ #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# GnuTLS ssl module: Adds support for client-server SSL using GnuTLS, -# if enabled. You must copy the source for this module from the directory -# src/modules/extra, or answer 'yes' in ./configure when asked if you -# want to enable this, or it will not load. +# GnuTLS SSL module: Adds support for SSL connections using GnuTLS, +# if enabled. You must answer 'yes' in ./configure when asked or symlink +# the source for this module from the directory src/modules/extra, if +# you want to enable this, or it will not load. # # #-#-#-#-#-#-#-#-#-#-#- GNUTLS CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# # # # m_ssl_gnutls.so is too complex it describe here, see the wiki: # # http://wiki.inspircd.org/Modules/ssl_gnutls # -# # -# NOTE: If you want to use this module to encrypt and sign your # -# server to server traffic, you MUST load it before m_spanningtree in # -# your configuration file! # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# OpenSSL ssl module: Adds support for client-server SSL using OpenSSL, -# if enabled. You must copy the source for this module from the directory -# src/modules/extra, or answer 'yes' in ./configure when asked if you -# want to enable this, or it will not load. +# OpenSSL SSL module: Adds support for SSL connections using OpenSSL, +# if enabled. You must answer 'yes' in ./configure when asked or symlink +# the source for this module from the directory src/modules/extra, if +# you want to enable this, or it will not load. # # #-#-#-#-#-#-#-#-#-#-#- OPENSSL CONFIGURATION -#-#-#-#-#-#-#-#-#-#-#-# # # # m_ssl_openssl.so is too complex it describe here, see the wiki: # # http://wiki.inspircd.org/Modules/ssl_openssl # -# # -# NOTE: If you want to use this module to encrypt and sign your # -# server to server traffic, you MUST load it before m_spanningtree in # -# your configuration file! # diff --git a/docs/conf/motd.txt.example b/docs/conf/motd.txt.example index 70830b8da..66fddd344 100644 --- a/docs/conf/motd.txt.example +++ b/docs/conf/motd.txt.example @@ -29,7 +29,7 @@ / * Web: http://www.inspircd.org \ | * IRC: irc.inspircd.org #inspircd | | * Docs: http://wiki.inspircd.org | - | * Bugs: http://inspircd.github.com/bugs | + | * Bugs: http://inspircd.org/bugs | | | | We hope you like this software. Please do | | make sure you put some effort into | diff --git a/docs/conf/opermotd.txt.example b/docs/conf/opermotd.txt.example index c91b36a2b..110cba8e4 100644 --- a/docs/conf/opermotd.txt.example +++ b/docs/conf/opermotd.txt.example @@ -29,7 +29,7 @@ / * Web: http://www.inspircd.org \ | * IRC: irc.inspircd.org #inspircd | | * Docs: http://wiki.inspircd.org | - | * Bugs: http://inspircd.github.com/bugs | + | * Bugs: http://inspircd.org/bugs | | | | We hope you like this software. Please do | | make sure you put some effort into | diff --git a/docs/conf/opers.conf.example b/docs/conf/opers.conf.example index 1e5abefa5..6cd00a409 100644 --- a/docs/conf/opers.conf.example +++ b/docs/conf/opers.conf.example @@ -27,9 +27,9 @@ # - channels/high-join-limit: allows opers with this priv to join total channels instead of total channels. # PERMISSIONS: # - users/flood/no-throttle: allows opers with this priv to send commands without being throttled (*NOTE) - # - users/flood/increased-buffers: allows opers with this priv to send and recieve data without worrying about being disconnected for exceeding limits (*NOTE) + # - users/flood/increased-buffers: allows opers with this priv to send and receive data without worrying about being disconnected for exceeding limits (*NOTE) # - # *NOTE: These privs are potantially dangerous, as they grant users with them the ability to hammer your server's CPU/RAM as much as they want, essentially. + # *NOTE: These privs are potentially dangerous, as they grant users with them the ability to hammer your server's CPU/RAM as much as they want, essentially. privs="users/auspex channels/auspex servers/auspex users/mass-message channels/high-join-limit users/flood/no-throttle users/flood/increased-buffers" # usermodes: Oper-only usermodes that opers with this class can use. @@ -138,10 +138,12 @@ # Remember: This is case sensitive name="Brain" - # hash: what hash this password is hashed with. requires the module - # for selected hash (m_md5.so, m_sha256.so or m_ripemd160.so) be - # loaded and the password hashing module (m_password_hash.so) - # loaded. Options here are: "md5", "sha256" and "ripemd160". + # hash: what hash this password is hashed with. + # Requires the module for selected hash (m_md5.so, m_sha256.so + # or m_ripemd160.so) be loaded and the password hashing module + # (m_password_hash.so) loaded. + # Options here are: "md5", "sha256" and "ripemd160", or one of + # these prefixed with "hmac-", e.g.: "hmac-sha256". # Create hashed password with: /mkpasswd hash="sha256" diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp index b0e020c63..da42d823d 100644 --- a/src/modules/m_ircv3.cpp +++ b/src/modules/m_ircv3.cpp @@ -88,7 +88,7 @@ class ModuleIRCv3 : public Module void OnRehash(User* user) { ConfigTag* conf = ServerInstance->Config->ConfValue("ircv3"); - accountnotify = conf->getBool("accoutnotify", true); + accountnotify = conf->getBool("accountnotify", conf->getBool("accoutnotify", true)); awaynotify = conf->getBool("awaynotify", true); extendedjoin = conf->getBool("extendedjoin", true); } -- cgit v1.2.3 From b55c842c9d8730e50865fb7dd98bce4aa85af0d7 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 9 Jul 2013 19:49:10 +0200 Subject: m_permchannels Construct the final line that will be saved in a std::string in WriteDatabase() --- src/modules/m_permchannels.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index a59518b28..bd65c5822 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -51,13 +51,13 @@ static bool WriteDatabase() fputs("# Permchannels DB\n# This file is autogenerated; any changes will be overwritten!\n\n", f); // Now, let's write. + std::string line; for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); i++) { Channel* chan = i->second; if (!chan->IsModeSet('P')) continue; - char line[1024]; const char* items[] = { "\n" }; - int lpos = 0, item = 0, ipos = 0; - while (lpos < 1022 && item < 7) + line.clear(); + int item = 0, ipos = 0; + while (item < 7) { char c = items[item][ipos++]; if (c == 0) @@ -82,12 +83,14 @@ static bool WriteDatabase() } else if (c == '\\' || c == '"') { - line[lpos++] = '\\'; + line += '\\'; } - line[lpos++] = c; + line += c; } - line[--lpos] = 0; - fputs(line, f); + + // Erase last '"' + line.erase(line.end()-1); + fputs(line.c_str(), f); } int write_error = 0; -- cgit v1.2.3 From 86f8294c2de86b8d060abbb02f7c51c0ca0d9ead Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 9 Jul 2013 20:01:03 +0200 Subject: m_permchannels Save channel TS, topic set time and set by information When loading, ignore and log channels with a name longer than Limits.MaxChan --- src/modules/m_permchannels.cpp | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index bd65c5822..1bcb2ac17 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -58,12 +58,20 @@ static bool WriteDatabase() if (!chan->IsModeSet('P')) continue; + std::string chants = ConvToStr(chan->age); + std::string topicts = ConvToStr(chan->topicset); const char* items[] = { "\n" @@ -71,7 +79,7 @@ static bool WriteDatabase() line.clear(); int item = 0, ipos = 0; - while (item < 7) + while (item < 13) { char c = items[item][ipos++]; if (c == 0) @@ -222,9 +230,9 @@ public: std::string topic = tag->getString("topic"); std::string modes = tag->getString("modes"); - if (channel.empty()) + if ((channel.empty()) || (channel.length() > ServerInstance->Config->Limits.ChanMax)) { - ServerInstance->Logs->Log("m_permchannels", DEBUG, "Malformed permchannels tag with empty channel name."); + ServerInstance->Logs->Log("m_permchannels", DEFAULT, "Ignoring permchannels tag with empty or too long channel name (\"" + channel + "\")"); continue; } @@ -232,19 +240,16 @@ public: if (!c) { - c = new Channel(channel, ServerInstance->Time()); - if (!topic.empty()) - { - c->SetTopic(NULL, topic, true); - - /* - * Due to the way protocol works in 1.2, we need to hack the topic TS in such a way that this - * topic will always win over others. - * - * This is scheduled for (proper) fixing in a later release, and can be removed at a later date. - */ - c->topicset = 42; - } + time_t TS = tag->getInt("ts"); + c = new Channel(channel, ((TS > 0) ? TS : ServerInstance->Time())); + + c->SetTopic(NULL, topic, true); + c->setby = tag->getString("topicsetby"); + unsigned int topicset = tag->getInt("topicts"); + // SetTopic() sets the topic TS to now, if there was no topicts saved then don't overwrite that with a 0 + if (topicset > 0) + c->topicset = topicset; + ServerInstance->Logs->Log("m_permchannels", DEBUG, "Added %s with topic %s", channel.c_str(), topic.c_str()); if (modes.empty()) -- cgit v1.2.3 From 261d5bb566f6383efea99e73c933a2af6f408341 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Tue, 9 Jul 2013 20:21:33 +0200 Subject: m_permchannels Add the ability to save listmodes --- docs/conf/modules.conf.example | 4 ++- src/modules/m_permchannels.cpp | 74 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 73 insertions(+), 5 deletions(-) (limited to 'src/modules') diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 71cc9e8c6..54a667f34 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -1357,7 +1357,9 @@ # whenever +P is set, unset, or the topic/modes on a +P channel is changed. # If you want to do this, set the filename below, and uncomment the include. # -# +# If 'listmodes' is true then all list modes (+b, +I, +e, +g...) will be +# saved. Defaults to false. +# # # # You may also create channels on startup by using the block. diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 1bcb2ac17..04171585b 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -22,9 +22,15 @@ /* $ModDesc: Provides support for channel mode +P to provide permanent channels */ +struct ListModeData +{ + std::string modes; + std::string params; +}; + // Not in a class due to circular dependancy hell. static std::string permchannelsconf; -static bool WriteDatabase() +static bool WriteDatabase(Module* mod, bool save_listmodes) { FILE *f; @@ -58,6 +64,44 @@ static bool WriteDatabase() if (!chan->IsModeSet('P')) continue; + std::string chanmodes = chan->ChanModes(true); + if (save_listmodes) + { + ListModeData lm; + + // Bans are managed by the core, so we have to process them separately + lm.modes = std::string(chan->bans.size(), 'b'); + for (BanList::const_iterator j = chan->bans.begin(); j != chan->bans.end(); ++j) + { + lm.params += j->data; + lm.params += ' '; + } + + // All other listmodes are managed by modules, so we need to ask them (call their + // OnSyncChannel() handler) to give our ProtoSendMode() a list of modes that are + // set on the channel. The ListModeData struct is passed as an opaque pointer + // that will be passed back to us by the module handling the mode. + FOREACH_MOD(I_OnSyncChannel, OnSyncChannel(chan, mod, &lm)); + + if (!lm.modes.empty()) + { + // Remove the last space + lm.params.erase(lm.params.end()-1); + + // If there is at least a space in chanmodes (that is, a non-listmode has a parameter) + // insert the listmode mode letters before the space. Otherwise just append them. + std::string::size_type p = chanmodes.find(' '); + if (p == std::string::npos) + chanmodes += lm.modes; + else + chanmodes.insert(p, lm.modes); + + // Append the listmode parameters (the masks themselves) + chanmodes += ' '; + chanmodes += lm.params; + } + } + std::string chants = ConvToStr(chan->age); std::string topicts = ConvToStr(chan->topicset); const char* items[] = @@ -73,7 +117,7 @@ static bool WriteDatabase() " topicsetby=", chan->setby.c_str(), " modes=", - chan->ChanModes(true), + chanmodes.c_str(), ">\n" }; @@ -170,6 +214,7 @@ class ModulePermanentChannels : public Module { PermChannel p; bool dirty; + bool save_listmodes; public: ModulePermanentChannels() : p(this), dirty(false) @@ -213,7 +258,9 @@ public: virtual void OnRehash(User *user) { - permchannelsconf = ServerInstance->Config->ConfValue("permchanneldb")->getString("filename"); + ConfigTag* tag = ServerInstance->Config->ConfValue("permchanneldb"); + permchannelsconf = tag->getString("filename"); + save_listmodes = tag->getBool("listmodes"); } void LoadDatabase() @@ -296,7 +343,7 @@ public: void OnBackgroundTimer(time_t) { if (dirty) - WriteDatabase(); + WriteDatabase(this, save_listmodes); dirty = false; } @@ -332,6 +379,25 @@ public: } } + void ProtoSendMode(void* opaque, TargetTypeFlags type, void* target, const std::vector& modes, const std::vector& translate) + { + // We never pass an empty modelist but better be sure + if (modes.empty()) + return; + + ListModeData* lm = static_cast(opaque); + + // Append the mode letters without the trailing '+' (for example "IIII", "gg") + lm->modes.append(modes[0].begin()+1, modes[0].end()); + + // Append the parameters + for (std::vector::const_iterator i = modes.begin()+1; i != modes.end(); ++i) + { + lm->params += *i; + lm->params += ' '; + } + } + virtual Version GetVersion() { return Version("Provides support for channel mode +P to provide permanent channels",VF_VENDOR); -- cgit v1.2.3 From 4d41afdc2ecf36017154e7a460457c076c8aaa16 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 28 Aug 2013 19:27:14 +0200 Subject: m_permchannels Fix empty topic setby --- src/modules/m_permchannels.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/modules') diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 04171585b..0a7dc8ed9 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -292,6 +292,8 @@ public: c->SetTopic(NULL, topic, true); c->setby = tag->getString("topicsetby"); + if (c->setby.empty()) + c->setby = ServerInstance->Config->ServerName; unsigned int topicset = tag->getInt("topicts"); // SetTopic() sets the topic TS to now, if there was no topicts saved then don't overwrite that with a 0 if (topicset > 0) -- cgit v1.2.3