git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8520
e03df62e-2008-0410-955e-
edbf42e46eb7
* loaded modules in a readable simple way, e.g.:
* 'FOREACH_MOD(I_OnConnect,OnConnect(user));'
*/
* loaded modules in a readable simple way, e.g.:
* 'FOREACH_MOD(I_OnConnect,OnConnect(user));'
*/
-#define FOREACH_MOD(y,x) if (!ServerInstance->Modules->EventHandlers[y].empty()) \
+#define FOREACH_MOD(y,x) \
+for (EventHandlerIter _i = ServerInstance->Modules->EventHandlers[y].begin(); _i != ServerInstance->Modules->EventHandlers[y].end(); ++_i) \
- for (EventHandlerIter _i = ServerInstance->Modules->EventHandlers[y].begin(); _i != ServerInstance->Modules->EventHandlers[y].end(); ++_i) \
- try \
- { \
- (*_i)->x ; \
- } \
- catch (CoreException& modexcept) \
- { \
- ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
- } \
+ (*_i)->x ; \
+ } \
+ catch (CoreException& modexcept) \
+ { \
+ ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
* an instance pointer to the macro. e.g.:
* 'FOREACH_MOD_I(Instance, OnConnect, OnConnect(user));'
*/
* an instance pointer to the macro. e.g.:
* 'FOREACH_MOD_I(Instance, OnConnect, OnConnect(user));'
*/
-#define FOREACH_MOD_I(z,y,x) if (!z->Modules->EventHandlers[y].empty()) \
+#define FOREACH_MOD_I(z,y,x) \
+for (EventHandlerIter _i = z->Modules->EventHandlers[y].begin(); _i != z->Modules->EventHandlers[y].end(); ++_i) \
- for (EventHandlerIter _i = z->Modules->EventHandlers[y].begin(); _i != z->Modules->EventHandlers[y].end(); ++_i) \
- try \
- { \
- (*_i)->x ; \
- } \
- catch (CoreException& modexcept) \
- { \
- z->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
- } \
+ (*_i)->x ; \
+ } \
+ catch (CoreException& modexcept) \
+ { \
+ z->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
* The first module to return a nonzero result is the value to be accepted,
* and any modules after are ignored.
*/
* The first module to return a nonzero result is the value to be accepted,
* and any modules after are ignored.
*/
-#define FOREACH_RESULT(y,x) if (!ServerInstance->Modules->EventHandlers[y].empty()) \
-{ \
+#define FOREACH_RESULT(y,x) \
+do { \
MOD_RESULT = 0; \
for (EventHandlerIter _i = ServerInstance->Modules->EventHandlers[y].begin(); _i != ServerInstance->Modules->EventHandlers[y].end(); ++_i) \
{ \
MOD_RESULT = 0; \
for (EventHandlerIter _i = ServerInstance->Modules->EventHandlers[y].begin(); _i != ServerInstance->Modules->EventHandlers[y].end(); ++_i) \
{ \
ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
} \
} \
ServerInstance->Log(DEFAULT,"Exception caught: %s",modexcept.GetReason()); \
} \
} \
* The first module to return a nonzero result is the value to be accepted,
* and any modules after are ignored.
*/
* The first module to return a nonzero result is the value to be accepted,
* and any modules after are ignored.
*/
-#define FOREACH_RESULT_I(z,y,x) if (!z->Modules->EventHandlers[y].empty()) \
-{ \
+#define FOREACH_RESULT_I(z,y,x) \
+do { \
MOD_RESULT = 0; \
for (EventHandlerIter _i = z->Modules->EventHandlers[y].begin(); _i != z->Modules->EventHandlers[y].end(); ++_i) \
{ \
MOD_RESULT = 0; \
for (EventHandlerIter _i = z->Modules->EventHandlers[y].begin(); _i != z->Modules->EventHandlers[y].end(); ++_i) \
{ \
z->Log(DEBUG,"Exception caught: %s",modexcept.GetReason()); \
} \
} \
z->Log(DEBUG,"Exception caught: %s",modexcept.GetReason()); \
} \
} \
/** Represents a non-local user.
* (in fact, any FD less than -1 does)
/** Represents a non-local user.
* (in fact, any FD less than -1 does)