1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 07:16:38 +02:00

Cleanup of various different crashes/inconsistancies

This commit is contained in:
Adam
2010-08-15 14:08:05 -04:00
parent a950ed8cab
commit c2a97d9f3f
12 changed files with 45 additions and 83 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ class CommandMSList : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
Anope::string param = !params.empty() ? params[0] : "", chan;
ChannelInfo *ci;
ChannelInfo *ci = NULL;
const MemoInfo *mi;
int i, end;
+2 -8
View File
@@ -398,7 +398,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
ChannelMode *cm = ModeManager::FindChannelModeByChar(ch);
if (!cm)
{
Alog() << "Recieved unknown mode prefix " << buf[0] << " in SJOIN string";
Alog() << "Receeved unknown mode prefix " << buf[0] << " in SJOIN string";
continue;
}
@@ -443,13 +443,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
{
/* Unset the syncing flag */
c->UnsetFlag(CH_SYNCING);
/* If there are users in the channel they are allowed to be, set topic mlock etc. */
if (!c->users.empty())
c->Sync();
/* If there are no users in the channel, there is a ChanServ timer set to part the service bot
* and destroy the channel soon
*/
c->Sync();
}
return MOD_CONT;
+2 -8
View File
@@ -450,7 +450,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
if (!cm)
{
Alog() << "Recieved unknown mode prefix " << buf[0] << " in FJOIN string";
Alog() << "Received unknown mode prefix " << buf[0] << " in FJOIN string";
buf.erase(buf.begin());
continue;
}
@@ -496,13 +496,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
{
/* Unset the syncing flag */
c->UnsetFlag(CH_SYNCING);
/* If there are users in the channel they are allowed to be, set topic mlock etc. */
if (!c->users.empty())
c->Sync();
/* If there are no users in the channel, there is a ChanServ timer set to part the service bot
* and destroy the channel soon
*/
c->Sync();
}
return MOD_CONT;
+2 -8
View File
@@ -496,7 +496,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
ChannelMode *cm = ModeManager::FindChannelModeByChar(buf[0]);
if (!cm)
{
Alog() << "Recieved unknown mode prefix " << buf[0] << " in FJOIN string";
Alog() << "Receeved unknown mode prefix " << buf[0] << " in FJOIN string";
buf.erase(buf.begin());
continue;
}
@@ -543,13 +543,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
{
/* Unset the syncing flag */
c->UnsetFlag(CH_SYNCING);
/* If there are users in the channel they are allowed to be, set topic mlock etc */
if (!c->users.empty())
c->Sync();
/* If there are no users in the channel, there is a ChanServ timer set to part the service bot
* and destroy the channel soon
*/
c->Sync();
}
return MOD_CONT;
+1 -7
View File
@@ -541,13 +541,7 @@ int anope_event_fjoin(const Anope::string &source, int ac, const char **av)
{
/* Unset the syncing flag */
c->UnsetFlag(CH_SYNCING);
/* If there are users in the channel they are allowed to be, set topic mlock etc */
if (!c->users.empty())
c->Sync();
/* If there are no users in the channel, there is a ChanServ timer set to part the service bot
* and destroy the channel soon
*/
c->Sync();
}
return MOD_CONT;
+2 -8
View File
@@ -352,7 +352,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
ChannelMode *cm = ModeManager::FindChannelModeByChar(ch);
if (!cm)
{
Alog() << "Recieved unknown mode prefix " << buf[0] << " in SJOIN string";
Alog() << "Received unknown mode prefix " << buf[0] << " in SJOIN string";
continue;
}
@@ -396,13 +396,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
{
/* Unset the syncing flag */
c->UnsetFlag(CH_SYNCING);
/* If there are users in the channel they are allowed to be, set topic mlock etc. */
if (!c->users.empty())
c->Sync();
/* If there are no users in the channel, there is a ChanServ timer set to part the service bot
* and destroy the channel soon
*/
c->Sync();
}
return MOD_CONT;
+2 -8
View File
@@ -1084,7 +1084,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
ChannelMode *cm = ModeManager::FindChannelModeByChar(ch);
if (!cm)
{
Alog() << "Recieved unknown mode prefix " << buf[0] << " in SJOIN string";
Alog() << "Received unknown mode prefix " << buf[0] << " in SJOIN string";
continue;
}
@@ -1129,13 +1129,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
{
/* Unset the syncing flag */
c->UnsetFlag(CH_SYNCING);
/* If there are users in the channel they are allowed to be, set topic mlock etc. */
if (!c->users.empty())
c->Sync();
/* If there are no users in the channel, there is a ChanServ timer set to part the service bot
* and destroy the channel soon
*/
c->Sync();
}
return MOD_CONT;
+24 -17
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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));