mirror of
https://github.com/anope/anope.git
synced 2026-06-24 22:26:37 +02:00
842b5609dc
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2648 5417fbe8-f217-4b02-8779-1006273d7864
43 lines
1.5 KiB
Plaintext
43 lines
1.5 KiB
Plaintext
Anope Internal Events
|
|
---------------------
|
|
|
|
1) Intro
|
|
2) Using Events
|
|
|
|
1) Introduction to Internal Events
|
|
|
|
Internal Events are setup to give module developers more information
|
|
about what the core is doing at different times. This information can
|
|
be as complex as data we are feeding to the uplink, to simple triggered
|
|
events such as the databases being saved.
|
|
|
|
Additionally there is a module included with the core
|
|
which can provide some clue as to how to use the code in your modules.
|
|
The rest of this document assumes that you are used to writing modules.
|
|
|
|
2) Using Events
|
|
|
|
Anope is told about modules wanting to hook to events by the function
|
|
ModuleManager::Attach(EventName, Module*);, eg:
|
|
|
|
ModuleManager::Attach(I_OnJoinChannel, this);
|
|
|
|
You can also specifcy an array of events:
|
|
|
|
Implementation i[] = { I_OnJoinChannel, I_OnPartChannel };
|
|
ModuleManager::Attach(i, this, 2);
|
|
Where 2 is the number of events in the list
|
|
|
|
You must then overload these functions in your main modules class.
|
|
The full list of functions and parameters are in modules.h. In this
|
|
case, you would be overloading OnJoinChannel() and OnPartChannel() like so:
|
|
|
|
void OnJoinChannel(User *u, Channel *c) { }
|
|
void OnPartChannel(User *u, Channel *c) { }
|
|
|
|
Some of these events can be used to prevent or allow things to happen that
|
|
would normally not be allowed or denied. You can also use ModuleManager
|
|
(not explained here) to set control which order the modules are queried
|
|
(when multiple modules hook to the same event).
|
|
|