diff options
| author | 2025-06-28 13:46:51 +0100 | |
|---|---|---|
| committer | 2025-06-28 13:48:05 +0100 | |
| commit | e11ff9becf27b894c4f9a4be277239244fedc8f7 (patch) | |
| tree | deea527395976bc54dcf1dee11d8f4b404851acc | |
| parent | Minor style nits in the rline module. (diff) | |
Add flag support to rline.
| -rw-r--r-- | docs/conf/modules.example.conf | 8 | ||||
| -rw-r--r-- | src/modules/m_rline.cpp | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/docs/conf/modules.example.conf b/docs/conf/modules.example.conf index 6ddeac237..826f89620 100644 --- a/docs/conf/modules.example.conf +++ b/docs/conf/modules.example.conf @@ -2123,6 +2123,9 @@ # If you wish to re-check a user when they change nickname (can be # useful under some situations, but *can* also use CPU with more users # on a server) then set 'matchonnickchange' to yes. +# If you want to use flags like '/foo/i' (insensitive match) you should +# set 'useflags' to yes. This will be the default in the next major +# release. # If you additionally want Z-lines to be added on matches, then # set 'zlineonmatch' to yes. # Also, this is where you set what Regular Expression engine is to be @@ -2131,7 +2134,10 @@ # regex_<engine> must be loaded, or rline will be non-functional # until you load it or change the engine to one that is loaded. # -#<rline matchonnickchange="yes" zlineonmatch="no" engine="stdregex"> +#<rline matchonnickchange="yes" +# useflags="yes" +# zlineonmatch="no" +# engine="stdregex"> # # Generally, you will NOT want to use 'glob' here, as this turns an # R-line into just another G-line. The exceptions are that R-lines will diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 67a3aa523..0c5be74e9 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -34,6 +34,7 @@ namespace { bool addedzline = false; + bool useflags = false; bool zlineonmatch = false; } @@ -48,7 +49,7 @@ public: /* This can throw on failure, but if it does we DONT catch it here, we catch it and display it * where the object is created, we might not ALWAYS want it to output stuff to snomask x all the time */ - regex = rxfactory->Create(regexs); + regex = useflags ? rxfactory->Create(regexs) : rxfactory->CreateHuman(regexs); } bool Matches(User* u) const override @@ -278,9 +279,10 @@ public: const auto& tag = ServerInstance->Config->ConfValue("rline"); matchonnickchange = tag->getBool("matchonnickchange"); + useflags = tag->getBool("useflags"); zlineonmatch = tag->getBool("zlineonmatch"); - std::string newrxengine = tag->getString("engine"); + std::string newrxengine = tag->getString("engine"); factory = rxfactory ? (rxfactory.operator->()) : nullptr; rxfactory.SetEngine(newrxengine); |
