- if (!IS_OPER(user))
- {
- if (chan)
- {
- if (chan->IsModeSet('O'))
- {
- user->WriteServ("520 %s %s :Only IRC operators may join the channel %s (+O is set)",user->nick, chan->name,chan->name);
- return 1;
- }
- }
- }
- return 0;
+ // Check whether the entry is an extban.
+ if (mask.length() <= 2 || mask[0] != 'O' || mask[1] != ':')
+ return MOD_RES_PASSTHRU;
+
+ // If the user is not an oper they can't match this.
+ if (!user->IsOper())
+ return MOD_RES_PASSTHRU;
+
+ // Check whether the oper's type matches the ban.
+ const std::string submask = mask.substr(2);
+ if (InspIRCd::Match(user->oper->name, submask))
+ return MOD_RES_DENY;
+
+ // If the oper's type contains spaces recheck with underscores.
+ std::string opername(user->oper->name);
+ stdalgo::string::replace_all(opername, space, underscore);
+ if (InspIRCd::Match(opername, submask))
+ return MOD_RES_DENY;
+
+ return MOD_RES_PASSTHRU;