Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HOOK for reset (channel) member #1610

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/mod/channels.mod/tclchan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,7 @@ static void init_channel(struct chanset_t *chan, int reset)
chan->channel.member = nmalloc(sizeof *chan->channel.member);
/* Since we don't have channel_malloc, manually bzero */
egg_bzero(chan->channel.member, sizeof *chan->channel.member);
do_hook_reset_member();
}

if (flags & CHAN_RESETMODES) {
Expand Down
1 change: 1 addition & 0 deletions src/mod/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ typedef void (*chanout_butfunc)(int, int, const char *, ...) ATTRIBUTE_FORMAT(pr
/* 324 - 327 */
#define find_member_from_nick ((memberlist * (*) (char *))global[324])
#define get_user_from_member ((struct userrec * (*) (memberlist *))global[325])
#define do_hook_reset_member ((void (*) ())global[326])


/* hostmasking */
Expand Down
4 changes: 2 additions & 2 deletions src/mod/modvals.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#define HOOK_DIE 15
#define HOOK_PRE_SELECT 16
#define HOOK_POST_SELECT 17

#define REAL_HOOKS 18
#define HOOK_RESET_MEMBER 18
#define REAL_HOOKS 19

#define HOOK_SHAREOUT 105
#define HOOK_SHAREIN 106
Expand Down
6 changes: 6 additions & 0 deletions src/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ int (*rfc_toupper) (int) = _rfc_toupper;
int (*rfc_tolower) (int) = _rfc_tolower;
void (*dns_hostbyip) (sockname_t *) = core_dns_hostbyip;
void (*dns_ipbyhost) (char *) = core_dns_ipbyhost;
void (*hook_reset_member) () = null_func;

module_entry *module_list;
dependancy *dependancy_list = NULL;
Expand Down Expand Up @@ -626,6 +627,7 @@ Function global_table[] = {
/* 324 - 327 */
(Function) find_member_from_nick,
(Function) get_user_from_member,
(Function) do_hook_reset_member
};

void init_modules(void)
Expand Down Expand Up @@ -1212,3 +1214,7 @@ void do_module_report(int idx, int details, char *which)
if (which)
dprintf(idx, "No such module.\n");
}

void do_hook_reset_member() {
call_hook(HOOK_RESET_MEMBER);
}
1 change: 1 addition & 0 deletions src/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void mod_free(void *, const char *, const char *, int);
void add_hook(int, Function);
void del_hook(int, Function);
void *get_next_hook(int, void *);
void do_hook_reset_member();

extern struct hook_entry {
struct hook_entry *next;
Expand Down