+ else if (proto_version < 1202 && command == "ENCAP")
+ {
+ // :src ENCAP target command [args...]
+ // A B C D
+ // Therefore B and C cannot be npos in a valid command
+ if (b == std::string::npos)
+ return;
+ std::string::size_type c = line.find(' ', b + 1);
+ if (c == std::string::npos)
+ return;
+ std::string::size_type d = line.find(' ', c + 1);
+ std::string subcmd = line.substr(c + 1, d - c - 1);
+
+ if (subcmd == "CHGIDENT" && d != std::string::npos)
+ {
+ std::string::size_type e = line.find(' ', d + 1);
+ if (e == std::string::npos)
+ return; // not valid
+ std::string target = line.substr(d + 1, e - d - 1);
+
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Forging acceptance of CHGIDENT from 1201-protocol server");
+ recvq.insert(0, ":" + target + " FIDENT " + line.substr(e) + "\n");
+ }
+
+ Command* thiscmd = ServerInstance->Parser->GetHandler(subcmd);
+ if (thiscmd && subcmd != "WHOISNOTICE")
+ {
+ Version ver = thiscmd->creator->GetVersion();
+ if (ver.Flags & VF_OPTCOMMON)
+ {
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Removing ENCAP on '%s' for 1201-protocol server",
+ subcmd.c_str());
+ line.erase(a, c-a);
+ }
+ }
+ }