summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-08-15 14:08:05 -0400
committerAdam <Adam@anope.org>2010-08-15 14:08:05 -0400
commitc2a97d9f3f2d56d889875f9b60d1e2cbc9826d15 (patch)
tree5530abf6bdb54f8c32b1f681f6367536a412e262
parenta950ed8cabfeca55c909f02412b1788bd386dcff (diff)
Cleanup of various different crashes/inconsistancies
-rw-r--r--modules/core/ms_list.cpp2
-rw-r--r--modules/protocol/bahamut.cpp10
-rw-r--r--modules/protocol/inspircd11.cpp10
-rw-r--r--modules/protocol/inspircd12.cpp10
-rw-r--r--modules/protocol/inspircd20.cpp8
-rw-r--r--modules/protocol/ratbox.cpp10
-rw-r--r--modules/protocol/unreal32.cpp10
-rw-r--r--src/channels.cpp41
-rw-r--r--src/chanserv.cpp13
-rw-r--r--src/operserv.cpp7
-rw-r--r--src/regchannel.cpp5
-rw-r--r--src/users.cpp2
12 files changed, 45 insertions, 83 deletions
diff --git a/modules/core/ms_list.cpp b/modules/core/ms_list.cpp
index d3dcde4f6..0d09583a3 100644
--- a/modules/core/ms_list.cpp
+++ b/modules/core/ms_list.cpp
@@ -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;
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index d71e88dd3..72b57ce4c 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -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;
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index c13ee1120..c5a4c79f7 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -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;
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index 61d51ed9a..cd628b005 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -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;
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 69e648193..dfea02246 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -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;
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 623d5a31e..ff2a0f6c6 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -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;
diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp
index 064efdaa7..16fc8582e 100644
--- a/modules/protocol/unreal32.cpp
+++ b/modules/protocol/unreal32.cpp
@@ -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;
diff --git a/src/channels.cpp b/src/channels.cpp
index 782010c32..9392b70cd 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -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);
+ }
}
}
diff --git a/src/chanserv.cpp b/src/chanserv.cpp
index 2027303fb..b0d6f4b16 100644
--- a/src/chanserv.cpp
+++ b/src/chanserv.cpp
@@ -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);
}
+
diff --git a/src/operserv.cpp b/src/operserv.cpp
index fd345cb8c..0582e91ee 100644
--- a/src/operserv.cpp
+++ b/src/operserv.cpp
@@ -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;
}
diff --git a/src/regchannel.cpp b/src/regchannel.cpp
index bdb4572f4..42ccad94e 100644
--- a/src/regchannel.cpp
+++ b/src/regchannel.cpp
@@ -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);
}
diff --git a/src/users.cpp b/src/users.cpp
index dd21a1ef9..f78c505a9 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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));