Skip to content

Commit

Permalink
Add HOOK for reset (channel) member
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelortmann committed Jun 11, 2024
1 parent d58f563 commit 0a801d7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
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 @@ -526,6 +526,7 @@ typedef void (*chanout_butfunc)(int, int, const char *, ...) ATTRIBUTE_FORMAT(pr
#define argv0 ((char *)global[322])
#define get_user_from_member ((struct userrec * (*)(memberlist *))global[323])
/* 324 - 327 */
#define do_hook_reset_member ((void (*) ())global[324])


/* hostmasking */
Expand Down
3 changes: 2 additions & 1 deletion src/mod/modvals.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
#define HOOK_LOADED 13
#define HOOK_BACKUP 14
#define HOOK_DIE 15
#define REAL_HOOKS 16
#define HOOK_RESET_MEMBER 16
#define REAL_HOOKS 17
#define HOOK_SHAREOUT 105
#define HOOK_SHAREIN 106
#define HOOK_ENCRYPT_PASS 107
Expand Down
8 changes: 7 additions & 1 deletion src/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,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 @@ -627,8 +628,9 @@ Function global_table[] = {
(Function) bind_bind_entry,
(Function) unbind_bind_entry,
(Function) & argv0,
(Function) get_user_from_member
(Function) get_user_from_member,
/* 324 - 327 */
(Function) do_hook_reset_member
};

void init_modules(void)
Expand Down Expand Up @@ -1211,3 +1213,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

0 comments on commit 0a801d7

Please sign in to comment.