class AccountExtItemImpl : public AccountExtItem
{
+ Events::ModuleEventProvider eventprov;
+
public:
AccountExtItemImpl(Module* mod)
- : AccountExtItem("accountname", mod)
+ : AccountExtItem("accountname", ExtensionItem::EXT_USER, mod)
+ , eventprov(mod, "event/account")
{
}
void unserialize(SerializeFormat format, Extensible* container, const std::string& value)
{
- User* user = dynamic_cast<User*>(container);
- if (!user)
- return;
+ User* user = static_cast<User*>(container);
StringExtItem::unserialize(format, container, value);
if (!value.empty())
user->WriteNumeric(900, "%s %s :You are now logged in as %s",
user->GetFullHost().c_str(), value.c_str(), value.c_str());
}
-
- AccountEvent(creator, user, value).Send();
- }
- else
- {
- // Logged out
- AccountEvent(creator, user, "").Send();
}
+ // If value is empty then logged out
+
+ FOREACH_MOD_CUSTOM(eventprov, AccountEventListener, OnAccountChange, (user, value));
}
};
public:
ModuleServicesAccount() : m1(this), m2(this), m3(this), m4(this), m5(this),
accountname(this)
+ , checking_ban(false)
{
}