mirror of
https://github.com/anope/anope.git
synced 2026-06-30 00:36:37 +02:00
Fixed /os reload doing weird things to service channels, and allow setting modes by clients on burst
This commit is contained in:
+1
-1
@@ -835,7 +835,7 @@ class CoreExport IRCDProto
|
||||
virtual void SendQuit(const User *u, const char *fmt, ...);
|
||||
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
|
||||
virtual void SendPong(const Anope::string &servname, const Anope::string &who);
|
||||
virtual void SendJoin(User *, Channel *, const ChannelStatus *) = 0;
|
||||
virtual void SendJoin(User *, Channel *, ChannelStatus *) = 0;
|
||||
virtual void SendSQLineDel(const XLine *x) { }
|
||||
virtual void SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick);
|
||||
virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...);
|
||||
|
||||
@@ -162,14 +162,17 @@ class BahamutIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* JOIN - SJOIN */
|
||||
void SendJoin(User *user, Channel *c, const ChannelStatus *status)
|
||||
void SendJoin(User *user, Channel *c, ChannelStatus *status)
|
||||
{
|
||||
send_cmd(user->nick, "SJOIN %ld %s", static_cast<long>(c->creation_time), c->name.c_str());
|
||||
if (status)
|
||||
{
|
||||
ChannelStatus cs = *status;
|
||||
status->ClearFlags();
|
||||
|
||||
BotInfo *setter = findbot(user->nick);
|
||||
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
|
||||
if (status->HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ class InspIRCdTS6Proto : public IRCDProto
|
||||
}
|
||||
|
||||
/* JOIN */
|
||||
void SendJoin(User *user, Channel *c, const ChannelStatus *status)
|
||||
void SendJoin(User *user, Channel *c, ChannelStatus *status)
|
||||
{
|
||||
send_cmd(Config->Numeric, "FJOIN %s %ld +%s :,%s", c->name.c_str(), static_cast<long>(c->creation_time), c->GetModes(true, true).c_str(), user->GetUID().c_str());
|
||||
/* Note that we can send this with the FJOIN but choose not to
|
||||
@@ -133,9 +133,12 @@ class InspIRCdTS6Proto : public IRCDProto
|
||||
*/
|
||||
if (status)
|
||||
{
|
||||
ChannelStatus cs = *status;
|
||||
status->ClearFlags();
|
||||
|
||||
BotInfo *setter = findbot(user->nick);
|
||||
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
|
||||
if (status->HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,14 +157,17 @@ class InspIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* JOIN */
|
||||
void SendJoin(User *user, Channel *c, const ChannelStatus *status)
|
||||
void SendJoin(User *user, Channel *c, ChannelStatus *status)
|
||||
{
|
||||
send_cmd(user->nick, "JOIN %s %ld", c->name.c_str(), static_cast<long>(c->creation_time));
|
||||
if (status)
|
||||
{
|
||||
ChannelStatus cs = *status;
|
||||
status->ClearFlags();
|
||||
|
||||
BotInfo *setter = findbot(user->nick);
|
||||
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
|
||||
if (status->HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,14 +123,17 @@ class PlexusProto : public IRCDProto
|
||||
send_cmd(Config->Numeric, "UNRESV * %s", x->Mask.c_str());
|
||||
}
|
||||
|
||||
void SendJoin(User *user, Channel *c, const ChannelStatus *status)
|
||||
void SendJoin(User *user, Channel *c, ChannelStatus *status)
|
||||
{
|
||||
send_cmd(Config->Numeric, "SJOIN %ld %s +%s :%s", static_cast<long>(c->creation_time), c->name.c_str(), c->GetModes(true, true).c_str(), user->GetUID().c_str());
|
||||
if (status)
|
||||
{
|
||||
ChannelStatus cs = *status;
|
||||
status->ClearFlags();
|
||||
|
||||
BotInfo *setter = findbot(user->nick);
|
||||
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
|
||||
if (status->HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ class RatboxProto : public IRCDProto
|
||||
send_cmd(Config->Numeric, "UNRESV * %s", x->Mask.c_str());
|
||||
}
|
||||
|
||||
void SendJoin(User *user, Channel *c, const ChannelStatus *status)
|
||||
void SendJoin(User *user, Channel *c, ChannelStatus *status)
|
||||
{
|
||||
/* Note that we must send our modes with the SJOIN and
|
||||
* can not add them to the mode stacker because ratbox
|
||||
|
||||
@@ -165,14 +165,17 @@ class UnrealIRCdProto : public IRCDProto
|
||||
}
|
||||
|
||||
/* JOIN */
|
||||
void SendJoin(User *user, Channel *c, const ChannelStatus *status)
|
||||
void SendJoin(User *user, Channel *c, ChannelStatus *status)
|
||||
{
|
||||
send_cmd(Config->ServerName, "~ %ld %s :%s", static_cast<long>(c->creation_time), c->name.c_str(), user->nick.c_str());
|
||||
if (status)
|
||||
{
|
||||
ChannelStatus cs = *status;
|
||||
status->ClearFlags();
|
||||
|
||||
BotInfo *setter = findbot(user->nick);
|
||||
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
|
||||
if (status->HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
if (cs.HasFlag(ModeManager::ChannelModes[i]->Name))
|
||||
c->SetMode(setter, ModeManager::ChannelModes[i], user->nick, false);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ void Channel::Reset()
|
||||
{
|
||||
UserContainer *uc = *it;
|
||||
|
||||
Flags<ChannelModeName, CMODE_END * 2> flags = *debug_cast<Flags<ChannelModeName, CMODE_END * 2> *>(uc->Status);
|
||||
ChannelStatus flags = *uc->Status;
|
||||
uc->Status->ClearFlags();
|
||||
|
||||
if (findbot(uc->user->nick))
|
||||
|
||||
+15
-4
@@ -981,12 +981,23 @@ static bool DoServices(ServerConfig *config, const Anope::string &, const Anope:
|
||||
{
|
||||
size_t ch = oldchannels[i].find('#');
|
||||
Anope::string chname = oldchannels[i].substr(ch != Anope::string::npos ? ch : 0);
|
||||
if (std::find(bi->botchannels.begin(), bi->botchannels.end(), chname) == bi->botchannels.end())
|
||||
|
||||
bool found = false;
|
||||
for (unsigned j = 0; j < bi->botchannels.size(); ++j)
|
||||
{
|
||||
Channel *c = findchan(chname);
|
||||
if (c)
|
||||
bi->Part(c);
|
||||
ch = bi->botchannels[j].find('#');
|
||||
Anope::string ochname = bi->botchannels[j].substr(ch != Anope::string::npos ? ch : 0);
|
||||
|
||||
if (chname.equals_ci(ochname))
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (found)
|
||||
continue;
|
||||
|
||||
Channel *c = findchan(chname);
|
||||
if (c)
|
||||
bi->Part(c);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+4
-8
@@ -350,9 +350,6 @@ void StackerInfo::AddMode(Mode *mode, bool Set, const Anope::string &Param)
|
||||
*/
|
||||
void ModeManager::ModePipe::OnNotify()
|
||||
{
|
||||
if (!Me || !Me->IsSynced())
|
||||
return;
|
||||
|
||||
ModeManager::ProcessModes();
|
||||
}
|
||||
|
||||
@@ -371,11 +368,6 @@ StackerInfo *ModeManager::GetInfo(Base *Item)
|
||||
|
||||
StackerInfo *s = new StackerInfo();
|
||||
StackerObjects.push_back(std::make_pair(Item, s));
|
||||
|
||||
if (mpipe == NULL)
|
||||
mpipe = new ModePipe();
|
||||
mpipe->Notify();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -474,6 +466,10 @@ void ModeManager::StackerAddInternal(BotInfo *bi, Base *Object, Mode *mode, bool
|
||||
s->bi = debug_cast<Channel *>(Object)->ci->WhoSends();
|
||||
else if (Type == ST_USER)
|
||||
s->bi = NULL;
|
||||
|
||||
if (mpipe == NULL)
|
||||
mpipe = new ModePipe();
|
||||
mpipe->Notify();
|
||||
}
|
||||
|
||||
/** Add a user mode to Anope
|
||||
|
||||
+3
-1
@@ -61,7 +61,9 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A
|
||||
for (unsigned i = 0; i < bi->botchannels.size(); ++i)
|
||||
{
|
||||
size_t h = bi->botchannels[i].find('#');
|
||||
Anope::string chname = bi->botchannels[i].substr(h != Anope::string::npos ? h : 0);
|
||||
if (h == Anope::string::npos)
|
||||
continue;
|
||||
Anope::string chname = bi->botchannels[i].substr(h);
|
||||
Channel *c = findchan(chname);
|
||||
if (c && c->FindUser(bi))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user