mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
Add the type to the Extensible class.
This commit is contained in:
parent
f6559895b2
commit
7d3055f8c3
@ -135,6 +135,9 @@ public:
|
||||
/** Allows extensions to access the extension store. */
|
||||
friend class ExtensionItem;
|
||||
|
||||
/** The type of extensible that this is. */
|
||||
const ExtensionType extype:2;
|
||||
|
||||
~Extensible() override;
|
||||
|
||||
/** @copydoc Cullable::Cull */
|
||||
@ -158,7 +161,7 @@ public:
|
||||
void UnhookExtensions(const std::vector<ExtensionItem*>& items);
|
||||
|
||||
protected:
|
||||
Extensible();
|
||||
Extensible(ExtensionType exttype);
|
||||
|
||||
private:
|
||||
/** The values for extensions which are set on this extensible. */
|
||||
|
@ -73,7 +73,12 @@ public:
|
||||
* Call Channel::JoinUser() or ForceJoin() to make a user join a channel instead of constructing
|
||||
* Membership objects directly.
|
||||
*/
|
||||
Membership(User* u, Channel* c) : user(u), chan(c) {}
|
||||
Membership(User* u, Channel* c)
|
||||
: Extensible(ExtensionType::MEMBERSHIP)
|
||||
, user(u)
|
||||
, chan(c)
|
||||
{
|
||||
}
|
||||
|
||||
/** Check if this member has a given prefix mode set
|
||||
* @param pm Prefix mode to check
|
||||
|
@ -34,7 +34,8 @@ namespace
|
||||
}
|
||||
|
||||
Channel::Channel(const std::string &cname, time_t ts)
|
||||
: name(cname)
|
||||
: Extensible(ExtensionType::CHANNEL)
|
||||
, name(cname)
|
||||
, age(ts)
|
||||
{
|
||||
if (!ServerInstance->Channels.GetChans().emplace(cname, this).second)
|
||||
|
@ -47,8 +47,9 @@ ExtensionItem* ExtensionManager::GetItem(const std::string& name)
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
Extensible::Extensible()
|
||||
: culled(false)
|
||||
Extensible::Extensible(ExtensionType exttype)
|
||||
: extype(exttype)
|
||||
, culled(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -851,9 +851,8 @@ void ModuleSpanningTree::OnShutdown(const std::string& reason)
|
||||
void ModuleSpanningTree::OnDecodeMetaData(Extensible* target, const std::string& extname, const std::string& extdata)
|
||||
{
|
||||
// HACK: this should use automatically synced user metadata in v4.
|
||||
User* dest = static_cast<User*>(target);
|
||||
if (dest && (extname == "uniqueusername"))
|
||||
dest->uniqueusername = (extdata != "0");
|
||||
if (target->extype == ExtensionType::USER && irc::equals(extname, "uniqueusername"))
|
||||
static_cast<User*>(target)->uniqueusername = (extdata != "0");
|
||||
}
|
||||
|
||||
Cullable::Result ModuleSpanningTree::Cull()
|
||||
|
@ -143,9 +143,8 @@ public:
|
||||
|
||||
void OnDecodeMetaData(Extensible* target, const std::string& extname, const std::string&) override
|
||||
{
|
||||
User* dest = static_cast<User*>(target);
|
||||
if (dest && (extname == "swhois"))
|
||||
cmd.operblock.Unset(dest);
|
||||
if (target->extype == ExtensionType::USER && irc::equals(extname, "swhois"))
|
||||
cmd.operblock.Unset(static_cast<User*>(target));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,8 @@ std::string User::GetModeLetters(bool includeparams) const
|
||||
}
|
||||
|
||||
User::User(const std::string& uid, Server* srv, Type type)
|
||||
: age(ServerInstance->Time())
|
||||
: Extensible(ExtensionType::USER)
|
||||
, age(ServerInstance->Time())
|
||||
, uuid(uid)
|
||||
, server(srv)
|
||||
, registered(REG_NONE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user