if (!Ptr)
{
+ privs = "@";
+
if (IS_LOCAL(user))
{
- privs = "@";
MOD_RESULT = 0;
FOREACH_RESULT_I(Instance,I_OnUserPreJoin,OnUserPreJoin(user,NULL,cname,privs));
if (MOD_RESULT == 1)
}
if (Ptr->bans.size())
{
- MOD_RESULT = 0;
- FOREACH_RESULT_I(Instance,I_OnCheckBan,OnCheckBan(user, Ptr));
char mask[MAXBUF];
- sprintf(mask,"%s!%s@%s",user->nick, user->ident, user->GetIPString());
- if (!MOD_RESULT)
+ snprintf(mask, MAXBUF, "%s!%s@%s",user->nick, user->ident, user->GetIPString());
+ if (Ptr->IsBanned(user))
{
- if (Ptr->IsBanned(user))
- {
- user->WriteServ("474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
- return NULL;
- }
+ user->WriteServ("474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
+ return NULL;
}
}
}
switch (status)
{
case '@':
- a->uc_modes = UCMODE_OP;
+ a->uc_modes |= UCMODE_OP;
break;
case '%':
- a->uc_modes = UCMODE_HOP;
+ a->uc_modes |= UCMODE_HOP;
break;
case '+':
- a->uc_modes = UCMODE_VOICE;
+ a->uc_modes |= UCMODE_VOICE;
break;
}
ModeHandler* mh = Instance->Modes->FindPrefix(status);
bool chanrec::IsBanned(userrec* user)
{
char mask[MAXBUF];
- sprintf(mask,"%s!%s@%s",user->nick, user->ident, user->GetIPString());
- for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++)
+ int MOD_RESULT = 0;
+ FOREACH_RESULT_I(Instance,I_OnCheckBan,OnCheckBan(user, Ptr));
+ if (!MOD_RESULT)
{
- /* This allows CIDR ban matching
- *
- * Full masked host Full unmasked host IP with/without CIDR
- */
- if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true)))
+ snprintf(mask, MAXBUF, "%s!%s@%s", user->nick, user->ident, user->GetIPString());
+ for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++)
{
- return true;
+ /* This allows CIDR ban matching
+ *
+ * Full masked host Full unmasked host IP with/without CIDR
+ */
+ if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true)))
+ {
+ return true;
+ }
}
-
}
return false;
}