diff --git a/modules/stickychan.cpp b/modules/stickychan.cpp index 5824e5b8..122e8889 100644 --- a/modules/stickychan.cpp +++ b/modules/stickychan.cpp @@ -175,6 +175,26 @@ public: return false; } + EModRet OnRaw(CString& sLine) override { + CString sNumeric = sLine.Token(1); + + if (sNumeric.Equals("479")) { + // ERR_BADCHANNAME (juped channels or illegal channel name - ircd hybrid) + // prevent the module from getting into an infinite loop of trying to join it. + // :irc.network.net 479 mynick #channel :Illegal channel name + + CString sChannel = sLine.Token(3); + for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) { + if (sChannel.Equals(it->first)) { + PutModule("Channel [" + sChannel + "] cannot be joined, it is an illegal channel name. Unsticking."); + OnUnstickCommand("unstick " + sChannel); + return CONTINUE; + } + } + } + + return CONTINUE; + } };