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 = ServerInstance->Modes->FindPrefix(status);
+ ModeHandler* mh = Instance->Modes->FindPrefix(status);
if (mh)
{
- Ptr->SetPrefix(user, status, mh->GetRank(), true);
+ Ptr->SetPrefix(user, status, mh->GetPrefixRank(), true);
}
}
Ptr->WriteChannel(user,"JOIN :%s",Ptr->name);
/* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */
- std::string ms = ServerInstance->Modes->ModeString(user, channel);
- if ((channel->usercount() > 1) && (ms.length()))
- channel->WriteAllExceptSender(user, true, 0, "MODE %s +%s", channel->name, ms.c_str());
+ std::string ms = Instance->Modes->ModeString(user, Ptr);
+ if ((Ptr->GetUserCounter() > 1) && (ms.length()))
+ Ptr->WriteAllExceptSender(user, true, 0, "MODE %s +%s", Ptr->name, ms.c_str());
/* Major improvement by Brain - we dont need to be calculating all this pointlessly for remote users */
if (IS_LOCAL(user))
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;
}