]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Added "HOOK_CORE_STOPERROR" which is triggered immediately before Error()
authorsplidge <redacted>
Fri, 1 Jun 2007 14:47:30 +0000 (15:47 +0100)
committersplidge <redacted>
Fri, 1 Jun 2007 14:47:30 +0000 (15:47 +0100)
calls exit for ERR_STOP events.

This allows modules to take any emergency action they can before the service
dies.

core/error.c
core/hooks.h

index 7a98081f3c6fd277a77614647cca2006a27498c1..a7d0d9955996883ec042f82371103b9d358c247d 100644 (file)
@@ -3,7 +3,9 @@
 #include <stdarg.h>
 #include <time.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include "error.h"
+#include "hooks.h"
 
 char *sevtostring(int severity) {
   switch(severity) {
@@ -50,6 +52,7 @@ void Error(char *source, int severity, char *reason, ... ) {
   
   if (severity>=ERR_STOP) {
     fprintf(stderr,"Terminal error occured, exiting...\n");
+    triggerhook(HOOK_CORE_STOPERROR, NULL);
     exit(0);
   }
 }
index 09e506eb9d7ac33ed7a1a92fb5708dfe7f92d2ad..d778127e965cf3a942f7efc185d3a9911a6b70b7 100644 (file)
@@ -11,6 +11,7 @@
 #define HOOK_CORE_STATSREQUEST       1
 #define HOOK_CORE_STATSREPLY         2
 #define HOOK_CORE_ENDOFHOOKSQUEUE    3
+#define HOOK_CORE_STOPERROR          4
 
 #define HOOK_IRC_CONNECTED         100
 #define HOOK_IRC_DISCON            101