1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 17:43:13 +02:00

+- Added Hooks, only one working now is HOOKTYPE_LOCAL_QUIT

This commit is contained in:
stskeeps
2001-03-21 18:14:43 +00:00
parent 555089ce9e
commit a3a445dc77
6 changed files with 50 additions and 5 deletions
+11 -1
View File
@@ -21,6 +21,8 @@
#define MOD_VERSION 1
#define MAXMODULES 50
#define MAXHOOKTYPES 20
#ifdef _WIN32
#define DLLFUNC _declspec(dllexport)
#define irc_dlopen(x,y) LoadLibrary(x)
@@ -55,10 +57,18 @@ struct moduleInfo
};
extern ModuleInfo *module_buffer;
extern Hook *Hooks[MAXHOOKTYPES];
extern Hook *global_i;
void module_init(void);
int load_module(char *module);
int unload_module(char *name);
vFP module_sym(char *name);
void add_Hook(int hooktype, int (*func)());
void del_Hook(int hooktype, int (*func)());
#define RunHook(hooktype,x) for (global_i = Hooks[hooktype]; global_i; global_i = global_i->next) (*global_i->func)(x)
#define HOOKTYPE_LOCAL_QUIT 1
+10 -1
View File
@@ -27,7 +27,6 @@
#include "common.h"
#include "sys.h"
#include "hash.h"
#include "modules.h"
#include <stdio.h>
#include <sys/types.h>
#ifdef ZIP_LINKS
@@ -102,6 +101,8 @@ typedef struct Command aCommand;
typedef struct SMember Member;
typedef struct SMembership Membership;
typedef struct SMembershipL MembershipL;
typedef struct _irchook Hook;
#ifdef NEED_U_INT32_T
typedef unsigned int u_int32_t; /* XXX Hope this works! */
#endif
@@ -924,6 +925,7 @@ struct _configflag_ban
#define CRULE_AUTO 1
struct _configitem {
ConfigFlag flag;
ConfigItem *prev, *next;
@@ -1067,6 +1069,12 @@ struct _configitem_allow_channel {
char *channel;
};
struct _irchook {
ConfigFlag flag;
Hook *prev, *next;
int (*func)();
};
/*
* statistics structures
*/
@@ -1365,6 +1373,7 @@ extern char *gnulicense[];
#include "ssl.h"
#endif
#define HASH_TEST HASH_CHECK
#include "modules.h"
#endif /* __struct_include__ */