mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-05 09:13:16 +02:00
Module devs: Add priorities for command overrides.
Use: CmdoverrideAddEx(module, name, priority, function) Suggested by Gottem in https://bugs.unrealircd.org/view.php?id=5143 ..and needed by some upcoming stuff.
This commit is contained in:
+8
-2
@@ -1446,7 +1446,7 @@ Efunction *p, *q;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Cmdoverride *CmdoverrideAdd(Module *module, char *name, iFP function)
|
||||
Cmdoverride *CmdoverrideAddEx(Module *module, char *name, int priority, iFP function)
|
||||
{
|
||||
aCommand *p;
|
||||
Cmdoverride *ovr;
|
||||
@@ -1469,6 +1469,7 @@ Cmdoverride *CmdoverrideAdd(Module *module, char *name, iFP function)
|
||||
ovr = MyMallocEx(sizeof(Cmdoverride));
|
||||
ovr->func = function;
|
||||
ovr->owner = module; /* TODO: module objects */
|
||||
ovr->priority = priority;
|
||||
if (module)
|
||||
{
|
||||
ModuleObject *cmdoverobj = MyMallocEx(sizeof(ModuleObject));
|
||||
@@ -1480,7 +1481,7 @@ Cmdoverride *CmdoverrideAdd(Module *module, char *name, iFP function)
|
||||
ovr->command = p;
|
||||
if (!p->overriders)
|
||||
p->overridetail = ovr;
|
||||
AddListItem(ovr, p->overriders);
|
||||
AddListItemPrio(ovr, p->overriders, ovr->priority);
|
||||
if (p->friend)
|
||||
{
|
||||
if (!p->friend->overriders)
|
||||
@@ -1490,6 +1491,11 @@ Cmdoverride *CmdoverrideAdd(Module *module, char *name, iFP function)
|
||||
return ovr;
|
||||
}
|
||||
|
||||
Cmdoverride *CmdoverrideAdd(Module *module, char *name, iFP function)
|
||||
{
|
||||
return CmdoverrideAddEx(module, name, 0, function);
|
||||
}
|
||||
|
||||
void CmdoverrideDel(Cmdoverride *cmd)
|
||||
{
|
||||
if (!cmd->next)
|
||||
|
||||
Reference in New Issue
Block a user