- if (((this->CapKeys.find("HALFOP") == this->CapKeys.end()) && (ServerInstance->Config->AllowHalfop)) || ((this->CapKeys.find("HALFOP") != this->CapKeys.end()) && (this->CapKeys.find("HALFOP")->second != ConvToStr(ServerInstance->Config->AllowHalfop))))
- reason = "We don't both have halfop support enabled/disabled identically";
+ if (!capab->UserModes.empty())
+ {
+ if (capab->UserModes != BuildModeList(MODETYPE_USER))
+ {
+ std::string diffIneed, diffUneed;
+ ListDifference(capab->UserModes, BuildModeList(MODETYPE_USER), ' ', diffIneed, diffUneed);
+ if (diffIneed.length() || diffUneed.length())
+ {
+ reason = "User modes not matched on these servers.";
+ if (diffIneed.length())
+ reason += " Not loaded here:" + diffIneed;
+ if (diffUneed.length())
+ reason += " Not loaded there:" + diffUneed;
+ }
+ }
+ }
+ else if (this->capab->CapKeys.find("USERMODES") != this->capab->CapKeys.end())
+ {
+ if (this->capab->CapKeys.find("USERMODES")->second != ServerInstance->Modes->GiveModeList(MODETYPE_USER))
+ reason = "One or more of the user modes on the remote server are invalid on this server.";
+ }
+ else
+ {
+ // We default to rfc1459 here because if this key is not sent then
+ // the remote server is running the 2.0 protocol which uses rfc1459
+ // by default.
+ std::string casemapping = "rfc1459";
+ std::map<std::string, std::string>::iterator citer = this->capab->CapKeys.find("CASEMAPPING");
+ if (citer != this->capab->CapKeys.end())
+ casemapping = citer->second;