diff options
author | Adam <Adam@anope.org> | 2013-07-20 02:55:25 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-20 03:06:20 -0400 |
commit | 6db01869479c878753fc6da49f2fb0bc44511359 (patch) | |
tree | 130e3afdc6d524eae1bb9a083dd60c84f523e1cb | |
parent | 492eac20a8e2dfdbdbd5a83e41ed880af76cff79 (diff) |
Fix not setting the correct compile flags on modules and fix the resulting warnings
-rw-r--r-- | include/modules.h | 3 | ||||
-rw-r--r-- | modules/CMakeLists.txt | 2 | ||||
-rw-r--r-- | modules/commands/bs_kick.cpp | 2 | ||||
-rw-r--r-- | modules/commands/cs_akick.cpp | 4 | ||||
-rw-r--r-- | modules/commands/cs_entrymsg.cpp | 5 | ||||
-rw-r--r-- | modules/commands/cs_mode.cpp | 26 | ||||
-rw-r--r-- | modules/commands/cs_seen.cpp | 3 | ||||
-rw-r--r-- | modules/commands/ms_read.cpp | 2 | ||||
-rw-r--r-- | modules/commands/ns_cert.cpp | 2 | ||||
-rw-r--r-- | modules/commands/os_config.cpp | 4 | ||||
-rw-r--r-- | modules/database/db_plain.cpp | 2 | ||||
-rw-r--r-- | modules/database/db_redis.cpp | 20 | ||||
-rw-r--r-- | modules/m_redis.cpp | 12 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 1 | ||||
-rw-r--r-- | modules/pseudoclients/chanserv.cpp | 10 | ||||
-rw-r--r-- | src/channels.cpp | 5 |
16 files changed, 53 insertions, 50 deletions
diff --git a/include/modules.h b/include/modules.h index c725152eb..98bb02f23 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1001,9 +1001,8 @@ class CoreExport Module : public Extensible /** Called when a channels modes are being checked to see if they are allowed, * mostly to ensure mlock/+r are set. * @param c The channel - * @return EVENT_STOP to stop checking modes */ - virtual EventReturn OnCheckModes(Channel *c) { throw NotImplementedException(); } + virtual void OnCheckModes(Channel *c) { throw NotImplementedException(); } /** Called when a channel is synced. * Channels are synced after a sjoin is finished processing diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 928466e41..1e503d1c3 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -14,6 +14,8 @@ function(build_modules SRC) else(IS_DIRECTORY "${MODULE_SRC}") string(REGEX MATCH "\\.cpp$" CPP ${MODULE_SRC}) if(CPP) + set_source_files_properties(${MODULE_SRC} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") + file(RELATIVE_PATH FNAME ${SRC} ${MODULE_SRC}) # Convert the real source file extension to have a .so extension string(REGEX REPLACE "\\.cpp$" ".so" SO ${FNAME}) diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index b22dd9ccb..6f8c3cd65 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -41,7 +41,7 @@ struct KickerDataImpl : KickerData struct ExtensibleItem : ::ExtensibleItem<KickerDataImpl> { - ExtensibleItem(Module *m, const Anope::string &name) : ::ExtensibleItem<KickerDataImpl>(m, name) { } + ExtensibleItem(Module *m, const Anope::string &ename) : ::ExtensibleItem<KickerDataImpl>(m, ename) { } void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override { diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index 3764c54fc..7bfed5419 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -528,8 +528,8 @@ class CSAKick : public Module kick = autokick->nc == u->Account(); else if (IRCD->IsChannelValid(autokick->mask)) { - Channel *c = Channel::Find(autokick->mask); - kick = c != NULL && c->FindUser(u); + Channel *chan = Channel::Find(autokick->mask); + kick = chan != NULL && chan->FindUser(u); } else kick = Entry("BAN", autokick->mask).Matches(u); diff --git a/modules/commands/cs_entrymsg.cpp b/modules/commands/cs_entrymsg.cpp index ca521a82c..aaa4f8d85 100644 --- a/modules/commands/cs_entrymsg.cpp +++ b/modules/commands/cs_entrymsg.cpp @@ -257,8 +257,9 @@ class CSEntryMessage : public Module public: CSEntryMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - commandentrymsg(this), eml(this, "entrymsg"), - entrymsg_type("EntryMsg", EntryMsg::Unserialize) + commandentrymsg(this), + entrymsg_type("EntryMsg", EntryMsg::Unserialize), + eml(this, "entrymsg") { } diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index b0a2e2b91..f38333265 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -864,14 +864,14 @@ class CSMode : public Module } } - EventReturn OnCheckModes(Channel *c) anope_override + void OnCheckModes(Channel *c) anope_override { if (!c->ci) - return EVENT_CONTINUE; + return; - ModeLocks *ml = modelocks.Get(c->ci); - if (ml) - for (ModeLocks::ModeList::const_iterator it = ml->GetMLock().begin(), it_end = ml->GetMLock().end(); it != it_end; ++it) + ModeLocks *locks = modelocks.Get(c->ci); + if (locks) + for (ModeLocks::ModeList::const_iterator it = locks->GetMLock().begin(), it_end = locks->GetMLock().end(); it != it_end; ++it) { const ModeLock *ml = *it; ChannelMode *cm = ModeManager::FindChannelModeByName(ml->name); @@ -924,6 +924,8 @@ class CSMode : public Module if (ml->HasMLock(mode, param, false)) c->RemoveMode(c->ci->WhoSends(), mode, param); + + return EVENT_CONTINUE; } EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) anope_override @@ -937,25 +939,27 @@ class CSMode : public Module if (ml->HasMLock(mode, param, true)) c->SetMode(c->ci->WhoSends(), mode, param); + + return EVENT_CONTINUE; } void OnCreateChan(ChannelInfo *ci) anope_override { ModeLocks *ml = modelocks.Require(ci); - Anope::string modes; + Anope::string mlock; spacesepstream sep(Config->GetModule(this)->Get<const Anope::string>("mlock", "+nrt")); - if (sep.GetToken(modes)) + if (sep.GetToken(mlock)) { bool add = true; - for (unsigned i = 0; i < modes.length(); ++i) + for (unsigned i = 0; i < mlock.length(); ++i) { - if (modes[i] == '+') + if (mlock[i] == '+') add = true; - else if (modes[i] == '-') + else if (mlock[i] == '-') add = false; else { - ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[i]); + ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock[i]); Anope::string param; if (cm && (cm->type == MODE_REGULAR || sep.GetToken(param))) ml->SetMLock(cm, add, param); diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index 48231576e..7fa7d3c7a 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -306,7 +306,8 @@ class CSSeen : public Module void OnExpireTick() anope_override { - size_t previous_size = database.size(), purgetime = Config->GetModule(this)->Get<time_t>("purgetime"); + size_t previous_size = database.size(); + time_t purgetime = Config->GetModule(this)->Get<time_t>("purgetime"); if (!purgetime) purgetime = Anope::DoTime("30d"); for (database_map::iterator it = database.begin(), it_end = database.end(); it != it_end;) diff --git a/modules/commands/ms_read.cpp b/modules/commands/ms_read.cpp index 8c1ebc9ba..4da9e3478 100644 --- a/modules/commands/ms_read.cpp +++ b/modules/commands/ms_read.cpp @@ -79,10 +79,12 @@ class MemoListCallback : public NumberList BotInfo *bi; Anope::string cmd; if (Command::FindCommandFromService("memoserv/del", bi, cmd)) + { if (ci) source.Reply(_("To delete, type: \002%s%s %s %s %d\002"), Config->StrictPrivmsg.c_str(), bi->nick.c_str(), cmd.c_str(), ci->name.c_str(), index + 1); else source.Reply(_("To delete, type: \002%s%s %s %d\002"), Config->StrictPrivmsg.c_str(), bi->nick.c_str(), cmd.c_str(), index + 1); + } source.Reply("%s", m->text.c_str()); m->unread = false; diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index c87ff7179..561f89304 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -97,7 +97,7 @@ struct NSCertListImpl : NSCertList struct ExtensibleItem : ::ExtensibleItem<NSCertListImpl> { - ExtensibleItem(Module *m, const Anope::string &name) : ::ExtensibleItem<NSCertListImpl>(m, name) { } + ExtensibleItem(Module *m, const Anope::string &ename) : ::ExtensibleItem<NSCertListImpl>(m, ename) { } void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override { diff --git a/modules/commands/os_config.cpp b/modules/commands/os_config.cpp index a9ff515fb..91987ef80 100644 --- a/modules/commands/os_config.cpp +++ b/modules/commands/os_config.cpp @@ -69,8 +69,8 @@ class CommandOSConfig : public Command source.Reply(_("%s settings:"), block->GetName().c_str()); - for (unsigned i = 0; i < replies.size(); ++i) - source.Reply(replies[i]); + for (unsigned j = 0; j < replies.size(); ++j) + source.Reply(replies[j]); } source.Reply(_("End of configuration.")); diff --git a/modules/database/db_plain.cpp b/modules/database/db_plain.cpp index 62ecaaaa0..69fafea99 100644 --- a/modules/database/db_plain.cpp +++ b/modules/database/db_plain.cpp @@ -279,7 +279,7 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co ci->Extend<bool>(params[i]); else if (params[0].equals_ci("TTB")) { - for (unsigned j = 1, end = params.size(); j < end &&& kd; j += 2) + for (unsigned j = 1, end = params.size(); j < end && kd; j += 2) { if (params[j].equals_ci("BOLDS")) kd->ttb[0] = params[j + 1].is_pos_number_only() ? convertTo<int16_t>(params[j + 1]) : 0; diff --git a/modules/database/db_redis.cpp b/modules/database/db_redis.cpp index e78134857..20cf19a69 100644 --- a/modules/database/db_redis.cpp +++ b/modules/database/db_redis.cpp @@ -137,11 +137,11 @@ class DatabaseRedis : public Module, public Pipe /* Insert or update an object */ void InsertObject(Serializable *obj) { - Serialize::Type *type = obj->GetSerializableType(); + Serialize::Type *t = obj->GetSerializableType(); /* If there is no id yet for ths object, get one */ if (!obj->id) - redis->SendCommand(new IDInterface(this, obj), "INCR id:" + type->GetName()); + redis->SendCommand(new IDInterface(this, obj), "INCR id:" + t->GetName()); else { Data data; @@ -154,10 +154,10 @@ class DatabaseRedis : public Module, public Pipe std::vector<Anope::string> args; args.push_back("HGETALL"); - args.push_back("hash:" + type->GetName() + ":" + stringify(obj->id)); + args.push_back("hash:" + t->GetName() + ":" + stringify(obj->id)); /* Get object attrs to clear before updating */ - redis->SendCommand(new Updater(this, type->GetName(), obj->id), args); + redis->SendCommand(new Updater(this, t->GetName(), obj->id), args); } } @@ -215,17 +215,17 @@ class DatabaseRedis : public Module, public Pipe void OnSerializableDestruct(Serializable *obj) anope_override { - Serialize::Type *type = obj->GetSerializableType(); + Serialize::Type *t = obj->GetSerializableType(); std::vector<Anope::string> args; args.push_back("HGETALL"); - args.push_back("hash:" + type->GetName() + ":" + stringify(obj->id)); + args.push_back("hash:" + t->GetName() + ":" + stringify(obj->id)); /* Get all of the attributes for this object */ - redis->SendCommand(new Deleter(this, type->GetName(), obj->id), args); + redis->SendCommand(new Deleter(this, t->GetName(), obj->id), args); this->updated_items.erase(obj); - type->objects.erase(obj->id); + t->objects.erase(obj->id); this->Notify(); } @@ -530,12 +530,12 @@ void SubscriptionListener::OnResult(const Reply &r) typedef std::map<Anope::string, std::stringstream *> items; for (items::iterator it = data.data.begin(), it_end = data.data.end(); it != it_end; ++it) { - const Anope::string &key = it->first; + const Anope::string &k = it->first; std::stringstream *value = it->second; std::vector<Anope::string> args; args.push_back("SREM"); - args.push_back("value:" + type + ":" + key + ":" + value->str()); + args.push_back("value:" + type + ":" + k + ":" + value->str()); args.push_back(id); /* Delete value -> object id */ diff --git a/modules/m_redis.cpp b/modules/m_redis.cpp index 7a7ca87ed..d8cec8243 100644 --- a/modules/m_redis.cpp +++ b/modules/m_redis.cpp @@ -23,7 +23,7 @@ class RedisSocket : public BinarySocket, public ConnectionSocket std::deque<Interface *> interfaces; std::map<Anope::string, Interface *> subinterfaces; - RedisSocket(MyRedisService *pro, bool ipv6) : Socket(-1, ipv6), provider(pro) { } + RedisSocket(MyRedisService *pro, bool v6) : Socket(-1, v6), provider(pro) { } ~RedisSocket(); @@ -395,7 +395,7 @@ size_t RedisSocket::ParseReply(Reply &r, const char *buffer, size_t l) else break; } - else if (r.multi_bulk.size() == r.multi_bulk_size) + else if (r.multi_bulk_size >= 0 && r.multi_bulk.size() == static_cast<unsigned>(r.multi_bulk_size)) { /* This multi bulk is already complete, so check the sub bulks */ for (unsigned i = 0; i < r.multi_bulk.size(); ++i) @@ -553,14 +553,14 @@ class ModuleRedis : public Module { Configuration::Block *redis = block->GetBlock("redis", i); - const Anope::string &name = redis->Get<const Anope::string>("name"), + const Anope::string &n = redis->Get<const Anope::string>("name"), &ip = redis->Get<const Anope::string>("ip"); int port = redis->Get<int>("port"); unsigned db = redis->Get<unsigned>("db"); - delete services[name]; - services[name] = new MyRedisService(this, name, ip, port, db); - new_services.push_back(name); + delete services[n]; + services[n] = new MyRedisService(this, n, ip, port, db); + new_services.push_back(n); } for (std::map<Anope::string, MyRedisService *>::iterator it = services.begin(); it != services.end();) diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 9c5701d21..91a588f5a 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -181,7 +181,6 @@ struct IRCDMessageEncap : IRCDMessage if (params[1].equals_cs("SU")) { User *u = User::Find(params[2]); - const NickAlias *user_na = NickAlias::Find(params[2]); NickCore *nc = NickCore::Find(params[3]); if (u && nc) { diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp index b7fb67daf..be2c074ec 100644 --- a/modules/pseudoclients/chanserv.cpp +++ b/modules/pseudoclients/chanserv.cpp @@ -231,7 +231,7 @@ class ChanServCore : public Module, public ChanServService "lists and settings for any channel.")); } - EventReturn OnCheckModes(Channel *c) anope_override + void OnCheckModes(Channel *c) anope_override { const Anope::string &require = Config->GetModule(this)->Get<const Anope::string>("require", "r"); if (!require.empty()) @@ -241,8 +241,6 @@ class ChanServCore : public Module, public ChanServService else c->SetModes(NULL, false, "-%s", require.c_str()); } - - return EVENT_CONTINUE; } void OnCreateChan(ChannelInfo *ci) anope_override @@ -354,12 +352,12 @@ class ChanServCore : public Module, public ChanServService ChannelInfo *ci = it->second; if (persist->Get(ci)) { - bool created; - ci->c = Channel::FindOrCreate(ci->name, created, ci->time_registered); + bool c; + ci->c = Channel::FindOrCreate(ci->name, c, ci->time_registered); if (ModeManager::FindChannelModeByName("PERM") != NULL) { - if (created) + if (c) IRCD->SendChannel(ci->c); ci->c->SetMode(NULL, "PERM"); } diff --git a/src/channels.cpp b/src/channels.cpp index 0b790e54e..58083df00 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -104,10 +104,7 @@ void Channel::CheckModes() return; } - EventReturn MOD_RESULT; - FOREACH_RESULT(OnCheckModes, MOD_RESULT, (this)); - if (MOD_RESULT == EVENT_STOP) - return; + FOREACH_MOD(OnCheckModes, (this)); } bool Channel::CheckDelete() |