1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 13:03:14 +02:00

Send uids everywhere when setting modes on clients

This commit is contained in:
Adam
2012-10-30 21:22:10 -04:00
parent 26a4a13cdf
commit 1730bfb2bc
13 changed files with 51 additions and 32 deletions
+2 -2
View File
@@ -75,9 +75,9 @@ public:
{
/* On most ircds you do not receive the admin/owner mode till its registered */
if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER)))
target_ci->c->SetMode(NULL, cm, u->nick);
target_ci->c->SetMode(NULL, cm, u->GetUID());
else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT)))
target_ci->c->RemoveMode(NULL, cm, u->nick);
target_ci->c->RemoveMode(NULL, cm, u->GetUID());
}
/* Mark the channel as persistent */
+4 -4
View File
@@ -280,9 +280,9 @@ class CommandCSMode : public Command
if (Anope::Match(uc->user->GetMask(), param))
{
if (adding)
ci->c->SetMode(NULL, cm, uc->user->nick);
ci->c->SetMode(NULL, cm, uc->user->GetUID());
else
ci->c->RemoveMode(NULL, cm, uc->user->nick);
ci->c->RemoveMode(NULL, cm, uc->user->GetUID());
}
}
}
@@ -303,9 +303,9 @@ class CommandCSMode : public Command
}
if (adding)
ci->c->SetMode(NULL, cm, param);
ci->c->SetMode(NULL, cm, target->GetUID());
else
ci->c->RemoveMode(NULL, cm, param);
ci->c->RemoveMode(NULL, cm, target->GetUID());
}
break;
}
+2 -2
View File
@@ -55,9 +55,9 @@ class CommandModeBase : public Command
else
{
if (set)
c->SetMode(NULL, cm, u2->nick);
c->SetMode(NULL, cm, u2->GetUID());
else
c->RemoveMode(NULL, cm, u2->nick);
c->RemoveMode(NULL, cm, u2->GetUID());
Log(LOG_COMMAND, source, com, ci) << "for " << u2->nick;
}
+2 -2
View File
@@ -85,9 +85,9 @@ class CommandCSRegister : public Command
{
/* On most ircds you do not receive the admin/owner mode till its registered */
if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER)))
c->SetMode(NULL, cm, u->nick);
c->SetMode(NULL, cm, u->GetUID());
else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT)))
c->RemoveMode(NULL, cm, u->nick);
c->RemoveMode(NULL, cm, u->GetUID());
}
/* Mark the channel as persistent */
+5 -2
View File
@@ -61,23 +61,26 @@ class CommandOSMode : public Command
if (!cm)
continue;
Anope::string param;
Anope::string param, param_log;
if (cm->Type != MODE_REGULAR)
{
if (!sep.GetToken(param))
continue;
param_log = param;
if (cm->Type == MODE_STATUS)
{
User *targ = finduser(param);
if (targ == NULL || c->FindUser(targ) == NULL)
continue;
param = targ->GetUID();
}
}
log_modes += cm->ModeChar;
if (!param.empty())
log_params += " " + param;
log_params += " " + param_log;
if (add)
c->SetMode(source.service, cm, param, false);
+1 -1
View File
@@ -187,7 +187,7 @@ class BahamutIRCdProto : public IRCDProto
BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
+1 -1
View File
@@ -232,7 +232,7 @@ class InspIRCdTS6Proto : public IRCDProto
BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
+1 -1
View File
@@ -219,7 +219,7 @@ class InspIRCdProto : public IRCDProto
BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
+1 -1
View File
@@ -92,7 +92,7 @@ class ngIRCdProto : public IRCDProto
BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ class PlexusProto : public IRCDProto
BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
+1 -1
View File
@@ -170,7 +170,7 @@ class UnrealIRCdProto : public IRCDProto
BotInfo *setter = findbot(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
+29 -13
View File
@@ -86,7 +86,7 @@ void Channel::Reset()
ChannelMode *cm = ModeManager::ChannelModes[i];
if (flags.HasFlag(cm->Name))
this->SetMode(NULL, cm, uc->user->nick, false);
this->SetMode(NULL, cm, uc->user->GetUID(), false);
}
}
}
@@ -451,7 +451,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *cm, const A
if (this->ci && this->ci->bi && this->ci->bi == bi)
{
if (Config->BotModeList.HasFlag(cm->Name))
this->SetMode(bi, cm, bi->nick);
this->SetMode(bi, cm, bi->GetUID());
}
chan_set_correct_modes(u, this, 0, false);
@@ -668,14 +668,30 @@ void Channel::SetModes(BotInfo *bi, bool EnforceMLock, const char *cmodes, ...)
if (add)
{
if (cm->Type != MODE_REGULAR && sep.GetToken(sbuf))
{
if (cm->Type == MODE_STATUS)
{
User *targ = finduser(sbuf);
if (targ != NULL)
sbuf = targ->GetUID();
}
this->SetMode(bi, cm, sbuf, EnforceMLock);
}
else
this->SetMode(bi, cm, "", EnforceMLock);
}
else if (!add)
{
if (cm->Type != MODE_REGULAR && sep.GetToken(sbuf))
{
if (cm->Type == MODE_STATUS)
{
User *targ = finduser(sbuf);
if (targ != NULL)
sbuf = targ->GetUID();
}
this->RemoveMode(bi, cm, sbuf, EnforceMLock);
}
else
this->RemoveMode(bi, cm, "", EnforceMLock);
}
@@ -1039,31 +1055,31 @@ void chan_set_correct_modes(const User *user, Channel *c, int give_modes, bool c
if (give_modes && (!user->Account() || user->Account()->HasFlag(NI_AUTOOP)) && (!check_noop || !ci->HasFlag(CI_NOAUTOOP)))
{
if (owner && u_access.HasPriv("AUTOOWNER"))
c->SetMode(NULL, CMODE_OWNER, user->nick);
c->SetMode(NULL, CMODE_OWNER, user->GetUID());
else if (admin && u_access.HasPriv("AUTOPROTECT"))
c->SetMode(NULL, CMODE_PROTECT, user->nick);
c->SetMode(NULL, CMODE_PROTECT, user->GetUID());
if (op && u_access.HasPriv("AUTOOP"))
c->SetMode(NULL, CMODE_OP, user->nick);
c->SetMode(NULL, CMODE_OP, user->GetUID());
else if (halfop && u_access.HasPriv("AUTOHALFOP"))
c->SetMode(NULL, CMODE_HALFOP, user->nick);
c->SetMode(NULL, CMODE_HALFOP, user->GetUID());
else if (voice && u_access.HasPriv("AUTOVOICE"))
c->SetMode(NULL, CMODE_VOICE, user->nick);
c->SetMode(NULL, CMODE_VOICE, user->GetUID());
}
/* If this channel has secureops or the channel is syncing and they are not ulined, check to remove modes */
if ((ci->HasFlag(CI_SECUREOPS) || (c->HasFlag(CH_SYNCING) && user->server->IsSynced())) && !user->server->IsULined())
{
if (owner && !u_access.HasPriv("AUTOOWNER") && !u_access.HasPriv("OWNERME"))
c->RemoveMode(NULL, CMODE_OWNER, user->nick);
c->RemoveMode(NULL, CMODE_OWNER, user->GetUID());
if (admin && !u_access.HasPriv("AUTOPROTECT") && !u_access.HasPriv("PROTECTME"))
c->RemoveMode(NULL, CMODE_PROTECT, user->nick);
c->RemoveMode(NULL, CMODE_PROTECT, user->GetUID());
if (op && c->HasUserStatus(user, CMODE_OP) && !u_access.HasPriv("AUTOOP") && !u_access.HasPriv("OPDEOPME"))
c->RemoveMode(NULL, CMODE_OP, user->nick);
c->RemoveMode(NULL, CMODE_OP, user->GetUID());
if (halfop && !u_access.HasPriv("AUTOHALFOP") && !u_access.HasPriv("HALFOPME"))
c->RemoveMode(NULL, CMODE_HALFOP, user->nick);
c->RemoveMode(NULL, CMODE_HALFOP, user->GetUID());
}
// Check mlock
@@ -1079,9 +1095,9 @@ void chan_set_correct_modes(const User *user, Channel *c, int give_modes, bool c
if ((ml->set && !c->HasUserStatus(user, ml->name)) || (!ml->set && c->HasUserStatus(user, ml->name)))
{
if (ml->set)
c->SetMode(NULL, cm, user->nick, false);
c->SetMode(NULL, cm, user->GetUID(), false);
else if (!ml->set)
c->RemoveMode(NULL, cm, user->nick, false);
c->RemoveMode(NULL, cm, user->GetUID(), false);
}
}
}
+1 -1
View File
@@ -1032,7 +1032,7 @@ static bool DoServices(ServerConfig *config, const Anope::string &, const Anope:
if (cm == NULL)
cm = ModeManager::FindChannelModeByChar(ModeManager::GetStatusChar(want_modes[j]));
if (cm && cm->Type == MODE_STATUS)
c->SetMode(bi, cm, bi->nick);
c->SetMode(bi, cm, bi->GetUID());
}
}
for (unsigned i = 0; i < oldchannels.size(); ++i)