summaryrefslogtreecommitdiff
path: root/src/servers.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-06-02 14:59:34 -0400
committerAdam <Adam@anope.org>2011-06-02 14:59:34 -0400
commit3ad93a31c91ae096d5e53deb7dd64586fa935244 (patch)
tree46a53929245681c142cb58c25d20754ac1f15fc8 /src/servers.cpp
parent184b346166db9d40fcdc7bb6bf3a7929fdd48be9 (diff)
Burst our channels with the uplink when we connect & fixed bug #1274
Diffstat (limited to 'src/servers.cpp')
-rw-r--r--src/servers.cpp76
1 files changed, 72 insertions, 4 deletions
diff --git a/src/servers.cpp b/src/servers.cpp
index 763fed707..c57dda680 100644
--- a/src/servers.cpp
+++ b/src/servers.cpp
@@ -51,8 +51,44 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A
/* Check to be sure this isn't a juped server */
if (Me == this->UplinkServer && !this->HasFlag(SERVER_JUPED))
{
- /* Bring in our pseudo-clients */
- introduce_user("");
+ /* Load MLock from the database now that we know what modes exist */
+ for (registered_channel_map::iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it)
+ it->second->LoadMLock();
+
+ ircdproto->SendBOB();
+
+ for (unsigned i = 0; i < Me->GetLinks().size(); ++i)
+ {
+ Server *s = Me->GetLinks()[i];
+
+ if (s->HasFlag(SERVER_JUPED))
+ ircdproto->SendServer(s);
+ }
+
+ /* We make the bots go online */
+ for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
+ {
+ User *u = it->second;
+
+ ircdproto->SendClientIntroduction(u, ircd->pseudoclient_mode);
+
+ BotInfo *bi = findbot(u->nick);
+ if (bi)
+ {
+ XLine x(bi->nick, "Reserved for services");
+ ircdproto->SendSQLine(NULL, &x);
+ }
+ }
+
+ for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
+ {
+ Channel *c = it->second;
+ if (c->users.empty())
+ ircdproto->SendChannel(c);
+ else
+ for (CUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end; ++cit)
+ ircdproto->SendJoin((*cit)->user, c, (*cit)->Status);
+ }
}
}
}
@@ -210,15 +246,47 @@ void Server::Sync(bool SyncLinks)
if (this->GetUplink() && this->GetUplink() == Me)
{
+ for (registered_channel_map::iterator it = RegisteredChannelList.begin(), it_end = RegisteredChannelList.end(); it != it_end; ++it)
+ {
+ ChannelInfo *ci = it->second;
+ if (ci->HasFlag(CI_PERSIST))
+ {
+ bool created = false;
+ if (!ci->c)
+ {
+ ci->c = new Channel(ci->name, ci->time_registered);
+ created = true;
+ }
+ if (ModeManager::FindChannelModeByName(CMODE_PERM) != NULL)
+ {
+ ci->c->SetMode(NULL, CMODE_PERM);
+ if (created)
+ ircdproto->SendChannel(ci->c);
+ }
+ else
+ {
+ if (!ci->bi)
+ ci->WhoSends()->Assign(NULL, ci);
+ if (ci->c->FindUser(ci->bi) == NULL)
+ ci->bi->Join(ci->c);
+ }
+ }
+ }
+
FOREACH_MOD(I_OnPreUplinkSync, OnPreUplinkSync(this));
+
ircdproto->SendEOB();
Me->Sync(false);
FOREACH_MOD(I_OnUplinkSync, OnUplinkSync(this));
for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
- if (it->second->ci)
- it->second->ci->RestoreTopic();
+ {
+ Channel *c = it->second;
+ check_modes(c);
+ if (c->ci)
+ c->ci->RestoreTopic();
+ }
}
}