2007-01-25 07:40:21 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2004-2005 Lee Hardy <lee -at- leeh.co.uk>
|
|
|
|
* Copyright (C) 2004-2005 ircd-ratbox development team
|
|
|
|
*/
|
|
|
|
#ifndef INCLUDED_HOOK_H
|
|
|
|
#define INCLUDED_HOOK_H
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *name;
|
2008-04-01 22:18:48 +02:00
|
|
|
rb_dlink_list hooks;
|
2007-01-25 07:40:21 +01:00
|
|
|
} hook;
|
|
|
|
|
|
|
|
typedef void (*hookfn) (void *data);
|
|
|
|
|
2008-04-20 15:20:10 +02:00
|
|
|
extern int h_iosend_id;
|
|
|
|
extern int h_iorecv_id;
|
|
|
|
extern int h_iorecvctrl_id;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
2008-04-20 15:20:10 +02:00
|
|
|
extern int h_burst_client;
|
|
|
|
extern int h_burst_channel;
|
|
|
|
extern int h_burst_finished;
|
|
|
|
extern int h_server_introduced;
|
|
|
|
extern int h_server_eob;
|
|
|
|
extern int h_client_exit;
|
|
|
|
extern int h_umode_changed;
|
|
|
|
extern int h_new_local_user;
|
|
|
|
extern int h_new_remote_user;
|
|
|
|
extern int h_introduce_client;
|
2009-04-20 16:20:11 +02:00
|
|
|
extern int h_can_kick;
|
2012-04-01 04:20:02 +02:00
|
|
|
extern int h_privmsg_channel;
|
|
|
|
extern int h_privmsg_user;
|
2012-05-21 22:22:07 +02:00
|
|
|
extern int h_conf_read_start;
|
|
|
|
extern int h_conf_read_end;
|
2016-02-20 22:49:41 +01:00
|
|
|
extern int h_outbound_msgbuf;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
void init_hook(void);
|
|
|
|
int register_hook(const char *name);
|
|
|
|
void add_hook(const char *name, hookfn fn);
|
|
|
|
void remove_hook(const char *name, hookfn fn);
|
|
|
|
void call_hook(int id, void *arg);
|
|
|
|
|
2016-02-21 00:44:13 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
void *arg1;
|
|
|
|
void *arg2;
|
|
|
|
} hook_data;
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
const void *arg1;
|
|
|
|
const void *arg2;
|
2016-02-21 00:44:13 +01:00
|
|
|
} hook_cdata;
|
2007-01-25 07:40:21 +01:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
const void *arg1;
|
|
|
|
int arg2;
|
2016-01-14 13:57:04 +01:00
|
|
|
int result;
|
2007-01-25 07:40:21 +01:00
|
|
|
} hook_data_int;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Client *target;
|
2016-01-06 01:37:42 +01:00
|
|
|
struct Channel *chptr;
|
|
|
|
int approved;
|
2007-01-25 07:40:21 +01:00
|
|
|
} hook_data_client;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Channel *chptr;
|
|
|
|
int approved;
|
|
|
|
} hook_data_channel;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Channel *chptr;
|
|
|
|
char *key;
|
|
|
|
} hook_data_channel_activity;
|
|
|
|
|
2009-04-20 16:20:11 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Channel *chptr;
|
2010-12-07 05:57:04 +01:00
|
|
|
struct membership *msptr;
|
2009-04-20 16:20:11 +02:00
|
|
|
struct Client *target;
|
|
|
|
int approved;
|
2015-12-10 08:00:32 +01:00
|
|
|
int dir;
|
2016-01-12 05:40:32 +01:00
|
|
|
const char *modestr;
|
2009-04-20 16:20:11 +02:00
|
|
|
} hook_data_channel_approval;
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
2013-04-20 08:07:55 +02:00
|
|
|
struct Client *target;
|
2007-01-25 07:40:21 +01:00
|
|
|
int approved;
|
|
|
|
} hook_data_client_approval;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *local_link; /* local client originating this, or NULL */
|
|
|
|
struct Client *target; /* dying client */
|
|
|
|
struct Client *from; /* causing client (could be &me or target) */
|
|
|
|
const char *comment;
|
|
|
|
} hook_data_client_exit;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
unsigned int oldumodes;
|
|
|
|
unsigned int oldsnomask;
|
|
|
|
} hook_data_umode_changed;
|
|
|
|
|
2012-04-01 04:20:02 +02:00
|
|
|
enum message_type {
|
|
|
|
MESSAGE_TYPE_NOTICE,
|
|
|
|
MESSAGE_TYPE_PRIVMSG,
|
2012-04-07 05:03:07 +02:00
|
|
|
MESSAGE_TYPE_PART,
|
2012-04-01 04:20:02 +02:00
|
|
|
MESSAGE_TYPE_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
enum message_type msgtype;
|
|
|
|
struct Client *source_p;
|
|
|
|
struct Channel *chptr;
|
|
|
|
const char *text;
|
|
|
|
int approved;
|
|
|
|
} hook_data_privmsg_channel;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
enum message_type msgtype;
|
|
|
|
struct Client *source_p;
|
|
|
|
struct Client *target_p;
|
|
|
|
const char *text;
|
|
|
|
int approved;
|
|
|
|
} hook_data_privmsg_user;
|
|
|
|
|
2007-01-25 07:40:21 +01:00
|
|
|
#endif
|