summaryrefslogtreecommitdiff
path: root/docs/EVENTS
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@anope.org>2013-10-06 22:07:01 +0200
committerDukePyrolator <DukePyrolator@anope.org>2013-10-06 22:07:01 +0200
commit775566867944111eda89cac9dc12ce427dff81a7 (patch)
tree4c884c9d97280e6918cfa37df118bbfc0427fb27 /docs/EVENTS
parent569efbb66bac4481f2891c6aca0afa788295987f (diff)
updated docs/EVENTS
Diffstat (limited to 'docs/EVENTS')
-rw-r--r--docs/EVENTS35
1 files changed, 14 insertions, 21 deletions
diff --git a/docs/EVENTS b/docs/EVENTS
index e6b97fbb3..ba34f0571 100644
--- a/docs/EVENTS
+++ b/docs/EVENTS
@@ -9,34 +9,27 @@ Anope 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.
+ 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.
+ 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.
+ Each Event in Anope calls a function.
+ You must override 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:
+ case, you would be overriding OnJoinChannel() and OnPartChannel() like so:
+
+ void OnJoinChannel(User *u, Channel *c) anope_override { }
+ void OnPartChannel(User *u, Channel *c) anope_override { }
- void OnJoinChannel(User *u, Channel *c) { }
- void OnPartChannel(User *u, Channel *c) { }
+ Some of these event overrides 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).
- 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).
+ The "anope_override" identifier is for compatibility with C++11.
+ Its usage is highly recommended.