Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
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
10 changes: 10 additions & 0 deletions include/atheme/hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,16 @@ struct hook_user_req
struct mynick * mn;
};

struct hook_sendemail_req
{
struct user * u;
struct myuser * mu;
const char * type;
const char * email;
const char * param;
bool handled;
};

void hook_del_hook(const char *, hook_fn);
void hook_add_hook(const char *, hook_fn);
void hook_add_hook_first(const char *, hook_fn);
Expand Down
1 change: 1 addition & 0 deletions include/atheme/hooktypes.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ db_write struct database_handle *
# XXX: for groupserv. remove when we have proper dependency resolution in opensex.
db_write_pre_ca struct database_handle *
shutdown void
sendemail struct hook_sendemail_req *

# (ircd)
channel_add struct channel *
Expand Down
12 changes: 12 additions & 0 deletions libathemecore/email.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,18 @@ sendemail(struct user *u, struct myuser *mu, const char *type, const char *email
u->nick, u->user, u->vhost, u->ip ? u->ip : u->host,
type, entity(mu)->name, email);

struct hook_sendemail_req hdata = {
.u = u,
.mu = mu,
.type = type,
.email = email,
.param = param,
.handled = false
};
hook_call_sendemail(&hdata);
if (hdata.handled)
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in is not closed here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this hook call should be before validating the email type so the email handling hook can decide if it's valid or not


/* set up the email headers */
time(&t);
tm = localtime(&t);
Expand Down