summaryrefslogtreecommitdiff
path: root/modules/protocol/inspircd12.cpp
diff options
context:
space:
mode:
authorAdam <adam@sigterm.info>2018-01-12 12:09:50 -0500
committerGitHub <noreply@github.com>2018-01-12 12:09:50 -0500
commitb3c4b28a674863580f3f5f655f217b4a61ffd361 (patch)
tree4a63149ef53168022ec75cff7fbaa5d49d175e90 /modules/protocol/inspircd12.cpp
parent0da41502832b2018580f25522ea70a521fad1548 (diff)
parent0e14adcb0fe40496e9fcaa17207b1099b1ec330d (diff)
Merge pull request #197 from genius3000/2.0+fix_insp_rlines
2.0: Fix sending incorrect RLines to InspIRCd
Diffstat (limited to 'modules/protocol/inspircd12.cpp')
-rw-r--r--modules/protocol/inspircd12.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index 0d012e214..609ce36f3 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -105,13 +105,21 @@ class InspIRCd12Proto : public IRCDProto
void SendAkillDel(const XLine *x) anope_override
{
- /* InspIRCd may support regex bans */
+ /* InspIRCd may support regex bans
+ * Mask is expected in format: 'n!u@h\sr' and spaces as '\s'
+ * We remove the '//' and replace '#' and any ' ' with '\s'
+ */
if (x->IsRegex() && Servers::Capab.count("RLINE"))
{
Anope::string mask = x->mask;
- size_t h = x->mask.find('#');
+ if (mask.length() >= 2 && mask[0] == '/' && mask[mask.length() - 1] == '/')
+ mask = mask.substr(1, mask.length() - 2);
+ size_t h = mask.find('#');
if (h != Anope::string::npos)
- mask = mask.replace(h, 1, ' ');
+ {
+ mask = mask.replace(h, 1, "\\s");
+ mask = mask.replace_all_cs(" ", "\\s");
+ }
SendDelLine("R", mask);
return;
}
@@ -168,13 +176,21 @@ class InspIRCd12Proto : public IRCDProto
if (timeleft > 172800 || !x->expires)
timeleft = 172800;
- /* InspIRCd may support regex bans, if they do we can send this and forget about it */
+ /* InspIRCd may support regex bans, if they do we can send this and forget about it
+ * Mask is expected in format: 'n!u@h\sr' and spaces as '\s'
+ * We remove the '//' and replace '#' and any ' ' with '\s'
+ */
if (x->IsRegex() && Servers::Capab.count("RLINE"))
{
Anope::string mask = x->mask;
- size_t h = x->mask.find('#');
+ if (mask.length() >= 2 && mask[0] == '/' && mask[mask.length() - 1] == '/')
+ mask = mask.substr(1, mask.length() - 2);
+ size_t h = mask.find('#');
if (h != Anope::string::npos)
- mask = mask.replace(h, 1, ' ');
+ {
+ mask = mask.replace(h, 1, "\\s");
+ mask = mask.replace_all_cs(" ", "\\s");
+ }
SendAddLine("R", mask, timeleft, x->by, x->GetReason());
return;
}