aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-01-13 00:53:32 +0000
committerGravatar Sadie Powell2021-01-13 01:02:33 +0000
commitbcc3f983772e7042fd969a98f692cef2a9201cae (patch)
treebb9c4dfb572dcb39557f2adbde311eb574725883 /src/modules
parentMerge branch 'insp3' into master. (diff)
parentAdd a shun option to only apply when users are fully connected. (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_chanhistory.cpp19
-rw-r--r--src/modules/m_shun.cpp6
2 files changed, 18 insertions, 7 deletions
diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp
index 88f810c86..e7b43ab05 100644
--- a/src/modules/m_chanhistory.cpp
+++ b/src/modules/m_chanhistory.cpp
@@ -129,7 +129,8 @@ class ModuleChanHistory
, public ServerProtocol::BroadcastEventListener
{
private:
- HistoryMode m;
+ HistoryMode historymode;
+ SimpleUserModeHandler nohistorymode;
bool prefixmsg;
UserModeReference botmode;
bool dobots;
@@ -184,7 +185,8 @@ class ModuleChanHistory
ModuleChanHistory()
: Module(VF_VENDOR, "Adds channel mode H (history) which allows message history to be viewed on joining the channel.")
, ServerProtocol::BroadcastEventListener(this)
- , m(this)
+ , historymode(this)
+ , nohistorymode(this, "nohistory", 'N')
, botmode(this, "bot")
, batchcap(this)
, batchmanager(this)
@@ -197,14 +199,14 @@ class ModuleChanHistory
void ReadConfig(ConfigStatus& status) override
{
auto tag = ServerInstance->Config->ConfValue("chanhistory");
- m.maxlines = tag->getUInt("maxlines", 50, 1);
- prefixmsg = tag->getBool("prefixmsg", tag->getBool("notice", true));
+ historymode.maxlines = tag->getUInt("maxlines", 50, 1);
+ prefixmsg = tag->getBool("prefixmsg", true);
dobots = tag->getBool("bots", true);
}
ModResult OnBroadcastMessage(Channel* channel, const Server* server) override
{
- return channel->IsModeSet(m) ? MOD_RES_ALLOW : MOD_RES_PASSTHRU;
+ return channel->IsModeSet(historymode) ? MOD_RES_ALLOW : MOD_RES_PASSTHRU;
}
void OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details) override
@@ -213,7 +215,7 @@ class ModuleChanHistory
if ((target.type == MessageTarget::TYPE_CHANNEL) && (target.status == 0) && (!details.IsCTCP(ctcpname) || irc::equals(ctcpname, "ACTION")))
{
Channel* c = target.Get<Channel>();
- HistoryList* list = m.ext.get(c);
+ HistoryList* list = historymode.ext.get(c);
if (list)
{
list->lines.push_back(HistoryItem(user, details));
@@ -232,7 +234,10 @@ class ModuleChanHistory
if (memb->user->IsModeSet(botmode) && !dobots)
return;
- HistoryList* list = m.ext.get(memb->chan);
+ if (memb->user->IsModeSet(nohistorymode))
+ return;
+
+ HistoryList* list = historymode.ext.get(memb->chan);
if (!list)
return;
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 16e35275c..ce5399b57 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -155,11 +155,16 @@ class ModuleShun : public Module, public Stats::EventListener
ShunFactory shun;
insp::flat_set<std::string, irc::insensitive_swo> cleanedcommands;
insp::flat_set<std::string, irc::insensitive_swo> enabledcommands;
+ bool allowconnect;
bool allowtags;
bool notifyuser;
bool IsShunned(LocalUser* user)
{
+ // Exempt the user if they are not fully connected and allowconnect is enabled.
+ if (allowconnect && user->registered != REG_ALL)
+ return false;
+
// Exempt the user from shuns if they are an oper with the servers/ignore-shun privilege.
if (user->HasPrivPermission("servers/ignore-shun"))
return false;
@@ -217,6 +222,7 @@ class ModuleShun : public Module, public Stats::EventListener
enabledcommands.insert(enabledcmd);
allowtags = tag->getBool("allowtags");
+ allowconnect = tag->getBool("allowconnect");
notifyuser = tag->getBool("notifyuser", true);
}