From 88c48be58cbf917b634238f14d320f3b339abdeb Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 12 Jan 2016 07:10:39 -0600 Subject: [PATCH] extensions/sno_globalnickchange: import from ircd-seven --- doc/ircd.conf.example | 1 + doc/reference.conf | 2 ++ extensions/Makefile.am | 1 + extensions/Makefile.in | 24 +++++++++++------ extensions/sno_globalnickchange.c | 43 +++++++++++++++++++++++++++++++ 5 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 extensions/sno_globalnickchange.c diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 4bb1d697..ff51240c 100755 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -31,6 +31,7 @@ #loadmodule "extensions/no_oper_invis.la"; #loadmodule "extensions/sno_farconnect.la"; #loadmodule "extensions/sno_globalkline.la"; +#loadmodule "extensions/sno_globalnickchange.la"; #loadmodule "extensions/sno_globaloper.la"; #loadmodule "extensions/sno_whois.la"; #loadmodule "extensions/override.la"; diff --git a/doc/reference.conf b/doc/reference.conf index 8e142bea..80b5f9ca 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -71,6 +71,7 @@ * Far connection notices (snomask +F) -- sno_farconnect.la * Remote k/d/x line active notices -- sno_globalkline.la * Remote oper up notices -- sno_globaloper.la + * Global nick-change notices -- sno_globalnickchange.la * /whois notifications (snomask +W) -- sno_whois.la * Oper-override (modehacking only) -- override.la * Stop services kills -- no_kill_services.la @@ -101,6 +102,7 @@ #loadmodule "extensions/no_oper_invis.la"; #loadmodule "extensions/sno_farconnect.la"; #loadmodule "extensions/sno_globalkline.la"; +#loadmodule "extensions/sno_globalnickchange.la"; #loadmodule "extensions/sno_globaloper.la"; #loadmodule "extensions/sno_whois.la"; #loadmodule "extensions/override.la"; diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 54c06baa..b24de7c2 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -37,6 +37,7 @@ extension_LTLIBRARIES = \ sno_channelcreate.la \ sno_farconnect.la \ sno_globalkline.la \ + sno_globalnickchange.la \ sno_globaloper.la \ sno_whois.la \ m_42.la \ diff --git a/extensions/Makefile.in b/extensions/Makefile.in index fb67d342..e2c769be 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -287,6 +287,9 @@ sno_farconnect_la_OBJECTS = sno_farconnect.lo sno_globalkline_la_LIBADD = sno_globalkline_la_SOURCES = sno_globalkline.c sno_globalkline_la_OBJECTS = sno_globalkline.lo +sno_globalnickchange_la_LIBADD = +sno_globalnickchange_la_SOURCES = sno_globalnickchange.c +sno_globalnickchange_la_OBJECTS = sno_globalnickchange.lo sno_globaloper_la_LIBADD = sno_globaloper_la_SOURCES = sno_globaloper.c sno_globaloper_la_OBJECTS = sno_globaloper.lo @@ -361,10 +364,10 @@ SOURCES = chm_adminonly.c chm_nonotice.c chm_operonly.c \ m_omode.c m_opme.c m_remove.c m_roleplay.c m_sendbans.c \ m_webirc.c no_kill_services.c no_locops.c no_oper_invis.c \ override.c restrict-unauthenticated.c sno_channelcreate.c \ - sno_farconnect.c sno_globalkline.c sno_globaloper.c \ - sno_whois.c spy_admin_notice.c spy_info_notice.c \ - spy_links_notice.c spy_motd_notice.c spy_stats_notice.c \ - spy_stats_p_notice.c spy_trace_notice.c + sno_farconnect.c sno_globalkline.c sno_globalnickchange.c \ + sno_globaloper.c sno_whois.c spy_admin_notice.c \ + spy_info_notice.c spy_links_notice.c spy_motd_notice.c \ + spy_stats_notice.c spy_stats_p_notice.c spy_trace_notice.c DIST_SOURCES = chm_adminonly.c chm_nonotice.c chm_operonly.c \ chm_operonly_compat.c chm_quietunreg_compat.c chm_sslonly.c \ chm_sslonly_compat.c createauthonly.c createoperonly.c \ @@ -378,10 +381,10 @@ DIST_SOURCES = chm_adminonly.c chm_nonotice.c chm_operonly.c \ m_omode.c m_opme.c m_remove.c m_roleplay.c m_sendbans.c \ m_webirc.c no_kill_services.c no_locops.c no_oper_invis.c \ override.c restrict-unauthenticated.c sno_channelcreate.c \ - sno_farconnect.c sno_globalkline.c sno_globaloper.c \ - sno_whois.c spy_admin_notice.c spy_info_notice.c \ - spy_links_notice.c spy_motd_notice.c spy_stats_notice.c \ - spy_stats_p_notice.c spy_trace_notice.c + sno_farconnect.c sno_globalkline.c sno_globalnickchange.c \ + sno_globaloper.c sno_whois.c spy_admin_notice.c \ + spy_info_notice.c spy_links_notice.c spy_motd_notice.c \ + spy_stats_notice.c spy_stats_p_notice.c spy_trace_notice.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -623,6 +626,7 @@ extension_LTLIBRARIES = \ sno_channelcreate.la \ sno_farconnect.la \ sno_globalkline.la \ + sno_globalnickchange.la \ sno_globaloper.la \ sno_whois.la \ m_42.la \ @@ -871,6 +875,9 @@ sno_farconnect.la: $(sno_farconnect_la_OBJECTS) $(sno_farconnect_la_DEPENDENCIES sno_globalkline.la: $(sno_globalkline_la_OBJECTS) $(sno_globalkline_la_DEPENDENCIES) $(EXTRA_sno_globalkline_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(extensiondir) $(sno_globalkline_la_OBJECTS) $(sno_globalkline_la_LIBADD) $(LIBS) +sno_globalnickchange.la: $(sno_globalnickchange_la_OBJECTS) $(sno_globalnickchange_la_DEPENDENCIES) $(EXTRA_sno_globalnickchange_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) -rpath $(extensiondir) $(sno_globalnickchange_la_OBJECTS) $(sno_globalnickchange_la_LIBADD) $(LIBS) + sno_globaloper.la: $(sno_globaloper_la_OBJECTS) $(sno_globaloper_la_DEPENDENCIES) $(EXTRA_sno_globaloper_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(extensiondir) $(sno_globaloper_la_OBJECTS) $(sno_globaloper_la_LIBADD) $(LIBS) @@ -954,6 +961,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sno_channelcreate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sno_farconnect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sno_globalkline.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sno_globalnickchange.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sno_globaloper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sno_whois.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spy_admin_notice.Plo@am__quote@ diff --git a/extensions/sno_globalnickchange.c b/extensions/sno_globalnickchange.c new file mode 100644 index 00000000..dd01d8f6 --- /dev/null +++ b/extensions/sno_globalnickchange.c @@ -0,0 +1,43 @@ +/* + * Remote client nick change notices. + */ + +#include "stdinc.h" +#include "modules.h" +#include "client.h" +#include "hook.h" +#include "ircd.h" +#include "send.h" +#include "s_conf.h" +#include "snomask.h" + +static int _modinit(void); +static void h_gnc_nick_change(hook_data *data); + +mapi_hfn_list_av1 gcn_hfnlist[] = { + { "remote_nick_change", (hookfn) h_gnc_nick_change }, + { NULL, NULL } +}; + +DECLARE_MODULE_AV1(globalnickchange, _modinit, NULL, NULL, NULL, gcn_hfnlist, "$Revision: 1869 $"); + +static int +_modinit(void) +{ + /* show the fact that we are showing user information in /version */ + opers_see_all_users = 1; + + return 0; +} + +static void +h_gnc_nick_change(hook_data *data) +{ + struct Client *source_p = data->client; + const char *oldnick = data->arg1; + const char *newnick = data->arg2; + + sendto_realops_snomask_from(SNO_NCHANGE, L_ALL, source_p->servptr, + "Nick change: From %s to %s [%s@%s]", + oldnick, newnick, source_p->username, source_p->host); +}