mirror of
https://github.com/anope/anope.git
synced 2026-07-06 08:13:13 +02:00
Don't dynamically allocate commands in modules anymore, instead made them members of modules. This means the commands are automatically destructed when the module is unloaded. Cleans up some old ugly code.
This commit is contained in:
+13
-7
@@ -626,15 +626,21 @@ class CommandCSVOP : public XOPBase
|
||||
|
||||
class CSXOP : public Module
|
||||
{
|
||||
CommandCSQOP commandcsqop;
|
||||
CommandCSSOP commandcssop;
|
||||
CommandCSAOP commandcsaop;
|
||||
CommandCSHOP commandcshop;
|
||||
CommandCSVOP commandcsvop;
|
||||
|
||||
public:
|
||||
CSXOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator)
|
||||
{
|
||||
this->SetAuthor("Anope");
|
||||
this->SetType(CORE);
|
||||
|
||||
this->AddCommand(ChanServ, new CommandCSSOP());
|
||||
this->AddCommand(ChanServ, new CommandCSAOP());
|
||||
this->AddCommand(ChanServ, new CommandCSVOP());
|
||||
this->AddCommand(ChanServ, &commandcssop);
|
||||
this->AddCommand(ChanServ, &commandcsaop);
|
||||
this->AddCommand(ChanServ, &commandcsvop);
|
||||
|
||||
if (Me && Me->IsSynced())
|
||||
OnUplinkSync(NULL);
|
||||
@@ -646,15 +652,15 @@ class CSXOP : public Module
|
||||
void OnUplinkSync(Server *)
|
||||
{
|
||||
if (ModeManager::FindChannelModeByName(CMODE_OWNER))
|
||||
this->AddCommand(ChanServ, new CommandCSQOP());
|
||||
this->AddCommand(ChanServ, &commandcsqop);
|
||||
if (ModeManager::FindChannelModeByName(CMODE_HALFOP))
|
||||
this->AddCommand(ChanServ, new CommandCSHOP());
|
||||
this->AddCommand(ChanServ, &commandcshop);
|
||||
}
|
||||
|
||||
void OnServerDisconnect()
|
||||
{
|
||||
this->DelCommand(ChanServ, FindCommand(ChanServ, "QOP"));
|
||||
this->DelCommand(ChanServ, FindCommand(ChanServ, "HOP"));
|
||||
this->DelCommand(ChanServ, &commandcsqop);
|
||||
this->DelCommand(ChanServ, &commandcshop);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user