summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authortrystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-02-14 06:01:38 +0000
committertrystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2005-02-14 06:01:38 +0000
commit59f3a38ffd13b9fa2d31b89efa7558f4919c810b (patch)
tree1431c63a2ebccbacb4b6f41e7716498a9e4cd970 /include
parentf19412921768cfadec42215e538588108d3c8b40 (diff)
BUILD : 1.7.8 (574) BUGS : N/A NOTES : Internal Events, Win32 can build with encryption, nickIsServices() works if format is nick@services
git-svn-id: svn://svn.anope.org/anope/trunk@574 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@424 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include')
-rw-r--r--include/events.h42
-rw-r--r--include/extern.h5
-rw-r--r--include/modules.h64
-rw-r--r--include/services.h1
4 files changed, 110 insertions, 2 deletions
diff --git a/include/events.h b/include/events.h
new file mode 100644
index 000000000..7595d466d
--- /dev/null
+++ b/include/events.h
@@ -0,0 +1,42 @@
+/* Prototypes and external variable declarations.
+ *
+ * (C) 2003-2005 Anope Team
+ * Contact us at info@anope.org
+ *
+ * Please read COPYING and README for furhter details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ *
+ * $Id:$
+ *
+ */
+
+#define EVENT_START "start"
+#define EVENT_STOP "stop"
+
+#define EVENT_DB_SAVING "db_saving"
+#define EVENT_NEWNICK "newnick"
+#define EVENT_BOT_UNASSIGN "bot_unassign"
+#define EVENT_BOT_JOIN "bot_join"
+#define EVENT_BOT_CREATE "bot_create"
+#define EVENT_BOT_CHANGE "bot_change"
+#define EVENT_BOT_DEL "bot_del"
+#define EVENT_BOT_ASSIGN "bot_assign"
+#define EVENT_TOPIC_UPDATED "chan_topic_updated"
+#define EVENT_CHAN_EXPIRE "chan_expire"
+#define EVENT_CHAN_REGISTERED "chan_registered"
+#define EVENT_CHAN_DROP "chan_dropped"
+#define EVENT_CHAN_FORBIDDEN "chan_forbidden"
+#define EVENT_CHAN_SUSPENDED "chan_suspended"
+#define EVENT_CHAN_UNSUSPEND "chan_unsuspend"
+#define EVENT_CONNECT "connect"
+#define EVENT_DB_EXPIRE "db_expire"
+#define EVENT_RESTART "restart"
+#define EVENT_SHUTDOWN "shutdown"
+#define EVENT_SIGNAL "signal"
+#define EVENT_NICK_REGISTED "nick_registered"
+#define EVENT_NICK_DROPPED "nick_dropped"
+#define EVENT_NICK_FORBIDDEN "nick_forbidden"
+#define EVENT_CHANGE_NICK "change_nick"
+
diff --git a/include/extern.h b/include/extern.h
index 40e275da2..58495a314 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -1168,4 +1168,9 @@ E int decode_ip(char *buf);
E char *host_resolve(char *host);
+extern void event_message_process(char *eventbuf);
+extern void eventprintf(char *fmt, ...);
+extern void event_process_hook(char *name, char *eventbuf);
+extern void send_event(char *name, const char *fmt, ...);
+
#endif /* EXTERN_H */
diff --git a/include/modules.h b/include/modules.h
index 91bdb7a88..15e1cc1e1 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -62,6 +62,8 @@ typedef void * ano_module_t;
#define OPERSERV OS_cmdTable
#define IRCD IRCD_cmdTable
#define MODULE_HASH Module_table
+#define EVENT EVENT_cmdTable
+#define EVENTHOOKS HOOK_cmdTable
/**********************************************************************
* Module Returns
@@ -103,7 +105,10 @@ typedef struct ModuleHash_ ModuleHash;
typedef struct Message_ Message;
typedef struct MessageHash_ MessageHash;
typedef struct ModuleCallBack_ ModuleCallBack;
-
+typedef struct EvtMessage_ EvtMessage;
+typedef struct EvtMessageHash_ EvtMessageHash;
+typedef struct EvtHook_ EvtHook;
+typedef struct EvtHookHash_ EvtHookHash;
extern MDE CommandHash *HOSTSERV[MAX_CMD_HASH];
extern MDE CommandHash *BOTSERV[MAX_CMD_HASH];
@@ -113,6 +118,8 @@ extern MDE CommandHash *CHANSERV[MAX_CMD_HASH];
extern MDE CommandHash *HELPSERV[MAX_CMD_HASH];
extern MDE CommandHash *OPERSERV[MAX_CMD_HASH];
extern MDE MessageHash *IRCD[MAX_CMD_HASH];
+extern EvtMessageHash *EVENT[MAX_CMD_HASH];
+extern EvtHookHash *EVENTHOOKS[MAX_CMD_HASH];
struct Module_ {
char *name;
@@ -202,6 +209,36 @@ struct ModuleCallBack_ {
ModuleCallBack *next;
};
+struct EvtMessage_ {
+ char *name;
+ int (*func)(char *source, int ac, char **av);
+ int core;
+ char *mod_name;
+ EvtMessage *next;
+};
+
+struct EvtMessageHash_ {
+ char *name;
+ EvtMessage *evm;
+ EvtMessageHash *next;
+};
+
+
+struct EvtHook_ {
+ int (*func)(char *source);
+ int core;
+ char *name;
+ char *mod_name;
+ EvtHook *next;
+};
+
+struct EvtHookHash_ {
+ char *name;
+ EvtHook *evh;
+ EvtHookHash *next;
+};
+
+
/*************************************************************************/
/* Module Managment Functions */
Module *createModule(char *filename); /* Create a new module, using the given name */
@@ -243,8 +280,9 @@ MDE int addCommand(CommandHash *cmdTable[], Command *c,int pos);
MDE int delCommand(CommandHash *cmdTable[], Command *c,char *mod_name); /* Del a command from a cmd table */
MDE int moduleDelCommand(CommandHash *cmdTable[],char *name); /* Del a command from a cmd table */
Command *findCommand(CommandHash *cmdTable[], const char *name); /* Find a command */
+
/*************************************************************************/
-/*************************************************************************/
+
/* Message Managment Functions */
MDE Message *createMessage(char *name,int (*func)(char *source, int ac, char **av));
Message *findMessage(MessageHash *msgTable[], const char *name); /* Find a Message */
@@ -255,7 +293,29 @@ int delMessage(MessageHash *msgTable[], Message *m, char *mod_name); /* Del a M
MDE int moduleDelMessage(char *name);
int destroyMessage(Message *m); /* destroy a Message*/
Message *findMessage(MessageHash *msgTable[], const char *name);
+
/*************************************************************************/
+
+MDE EvtMessage *createEventHandler(char *name, int (*func) (char *source, int ac, char **av));
+EvtMessage *findEventHandler(EvtMessageHash * msgEvtTable[], const char *name);
+int addCoreEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm);
+MDE int moduleAddEventHandler(EvtMessage * evm);
+MDE int moduleEventDelHandler(char *name);
+int delEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm, char *mod_name);
+int destroyEventHandler(EvtMessage * evm);
+int addEventHandler(EvtMessageHash * msgEvtTable[], EvtMessage * evm);
+
+MDE EvtHook *createEventHook(char *name, int (*func) (char *source));
+EvtHook *findEventHook(EvtHookHash * HookEvtTable[], const char *name);
+int addCoreEventHook(EvtHookHash * HookEvtTable[], EvtHook * evh);
+MDE int moduleAddEventHook(EvtHook * evh);
+MDE int moduleEventDelHook(const char *name);
+int delEventHook(EvtHookHash * HookEvtTable[], EvtHook * evh, char *mod_name);
+int destroyEventHook(EvtHook * evh);
+extern char *mod_current_evtbuffer;
+
+/*************************************************************************/
+
MDE int moduleAddCallback(char *name,time_t when,int (*func)(int argc, char *argv[]),int argc, char **argv);
MDE void moduleDelCallback(char *name);
MDE void moduleCallBackRun(void);
diff --git a/include/services.h b/include/services.h
index 730c04f3d..b6a141a6f 100644
--- a/include/services.h
+++ b/include/services.h
@@ -177,6 +177,7 @@ extern int toupper(char), tolower(char);
/* Miscellaneous definitions. */
#include "defs.h"
#include "slist.h"
+#include "events.h"
/*************************************************************************/