mirror of
https://github.com/anope/anope.git
synced 2026-07-09 15:43:13 +02:00
Cleanup of various different crashes/inconsistancies
This commit is contained in:
+24
-17
@@ -77,6 +77,10 @@ Channel::~Channel()
|
||||
|
||||
void Channel::Sync()
|
||||
{
|
||||
if (this->users.empty() || (this->users.size() == 1 && this->ci && this->ci->bi == this->users.front()->user))
|
||||
{
|
||||
new ChanServTimer(this);
|
||||
}
|
||||
if (this->ci)
|
||||
{
|
||||
check_modes(this);
|
||||
@@ -115,24 +119,27 @@ void Channel::JoinUser(User *user)
|
||||
user->SendMessage(whosends(this->ci)->nick, "[%s] %s", this->name.c_str(), this->ci->entry_message.c_str());
|
||||
}
|
||||
|
||||
/**
|
||||
* We let the bot join even if it was an ignored user, as if we don't,
|
||||
* and the ignored user doesnt just leave, the bot will never
|
||||
* make it into the channel, leaving the channel botless even for
|
||||
* legit users - Rob
|
||||
* But don't join the bot if the channel is persistant - Adam
|
||||
* But join persistant channels when syncing with our uplink- DP
|
||||
**/
|
||||
if (!Config.s_BotServ.empty() && this->ci && this->ci->bi && (!Me->IsSynced() || !this->ci->HasFlag(CI_PERSIST)) && this->users.size() >= Config.BSMinUsers && !this->FindUser(this->ci->bi))
|
||||
this->ci->bi->Join(this);
|
||||
/* Only display the greet if the main uplink we're connected
|
||||
* to has synced, or we'll get greet-floods when the net
|
||||
* recovers from a netsplit. -GD
|
||||
*/
|
||||
if (!Config.s_BotServ.empty() && this->ci && this->ci->bi && this->FindUser(this->ci->bi) && this->ci->botflags.HasFlag(BS_GREET) && user->Account() && !user->Account()->greet.empty() && check_access(user, this->ci, CA_GREET) && user->server->IsSynced())
|
||||
if (!Config.s_BotServ.empty() && this->ci && this->ci->bi)
|
||||
{
|
||||
ircdproto->SendPrivmsg(this->ci->bi, this->name, "[%s] %s", user->Account()->display.c_str(), user->Account()->greet.c_str());
|
||||
this->ci->bi->lastmsg = time(NULL);
|
||||
/**
|
||||
* We let the bot join even if it was an ignored user, as if we don't,
|
||||
* and the ignored user doesnt just leave, the bot will never
|
||||
* make it into the channel, leaving the channel botless even for
|
||||
* legit users - Rob
|
||||
* But don't join the bot if the channel is persistant - Adam
|
||||
* But join persistant channels when syncing with our uplink- DP
|
||||
**/
|
||||
if ((!Me->IsSynced() || !this->ci->HasFlag(CI_PERSIST)) && this->users.size() >= Config.BSMinUsers && !this->FindUser(this->ci->bi))
|
||||
this->ci->bi->Join(this);
|
||||
/* Only display the greet if the main uplink we're connected
|
||||
* to has synced, or we'll get greet-floods when the net
|
||||
* recovers from a netsplit. -GD
|
||||
*/
|
||||
if (this->FindUser(this->ci->bi) && this->ci->botflags.HasFlag(BS_GREET) && user->Account() && !user->Account()->greet.empty() && check_access(user, this->ci, CA_GREET) && user->server->IsSynced())
|
||||
{
|
||||
ircdproto->SendPrivmsg(this->ci->bi, this->name, "[%s] %s", user->Account()->display.c_str(), user->Account()->greet.c_str());
|
||||
this->ci->bi->lastmsg = time(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-9
@@ -967,6 +967,7 @@ ChanServTimer::ChanServTimer(Channel *chan) : Timer(Config.CSInhabit), c(chan)
|
||||
{
|
||||
if (c->ci)
|
||||
c->ci->SetFlag(CI_INHABIT);
|
||||
ChanServ->Join(c);
|
||||
}
|
||||
|
||||
void ChanServTimer::Tick(time_t)
|
||||
@@ -976,13 +977,7 @@ void ChanServTimer::Tick(time_t)
|
||||
|
||||
c->ci->UnsetFlag(CI_INHABIT);
|
||||
|
||||
/* If the channel has users again, don't part it and halt */
|
||||
if (!c->users.empty())
|
||||
return;
|
||||
|
||||
ChanServ->Part(c);
|
||||
|
||||
/* Now delete the channel as it is empty */
|
||||
if (!c->HasFlag(CH_PERSIST) && !c->ci->HasFlag(CI_PERSIST))
|
||||
delete c;
|
||||
if (c->users.size() == 1 || c->ci->bi != ChanServ)
|
||||
ChanServ->Part(c);
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -407,16 +407,15 @@ XLine *XLineManager::Check(User *u)
|
||||
{
|
||||
const time_t now = time(NULL);
|
||||
|
||||
for (std::vector<XLine *>::iterator it = this->XLines.begin(), it_end = this->XLines.end(); it != it_end; ++it)
|
||||
for (unsigned i = this->XLines.size(); i > 0; --i)
|
||||
{
|
||||
XLine *x = *it;
|
||||
XLine *x = this->XLines[i - 1];
|
||||
|
||||
if (x->Expires && x->Expires < now)
|
||||
{
|
||||
OnExpire(x);
|
||||
delete x;
|
||||
it = XLines.erase(it);
|
||||
--it;
|
||||
this->XLines.erase(XLines.begin() + i - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -621,10 +621,7 @@ bool ChannelInfo::CheckKick(User *user)
|
||||
c->SetMode(NULL, CMODE_INVITE);
|
||||
}
|
||||
|
||||
/* Join ChanServ */
|
||||
ChanServ->Join(this->c);
|
||||
|
||||
/* Set a timer for this channel to part ChanServ later */
|
||||
/* Join ChanServ and set a timer for this channel to part ChanServ later */
|
||||
new ChanServTimer(this->c);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ User::~User()
|
||||
{
|
||||
Anope::string srealname = normalizeBuffer(this->realname);
|
||||
|
||||
Alog() << "LOGUSERS: " << this->GetMask() << (ircd->vhost ? " => " : " ") << (ircd->vhost ? this->GetDisplayedHost() : "") << " (" << srealname << ") left the network (" << this->server->GetName() << ").";
|
||||
Alog() << "LOGUSERS: " << this->nick << " (" << this->GetIdent() << "@" << this->host << (ircd->vhost ? " => " : "") << (ircd->vhost ? this->GetDisplayedHost() : "") << ") (" << srealname << ") left the network (" << this->server->GetName() << ").";
|
||||
}
|
||||
|
||||
FOREACH_MOD(I_OnUserLogoff, OnUserLogoff(this));
|
||||
|
||||
Reference in New Issue
Block a user