+ if (proto_version != ProtocolVersion)
+ {
+ std::string::size_type a = line.find(' ');
+ std::string::size_type b = line.find(' ', a + 1);
+ std::string command = line.substr(a + 1, b-a-1);
+ // now try to find a translation entry
+ // TODO a more efficient lookup method will be needed later
+ if (proto_version < 1202 && command == "FIDENT")
+ {
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Rewriting FIDENT for 1201-protocol server");
+ line = ":" + ServerInstance->Config->GetSID() + " CHGIDENT " + line.substr(1,a-1) + line.substr(b);
+ }
+ else if (proto_version < 1202 && command == "SAVE")
+ {
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Rewriting SAVE for 1201-protocol server");
+ std::string::size_type c = line.find(' ', b + 1);
+ std::string uid = line.substr(b, c - b);
+ line = ":" + ServerInstance->Config->GetSID() + " SVSNICK" + uid + line.substr(b);
+ }
+ else if (proto_version < 1202 && command == "AWAY")
+ {
+ if (b != std::string::npos)
+ {
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Stripping AWAY timestamp for 1201-protocol server");
+ std::string::size_type c = line.find(' ', b + 1);
+ line.erase(b,c-b);
+ }
+ }
+ 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);