mirror of
https://github.com/pissnet/pissircd.git
synced 2025-07-29 14:32:25 +01:00
New hook HOOKTYPE_WELCOME (aClient *acptr, int after_numeric): allows you
to send a message at very specific places during the initial welcome https://www.unrealircd.org/docs/Dev:Hook_API#HOOKTYPE_WELCOME
This commit is contained in:
parent
25ede84a04
commit
bcb667c59e
3 changed files with 25 additions and 4 deletions
|
@ -25,6 +25,9 @@ Minor issues fixed:
|
|||
Deprecated:
|
||||
|
||||
Module coders:
|
||||
* New hook HOOKTYPE_WELCOME (aClient *acptr, int after_numeric): allows you
|
||||
to send a message at very specific places during the initial welcome
|
||||
https://www.unrealircd.org/docs/Dev:Hook_API#HOOKTYPE_WELCOME
|
||||
|
||||
Future versions:
|
||||
* We intend to change the default plaintext oper policy from 'warn' to 'deny'
|
||||
|
|
|
@ -820,6 +820,7 @@ extern char *moddata_client_get(aClient *acptr, char *varname);
|
|||
#define HOOKTYPE_SASL_RESULT 94
|
||||
#define HOOKTYPE_PLACE_HOST_BAN 95
|
||||
#define HOOKTYPE_FIND_TKLINE_MATCH 96
|
||||
#define HOOKTYPE_WELCOME 97
|
||||
|
||||
/* Adding a new hook here?
|
||||
* 1) Add the #define HOOKTYPE_.... with a new number
|
||||
|
@ -923,6 +924,7 @@ int hooktype_sasl_continuation(aClient *sptr, char *buf);
|
|||
int hooktype_sasl_result(aClient *sptr, int success);
|
||||
int hooktype_place_host_ban(aClient *sptr, int action, char *reason, long duration);
|
||||
int hooktype_find_tkline_match(aClient *sptr, aTKline *tk);
|
||||
int hooktype_welcome(aClient *sptr, int after_numeric);
|
||||
|
||||
#ifdef GCC_TYPECHECKING
|
||||
#define ValidateHook(validatefunc, func) __builtin_types_compatible_p(__typeof__(func), __typeof__(validatefunc))
|
||||
|
@ -1023,7 +1025,8 @@ _UNREAL_ERROR(_hook_error_incompatible, "Incompatible hook function. Check argum
|
|||
((hooktype == HOOKTYPE_SASL_CONTINUATION) && !ValidateHook(hooktype_sasl_continuation, func)) || \
|
||||
((hooktype == HOOKTYPE_SASL_RESULT) && !ValidateHook(hooktype_sasl_result, func)) || \
|
||||
((hooktype == HOOKTYPE_PLACE_HOST_BAN) && !ValidateHook(hooktype_place_host_ban, func)) || \
|
||||
((hooktype == HOOKTYPE_FIND_TKLINE_MATCH) && !ValidateHook(hooktype_find_tkline_match, func)) ) \
|
||||
((hooktype == HOOKTYPE_FIND_TKLINE_MATCH) && !ValidateHook(hooktype_find_tkline_match, func)) || \
|
||||
((hooktype == HOOKTYPE_WELCOME) && !ValidateHook(hooktype_welcome, func)) ) \
|
||||
_hook_error_incompatible();
|
||||
#endif /* GCC_TYPECHECKING */
|
||||
|
||||
|
|
|
@ -1413,20 +1413,29 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
|||
else
|
||||
ircd_log(LOG_CLIENT, "Connect - %s!%s@%s", nick, user->username,
|
||||
user->realhost);
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 0);
|
||||
sendto_one(sptr, rpl_str(RPL_WELCOME), me.name, nick,
|
||||
ircnetwork, nick, user->username, user->realhost);
|
||||
/* This is a duplicate of the NOTICE but see below... */
|
||||
sendto_one(sptr, rpl_str(RPL_YOURHOST), me.name, nick,
|
||||
me.name, version);
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 1);
|
||||
sendto_one(sptr, rpl_str(RPL_YOURHOST), me.name, nick,
|
||||
me.name, version);
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 2);
|
||||
sendto_one(sptr, rpl_str(RPL_CREATED), me.name, nick, creation);
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 3);
|
||||
sendto_one(sptr, rpl_str(RPL_MYINFO), me.name, sptr->name,
|
||||
me.name, version, umodestring, cmodestring);
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 4);
|
||||
|
||||
for (i = 0; IsupportStrings[i]; i++)
|
||||
sendto_one(sptr, rpl_str(RPL_ISUPPORT), me.name, nick, IsupportStrings[i]);
|
||||
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 5);
|
||||
|
||||
if (IsHidden(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(RPL_HOSTHIDDEN), me.name, sptr->name, user->virthost);
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 396);
|
||||
}
|
||||
|
||||
if (IsSecureConnect(sptr))
|
||||
{
|
||||
|
@ -1445,9 +1454,13 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
|||
parv[1] = NULL;
|
||||
do_cmd(sptr, sptr, "LUSERS", 1, parv);
|
||||
}
|
||||
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 266);
|
||||
|
||||
short_motd(sptr);
|
||||
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 376);
|
||||
|
||||
#ifdef EXPERIMENTAL
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** \2NOTE:\2 This server is running experimental IRC server software (UnrealIRCd %s). If you find any bugs or problems, please report them at https://bugs.unrealircd.org/",
|
||||
|
@ -1593,6 +1606,8 @@ int _register_user(aClient *cptr, aClient *sptr, char *nick, char *username, cha
|
|||
*/
|
||||
sptr->local->since = TStime();
|
||||
|
||||
RunHook2(HOOKTYPE_WELCOME, sptr, 999);
|
||||
|
||||
/* NOTE: Code after this 'if (savetkl)' will not be executed for quarantined-
|
||||
* virus-users. So be carefull with the order. -- Syzop
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue