diff options
-rw-r--r-- | include/services.h | 2 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 7 | ||||
-rw-r--r-- | modules/protocol/inspircd-ts6.h | 7 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 7 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 7 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 2 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 7 | ||||
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/config.cpp | 19 | ||||
-rw-r--r-- | src/modes.cpp | 12 | ||||
-rw-r--r-- | src/servers.cpp | 4 |
11 files changed, 50 insertions, 26 deletions
diff --git a/include/services.h b/include/services.h index 520182e98..77b9e9cd1 100644 --- a/include/services.h +++ b/include/services.h @@ -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, ...); diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 008c4dd32..2ae061009 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -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); } } diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index 3603555c4..2eab151cf 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -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); } } diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index 8b51c93a6..6d72c5d61 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -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); } } diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index f31bfea6a..3b108b470 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -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); } } diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 957564890..2a135287b 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -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 diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index cb6ec2091..d3d0ba1dd 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -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); } } diff --git a/src/channels.cpp b/src/channels.cpp index 1778b9f01..2532e23b4 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -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)) diff --git a/src/config.cpp b/src/config.cpp index 5cb067735..ebe31cbbc 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -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; diff --git a/src/modes.cpp b/src/modes.cpp index c3e52e036..4fc5d6483 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -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 diff --git a/src/servers.cpp b/src/servers.cpp index 5a95bb85f..a912fcf1f 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -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)) { |