- if (FirstInGetsFounder && !chan)
- privs = std::string(1, QPrefix) + "@";
-
- return MOD_RES_PASSTHRU;
- }
-
- virtual ModResult OnAccessCheck(User* source,User* dest,Channel* channel,int access_type)
- {
- // here we perform access checks, this is the important bit that actually stops kicking/deopping
- // etc of protected users. There are many types of access check, we're going to handle
- // a relatively small number of them relevent to our module using a switch statement.
- // don't allow action if:
- // (A) Theyre founder (no matter what)
- // (B) Theyre protected, unless you're founder or are protected and DeprivOthers is enabled
- // always allow the action if:
- // (A) The source is ulined
-
- if ((ServerInstance->ULine(source->nick.c_str())) || (ServerInstance->ULine(source->server)) || (!*source->server))
- return MOD_RES_PASSTHRU;
-
- if (!channel)
- return MOD_RES_PASSTHRU;
-
- // Can do anything to yourself if deprotectself is enabled.
- if (DeprivSelf && source == dest)
- return MOD_RES_PASSTHRU;
-
- Membership* smemb = channel->GetUser(source);
- Membership* dmemb = channel->GetUser(source);
- bool candepriv_founder = (DeprivOthers && smemb && smemb->hasMode('q'));
- bool candepriv_protect = smemb && (smemb->hasMode('q') || (DeprivOthers && smemb->hasMode('a')));
- bool desthas_founder = dmemb->hasMode('q');
- bool desthas_protect = dmemb->hasMode('a');