@@ -56,6 +56,7 @@ static const char filter_desc[] = "Filter messages using a precompiled Hyperscan
5656static void filter_msg_user (void * data );
5757static void filter_msg_channel (void * data );
5858static void filter_client_quit (void * data );
59+ static void filter_client_nick (void * data );
5960static void on_client_exit (void * data );
6061
6162static void mo_setfilter (struct MsgBuf * , struct Client * , struct Client * , int , const char * * );
@@ -93,6 +94,7 @@ mapi_hfn_list_av1 filter_hfnlist[] = {
9394 { "privmsg_user" , filter_msg_user },
9495 { "privmsg_channel" , filter_msg_channel },
9596 { "client_quit" , filter_client_quit },
97+ { "local_nick_change" , filter_client_nick },
9698 { "client_exit" , on_client_exit },
9799 { NULL , NULL }
98100};
@@ -483,6 +485,29 @@ filter_client_quit(void *data_)
483485 /* No point in doing anything with ACT_KILL */
484486}
485487
488+ void
489+ filter_client_nick (void * data_ )
490+ {
491+ hook_cdata * data = data_ ;
492+ struct Client * s = data -> client ;
493+ if (IsOper (s )) {
494+ return ;
495+ }
496+
497+ unsigned r = match_message ("0" , s , "NICK" , NULL , data -> arg2 );
498+ if (r & ACT_DROP ) {
499+ data -> arg2 = NULL ;
500+ }
501+ if (r & ACT_ALARM ) {
502+ sendto_realops_snomask (SNO_GENERAL , L_ALL | L_NETWIDE ,
503+ "FILTER: %s!%s@%s [%s]" ,
504+ s -> name , s -> username , s -> host , s -> sockhost );
505+ }
506+ if (r & ACT_KILL ) {
507+ exit_client (NULL , s , s , FILTER_EXIT_MSG );
508+ }
509+ }
510+
486511void
487512on_client_exit (void * data_ )
488513{
0 commit comments