- /* Dont display channels if they have +I set and the
- * person doing the WHOIS is not an oper
- */
- return ((user != dest) && (!IS_OPER(user)) && (numeric == 319) && dest->IsModeSet('I'));
+ /* always show to self */
+ if (whois.IsSelfWhois())
+ return MOD_RES_PASSTHRU;
+
+ /* don't touch anything except 319 */
+ if (numeric.GetNumeric() != 319)
+ return MOD_RES_PASSTHRU;
+
+ /* don't touch if -I */
+ if (!whois.GetTarget()->IsModeSet(hm))
+ return MOD_RES_PASSTHRU;
+
+ /* if it affects opers, we don't care if they are opered */
+ if (AffectsOpers)
+ return MOD_RES_DENY;
+
+ /* doesn't affect opers, sender is opered */
+ if (whois.GetSource()->HasPrivPermission("users/auspex"))
+ return MOD_RES_PASSTHRU;
+
+ /* user must be opered, boned. */
+ return MOD_RES_DENY;