+ bool IsShunned(LocalUser* user)
+ {
+ // Exempt the user from shuns if they are an oper and affectopers is disabled.
+ if (!affectopers && user->IsOper())
+ return false;
+
+ // Exempt the user from shuns if they are an oper with the servers/ignore-shun privilege.
+ if (user->HasPrivPermission("servers/ignore-shun"))
+ return false;
+
+ // Check whether the user is actually shunned.
+ return ServerInstance->XLines->MatchesLine("SHUN", user);
+ }
+