From 847cceaba350444510b37f685d51fdfc584b1fd2 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 25 Aug 2013 02:59:54 -0400 Subject: Create persistent channels on startup, which used to work and got lost somewhere Fix some oddities with using persistent channels with no botserv Send list modes to uplink when bursting Fix issues with persist + keepmodes Fix /os modes clear all not clearing all status modes Fix operwall on ratbox/plexus Dont apply mlock in SetCorrectModes since that just recursively calls itself unncessarially Change command logging to show the command name and not the service name --- src/channels.cpp | 4 ++-- src/logger.cpp | 9 +++------ src/nickalias.cpp | 6 ++++-- src/nickcore.cpp | 5 +++-- src/regchannel.cpp | 7 ++++--- src/servers.cpp | 9 +++++++++ 6 files changed, 25 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 22f90e28f..e6bd816df 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -812,7 +812,7 @@ void Channel::SetCorrectModes(User *user, bool give_modes) /* Always give op. If we have already given one mode, don't give more until it has a symbol */ if (cm->name == "OP" || !given || (giving && cm->symbol)) { - this->SetMode(NULL, cm, user->GetUID()); + this->SetMode(NULL, cm, user->GetUID(), false); /* Now if this contains a symbol don't give any more modes, to prevent setting +qaohv etc on users */ giving = !cm->symbol; given = true; @@ -824,7 +824,7 @@ void Channel::SetCorrectModes(User *user, bool give_modes) if (cm->name == "VOICE") take_modes = false; else - this->RemoveMode(NULL, cm, user->GetUID()); + this->RemoveMode(NULL, cm, user->GetUID(), false); } } } diff --git a/src/logger.cpp b/src/logger.cpp index e094f8da5..02b94f49c 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -148,8 +148,7 @@ Anope::string Log::BuildPrefix() const if (!this->c && !(this->u || this->nc)) break; buffer += "ADMIN: "; - size_t sl = this->c->name.find('/'); - Anope::string cname = sl != Anope::string::npos ? this->c->name.substr(sl + 1) : this->c->name; + Anope::string cname = source != NULL ? source->command : this->c->name; if (this->u) buffer += this->u->GetMask() + " used " + cname + " "; else if (this->nc) @@ -163,8 +162,7 @@ Anope::string Log::BuildPrefix() const if (!this->c && !(this->u || this->nc)) break; buffer += "OVERRIDE: "; - size_t sl = this->c->name.find('/'); - Anope::string cname = sl != Anope::string::npos ? this->c->name.substr(sl + 1) : this->c->name; + Anope::string cname = source != NULL ? source->command : this->c->name; if (this->u) buffer += this->u->GetMask() + " used " + cname + " "; else if (this->nc) @@ -178,8 +176,7 @@ Anope::string Log::BuildPrefix() const if (!this->c) break; buffer += "COMMAND: "; - size_t sl = this->c->name.find('/'); - Anope::string cname = sl != Anope::string::npos ? this->c->name.substr(sl + 1) : this->c->name; + Anope::string cname = source != NULL ? source->command : this->c->name; if (this->u) buffer += this->u->GetMask() + " used " + cname + " "; else if (this->source) diff --git a/src/nickalias.cpp b/src/nickalias.cpp index 488017346..080bf5ce5 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -140,7 +140,6 @@ void NickAlias::Serialize(Serialize::Data &data) const data.SetType("time_registered", Serialize::Data::DT_INT); data["time_registered"] << this->time_registered; data.SetType("time_registered", Serialize::Data::DT_INT); data["last_seen"] << this->last_seen; data["nc"] << this->nc->display; - Extensible::ExtensibleSerialize(this, this, data); if (this->HasVhost()) { @@ -149,6 +148,8 @@ void NickAlias::Serialize(Serialize::Data &data) const data["vhost_creator"] << this->GetVhostCreator(); data["vhost_time"] << this->GetVhostCreated(); } + + Extensible::ExtensibleSerialize(this, this, data); } Serializable* NickAlias::Unserialize(Serializable *obj, Serialize::Data &data) @@ -189,7 +190,6 @@ Serializable* NickAlias::Unserialize(Serializable *obj, Serialize::Data &data) data["last_realhost"] >> na->last_realhost; data["time_registered"] >> na->time_registered; data["last_seen"] >> na->last_seen; - Extensible::ExtensibleUnserialize(na, na, data); Anope::string vhost_ident, vhost_host, vhost_creator; time_t vhost_time; @@ -201,6 +201,8 @@ Serializable* NickAlias::Unserialize(Serializable *obj, Serialize::Data &data) na->SetVhost(vhost_ident, vhost_host, vhost_creator, vhost_time); + Extensible::ExtensibleUnserialize(na, na, data); + /* compat */ bool b; b = false; diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 57d7ad41d..0f09784c5 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -68,12 +68,12 @@ void NickCore::Serialize(Serialize::Data &data) const data["pass"] << this->pass; data["email"] << this->email; data["language"] << this->language; - Extensible::ExtensibleSerialize(this, this, data); for (unsigned i = 0; i < this->access.size(); ++i) data["access"] << this->access[i] << " "; data["memomax"] << this->memos.memomax; for (unsigned i = 0; i < this->memos.ignores.size(); ++i) data["memoignores"] << this->memos.ignores[i] << " "; + Extensible::ExtensibleSerialize(this, this, data); } Serializable* NickCore::Unserialize(Serializable *obj, Serialize::Data &data) @@ -92,7 +92,6 @@ Serializable* NickCore::Unserialize(Serializable *obj, Serialize::Data &data) data["pass"] >> nc->pass; data["email"] >> nc->email; data["language"] >> nc->language; - Extensible::ExtensibleUnserialize(nc, nc, data); { Anope::string buf; data["access"] >> buf; @@ -111,6 +110,8 @@ Serializable* NickCore::Unserialize(Serializable *obj, Serialize::Data &data) nc->memos.ignores.push_back(buf); } + Extensible::ExtensibleUnserialize(nc, nc, data); + /* compat */ bool b; b = false; diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 85b1f5b68..c2119453b 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -220,7 +220,6 @@ void ChannelInfo::Serialize(Serialize::Data &data) const data["last_topic_setter"] << this->last_topic_setter; data.SetType("last_topic_time", Serialize::Data::DT_INT); data["last_topic_time"] << this->last_topic_time; data.SetType("bantype", Serialize::Data::DT_INT); data["bantype"] << this->bantype; - Extensible::ExtensibleSerialize(this, this, data); { Anope::string levels_buffer; for (Anope::map::const_iterator it = this->levels.begin(), it_end = this->levels.end(); it != it_end; ++it) @@ -233,6 +232,8 @@ void ChannelInfo::Serialize(Serialize::Data &data) const data["memomax"] << this->memos.memomax; for (unsigned i = 0; i < this->memos.ignores.size(); ++i) data["memoignores"] << this->memos.ignores[i] << " "; + + Extensible::ExtensibleSerialize(this, this, data); } Serializable* ChannelInfo::Unserialize(Serializable *obj, Serialize::Data &data) @@ -251,8 +252,6 @@ Serializable* ChannelInfo::Unserialize(Serializable *obj, Serialize::Data &data) else ci = new ChannelInfo(sname); - Extensible::ExtensibleUnserialize(ci, ci, data); - ci->SetFounder(NickCore::Find(sfounder)); ci->SetSuccessor(NickCore::Find(ssuccessor)); @@ -288,6 +287,8 @@ Serializable* ChannelInfo::Unserialize(Serializable *obj, Serialize::Data &data) ci->memos.ignores.push_back(buf); } + Extensible::ExtensibleUnserialize(ci, ci, data); + /* compat */ bool b; b = false; diff --git a/src/servers.cpp b/src/servers.cpp index c3ec328f9..d4c76a217 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -109,11 +109,20 @@ Server::Server(Server *up, const Anope::string &sname, unsigned shops, const Ano for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) { Channel *c = it->second; + if (c->users.empty()) IRCD->SendChannel(c); else for (Channel::ChanUserList::const_iterator cit = c->users.begin(), cit_end = c->users.end(); cit != cit_end; ++cit) IRCD->SendJoin(cit->second->user, c, &cit->second->status); + + for (Channel::ModeList::const_iterator it2 = c->GetModes().begin(); it2 != c->GetModes().end(); ++it2) + { + ChannelMode *cm = ModeManager::FindChannelModeByName(it2->first); + if (!cm || cm->type != MODE_LIST) + continue; + ModeManager::StackerAdd(c->ci->WhoSends(), c, cm, true, it2->second); + } } } } -- cgit