mirror of
https://github.com/anope/anope.git
synced 2026-07-06 13:53:13 +02:00
Added events for module loading/unloading and command creation/deletion.
Enables modules expanding on other modules to adjust hooks if needed. - Related to bug #1263.
This commit is contained in:
@@ -3,6 +3,8 @@ Anope Version 1.8 - GIT
|
||||
10/31 A Added support for plexus3's channel mode +z [#1202]
|
||||
02/23 A Added account tracking support to ratbox protocol module [ #00]
|
||||
03/21 A Added support for Hybrid's m_services and m_change [ #00]
|
||||
03/28 A Added internal events called when a module is loaded/unloaded. [ #00]
|
||||
03/28 A Added internal events called when a command is added/deleted. [ #00]
|
||||
09/11 F Fixed db-convert handling some vhost collisions [ #00]
|
||||
09/14 F Fixed ./configure failing with partial SQL installations [ #00]
|
||||
09/28 F Fixed ForkForMail to always work [ #00]
|
||||
|
||||
+27
@@ -435,3 +435,30 @@ Anope Internal Events
|
||||
A user has left the network. This event is emitted before the internal
|
||||
removal is performed, so the user still exists internally.
|
||||
av[0] The nickname of the user leaving the network.
|
||||
|
||||
EVENT_MODLOAD
|
||||
A module has been loaded. This event is emitted after the loading
|
||||
sequence has been finished: AnopeInit() has been called and the
|
||||
module has already been added to the modules table.
|
||||
av[0] Name of the loaded module.
|
||||
|
||||
EVENT_MODUNLOAD
|
||||
A module has been unloaded. This event is emitted when the unloading
|
||||
sequence is almost complete: AnopeFini() has been called and all
|
||||
commands, hooks and callbacks have been removed. The module itself
|
||||
is still in memory however.
|
||||
av[0] Name of the unloaded module.
|
||||
|
||||
EVENT_ADDCOMMAND
|
||||
A command hook has been added to anopes command table.
|
||||
Note that the command may have previously existed and merely a new hook
|
||||
was added before or after an existing command hook.
|
||||
av[0] Name of the module adding the command.
|
||||
av[1] Name of the command hook that was added.
|
||||
|
||||
EVENT_DELCOMMAND
|
||||
A command hook has been removed from anopes command table.
|
||||
Note that the command may still exist in anopes command table if other
|
||||
modules have hooks for the same command.
|
||||
av[0] Name of the module deleting the command.
|
||||
av[1] Name of the command hook that was removed.
|
||||
|
||||
@@ -64,3 +64,7 @@
|
||||
#define EVENT_ACCESS_CLEAR "access_clear"
|
||||
#define EVENT_NICK_LOGOUT "nick_logout"
|
||||
#define EVENT_CHAN_KICK "chan_kick"
|
||||
#define EVENT_MODLOAD "modload"
|
||||
#define EVENT_MODUNLOAD "modunload"
|
||||
#define EVENT_ADDCOMMAND "addcommand"
|
||||
#define EVENT_DELCOMMAND "delcommand"
|
||||
|
||||
@@ -713,6 +713,10 @@ int loadModule(Module * m, User * u)
|
||||
notice_lang(s_OperServ, u, OPER_MODULE_LOADED, m->name);
|
||||
}
|
||||
addModule(m);
|
||||
|
||||
/* Loading is complete.. send out an event in case anyone s interested.. ~ Viper */
|
||||
send_event(EVENT_MODLOAD, 1, m->name);
|
||||
|
||||
return MOD_ERR_OK;
|
||||
|
||||
#else
|
||||
@@ -761,6 +765,10 @@ int unloadModule(Module * m, User * u)
|
||||
return MOD_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Unloading is complete: AnopeFini has been called and all commands, hooks and callbacks
|
||||
* have been removed.. send out an event in case anyone s interested.. ~ Viper */
|
||||
send_event(EVENT_MODUNLOAD, 1, m->name);
|
||||
|
||||
if ((ano_modclose(m->handle)) != 0) {
|
||||
alog("%s", ano_moderr());
|
||||
if (u) {
|
||||
@@ -1277,6 +1285,7 @@ int addCommand(CommandHash * cmdTable[], Command * c, int pos)
|
||||
if (debug)
|
||||
alog("debug: existing cmd: (0x%p), new cmd (0x%p)",
|
||||
(void *) c->next, (void *) c);
|
||||
send_event(EVENT_ADDCOMMAND, 2, c->mod_name, c->name);
|
||||
return MOD_ERR_OK;
|
||||
} else if (pos == 2) {
|
||||
|
||||
@@ -1289,6 +1298,7 @@ int addCommand(CommandHash * cmdTable[], Command * c, int pos)
|
||||
tail->next = c;
|
||||
c->next = NULL;
|
||||
|
||||
send_event(EVENT_ADDCOMMAND, 2, c->mod_name, c->name);
|
||||
return MOD_ERR_OK;
|
||||
} else
|
||||
return MOD_ERR_EXISTS;
|
||||
@@ -1308,6 +1318,7 @@ int addCommand(CommandHash * cmdTable[], Command * c, int pos)
|
||||
else
|
||||
lastHash->next = newHash;
|
||||
|
||||
send_event(EVENT_ADDCOMMAND, 2, c->mod_name, c->name);
|
||||
return MOD_ERR_OK;
|
||||
}
|
||||
|
||||
@@ -1343,6 +1354,7 @@ int delCommand(CommandHash * cmdTable[], Command * c, char *mod_name)
|
||||
} else {
|
||||
current->c = tail->next;
|
||||
}
|
||||
send_event(EVENT_DELCOMMAND, 2, c->mod_name, c->name);
|
||||
return MOD_ERR_OK;
|
||||
}
|
||||
last = tail;
|
||||
@@ -1351,6 +1363,7 @@ int delCommand(CommandHash * cmdTable[], Command * c, char *mod_name)
|
||||
} else {
|
||||
cmdTable[index] = current->next;
|
||||
free(current->name);
|
||||
send_event(EVENT_DELCOMMAND, 2, c->mod_name, c->name);
|
||||
return MOD_ERR_OK;
|
||||
}
|
||||
} else {
|
||||
@@ -1364,6 +1377,7 @@ int delCommand(CommandHash * cmdTable[], Command * c, char *mod_name)
|
||||
} else {
|
||||
current->c = tail->next;
|
||||
}
|
||||
send_event(EVENT_DELCOMMAND, 2, c->mod_name, c->name);
|
||||
return MOD_ERR_OK;
|
||||
}
|
||||
last = tail;
|
||||
@@ -1372,6 +1386,7 @@ int delCommand(CommandHash * cmdTable[], Command * c, char *mod_name)
|
||||
} else {
|
||||
lastHash->next = current->next;
|
||||
free(current->name);
|
||||
send_event(EVENT_DELCOMMAND, 2, c->mod_name, c->name);
|
||||
return MOD_ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -8,9 +8,10 @@ VERSION_MAJOR="1"
|
||||
VERSION_MINOR="8"
|
||||
VERSION_PATCH="5"
|
||||
VERSION_EXTRA="-git"
|
||||
VERSION_BUILD="3067"
|
||||
VERSION_BUILD="3068"
|
||||
|
||||
# $Log$ # Changes since 1.8.5 Release
|
||||
#Revision 3068 - Added events for module loading/unloading and command creation/deletion. Enables modules expanding on other modules to adjust hooks if needed. - Related to bug #1263.
|
||||
#Revision 3067 - Fixed bug #1252 - The group display nick showing in HS req memos instead of the requesting alias. Also cleaned up the mess in Changes...
|
||||
#Revision 3066 - Added support m_services.c and m_change.c from Hybrid's contrib folder
|
||||
#Revision 3065 - Change to users masked host instead of the real one after turning vhost off in inspircd.
|
||||
|
||||
Reference in New Issue
Block a user