diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 41 | ||||
-rw-r--r-- | src/chanserv.cpp | 13 | ||||
-rw-r--r-- | src/operserv.cpp | 7 | ||||
-rw-r--r-- | src/regchannel.cpp | 5 | ||||
-rw-r--r-- | src/users.cpp | 2 |
5 files changed, 33 insertions, 35 deletions
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)); |