mirror of
https://github.com/anope/anope.git
synced 2026-07-02 20:03:12 +02:00
Fix not setting the correct compile flags on modules and fix the resulting warnings
This commit is contained in:
+1
-2
@@ -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
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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."));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
+6
-6
@@ -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();)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
+1
-4
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user