2007-01-25 06:40:21 +00: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 20:18:48 +00:00
|
|
|
rb_dlink_list hooks;
|
2007-01-25 06:40:21 +00:00
|
|
|
} hook;
|
|
|
|
|
2020-04-26 23:14:56 +00:00
|
|
|
enum hook_priority
|
|
|
|
{
|
|
|
|
HOOK_LOWEST = 10,
|
|
|
|
HOOK_LOW = 20,
|
|
|
|
HOOK_NORMAL = 30,
|
|
|
|
HOOK_HIGH = 40,
|
|
|
|
HOOK_HIGHEST = 50,
|
|
|
|
HOOK_MONITOR = 100
|
|
|
|
};
|
|
|
|
|
2022-08-30 20:49:43 +00:00
|
|
|
/* for idle time privacy features */
|
|
|
|
enum whois_idle_approval
|
|
|
|
{
|
|
|
|
WHOIS_IDLE_HIDE = 0,
|
|
|
|
WHOIS_IDLE_SHOW = 1,
|
|
|
|
WHOIS_IDLE_AUSPEX = 2
|
|
|
|
};
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
typedef void (*hookfn) (void *data);
|
|
|
|
|
2008-04-20 13:20:10 +00:00
|
|
|
extern int h_iosend_id;
|
|
|
|
extern int h_iorecv_id;
|
|
|
|
extern int h_iorecvctrl_id;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-20 13:20:10 +00: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;
|
2018-08-12 11:16:51 +00:00
|
|
|
extern int h_after_client_exit;
|
2008-04-20 13:20:10 +00:00
|
|
|
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 14:20:11 +00:00
|
|
|
extern int h_can_kick;
|
2012-04-01 02:20:02 +00:00
|
|
|
extern int h_privmsg_channel;
|
|
|
|
extern int h_privmsg_user;
|
2012-05-21 20:22:07 +00:00
|
|
|
extern int h_conf_read_start;
|
|
|
|
extern int h_conf_read_end;
|
2016-02-20 21:49:41 +00:00
|
|
|
extern int h_outbound_msgbuf;
|
2016-04-06 10:43:54 +00:00
|
|
|
extern int h_rehash;
|
2021-01-29 11:54:12 +00:00
|
|
|
extern int h_priv_change;
|
2020-04-26 21:34:00 +00:00
|
|
|
extern int h_cap_change;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
void init_hook(void);
|
|
|
|
int register_hook(const char *name);
|
|
|
|
void add_hook(const char *name, hookfn fn);
|
2020-04-26 23:14:56 +00:00
|
|
|
void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority);
|
2007-01-25 06:40:21 +00:00
|
|
|
void remove_hook(const char *name, hookfn fn);
|
|
|
|
void call_hook(int id, void *arg);
|
|
|
|
|
2016-02-20 23:44:13 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
void *arg1;
|
|
|
|
void *arg2;
|
|
|
|
} hook_data;
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
const void *arg1;
|
|
|
|
const void *arg2;
|
2016-02-20 23:44:13 +00:00
|
|
|
} hook_cdata;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
const void *arg1;
|
|
|
|
int arg2;
|
2016-01-14 12:57:04 +00:00
|
|
|
int result;
|
2007-01-25 06:40:21 +00:00
|
|
|
} hook_data_int;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Client *target;
|
|
|
|
} hook_data_client;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Channel *chptr;
|
|
|
|
int approved;
|
|
|
|
} hook_data_channel;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Channel *chptr;
|
2016-10-30 12:36:50 +00:00
|
|
|
const char *key;
|
2007-01-25 06:40:21 +00:00
|
|
|
} hook_data_channel_activity;
|
|
|
|
|
2009-04-20 14:20:11 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct Channel *chptr;
|
2010-12-07 04:57:04 +00:00
|
|
|
struct membership *msptr;
|
2009-04-20 14:20:11 +00:00
|
|
|
struct Client *target;
|
|
|
|
int approved;
|
2015-12-10 07:00:32 +00:00
|
|
|
int dir;
|
2016-01-12 04:40:32 +00:00
|
|
|
const char *modestr;
|
2020-02-01 00:08:23 +00:00
|
|
|
const char *error;
|
2009-04-20 14:20:11 +00:00
|
|
|
} hook_data_channel_approval;
|
|
|
|
|
2020-05-26 23:16:22 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
2020-10-18 12:20:15 +00:00
|
|
|
struct Client *target;
|
2020-05-26 23:16:22 +00:00
|
|
|
struct Channel *chptr;
|
|
|
|
struct membership *clientms;
|
2020-10-18 12:20:15 +00:00
|
|
|
struct membership *targetms;
|
2020-05-26 23:16:22 +00:00
|
|
|
int approved;
|
|
|
|
} hook_data_channel_visibility;
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
2013-04-20 06:07:55 +00:00
|
|
|
struct Client *target;
|
2007-01-25 06:40:21 +00: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;
|
|
|
|
|
2020-05-23 18:10:07 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
const char *reason;
|
|
|
|
const char *orig_reason;
|
|
|
|
} hook_data_client_quit;
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
unsigned int oldumodes;
|
|
|
|
unsigned int oldsnomask;
|
|
|
|
} hook_data_umode_changed;
|
|
|
|
|
2020-04-26 21:34:00 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
int oldcaps;
|
|
|
|
int add;
|
|
|
|
int del;
|
|
|
|
} hook_data_cap_change;
|
|
|
|
|
2012-04-01 02:20:02 +00:00
|
|
|
enum message_type {
|
|
|
|
MESSAGE_TYPE_NOTICE,
|
|
|
|
MESSAGE_TYPE_PRIVMSG,
|
2012-04-07 03:03:07 +00:00
|
|
|
MESSAGE_TYPE_PART,
|
2012-04-01 02:20:02 +00: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;
|
|
|
|
|
2021-01-29 11:54:12 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
struct Client *client;
|
|
|
|
struct PrivilegeSet *old;
|
|
|
|
struct PrivilegeSet *new;
|
|
|
|
const struct PrivilegeSet *added;
|
|
|
|
const struct PrivilegeSet *removed;
|
|
|
|
const struct PrivilegeSet *unchanged;
|
|
|
|
} hook_data_priv_change;
|
|
|
|
|
2016-04-06 10:43:54 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
bool signal;
|
|
|
|
} hook_data_rehash;
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
#endif
|