From ca45daba738192b57541d74a8e58a2d285b3e457 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 10 Feb 2016 21:00:27 -0600 Subject: [PATCH] extensions: add m_echotags extension to echo back your tags in NOTICE form --- extensions/Makefile.am | 1 + extensions/Makefile.in | 24 ++++++++++++++++-------- extensions/m_echotags.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 extensions/m_echotags.c diff --git a/extensions/Makefile.am b/extensions/Makefile.am index 0f2485d9..e9c3cb4f 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -45,6 +45,7 @@ extension_LTLIBRARIES = \ sno_whois.la \ m_42.la \ m_adminwall.la \ + m_echotags.la \ m_extendchans.la \ m_findforwards.la \ m_identify.la \ diff --git a/extensions/Makefile.in b/extensions/Makefile.in index a71a2a72..9d6b6149 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -236,6 +236,9 @@ m_42_la_OBJECTS = m_42.lo m_adminwall_la_LIBADD = m_adminwall_la_SOURCES = m_adminwall.c m_adminwall_la_OBJECTS = m_adminwall.lo +m_echotags_la_LIBADD = +m_echotags_la_SOURCES = m_echotags.c +m_echotags_la_OBJECTS = m_echotags.lo m_extendchans_la_LIBADD = m_extendchans_la_SOURCES = m_extendchans.c m_extendchans_la_OBJECTS = m_extendchans.lo @@ -369,10 +372,10 @@ SOURCES = chm_adminonly.c chm_insecure.c chm_nonotice.c chm_operonly.c \ extb_ssl.c extb_usermode.c force_user_invis.c helpops.c \ hide_uncommon_channels.c hurt.c ip_cloaking.c \ ip_cloaking_3.0.c ip_cloaking_4.0.c ip_cloaking_old.c m_42.c \ - m_adminwall.c m_extendchans.c m_findforwards.c m_identify.c \ - m_mkpasswd.c m_ojoin.c m_okick.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 \ + m_adminwall.c m_echotags.c m_extendchans.c m_findforwards.c \ + m_identify.c m_mkpasswd.c m_ojoin.c m_okick.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_globalnickchange.c \ sno_globaloper.c sno_whois.c spy_admin_notice.c \ @@ -387,10 +390,10 @@ DIST_SOURCES = chm_adminonly.c chm_insecure.c chm_nonotice.c \ extb_server.c extb_ssl.c extb_usermode.c force_user_invis.c \ helpops.c hide_uncommon_channels.c hurt.c ip_cloaking.c \ ip_cloaking_3.0.c ip_cloaking_4.0.c ip_cloaking_old.c m_42.c \ - m_adminwall.c m_extendchans.c m_findforwards.c m_identify.c \ - m_mkpasswd.c m_ojoin.c m_okick.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 \ + m_adminwall.c m_echotags.c m_extendchans.c m_findforwards.c \ + m_identify.c m_mkpasswd.c m_ojoin.c m_okick.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_globalnickchange.c \ sno_globaloper.c sno_whois.c spy_admin_notice.c \ @@ -645,6 +648,7 @@ extension_LTLIBRARIES = \ sno_whois.la \ m_42.la \ m_adminwall.la \ + m_echotags.la \ m_extendchans.la \ m_findforwards.la \ m_identify.la \ @@ -838,6 +842,9 @@ m_42.la: $(m_42_la_OBJECTS) $(m_42_la_DEPENDENCIES) $(EXTRA_m_42_la_DEPENDENCIES m_adminwall.la: $(m_adminwall_la_OBJECTS) $(m_adminwall_la_DEPENDENCIES) $(EXTRA_m_adminwall_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(extensiondir) $(m_adminwall_la_OBJECTS) $(m_adminwall_la_LIBADD) $(LIBS) +m_echotags.la: $(m_echotags_la_OBJECTS) $(m_echotags_la_DEPENDENCIES) $(EXTRA_m_echotags_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) -rpath $(extensiondir) $(m_echotags_la_OBJECTS) $(m_echotags_la_LIBADD) $(LIBS) + m_extendchans.la: $(m_extendchans_la_OBJECTS) $(m_extendchans_la_DEPENDENCIES) $(EXTRA_m_extendchans_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(extensiondir) $(m_extendchans_la_OBJECTS) $(m_extendchans_la_LIBADD) $(LIBS) @@ -967,6 +974,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ip_cloaking_old.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_42.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_adminwall.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_echotags.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_extendchans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_findforwards.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_identify.Plo@am__quote@ diff --git a/extensions/m_echotags.c b/extensions/m_echotags.c new file mode 100644 index 00000000..982f72c0 --- /dev/null +++ b/extensions/m_echotags.c @@ -0,0 +1,38 @@ +#include "stdinc.h" +#include "modules.h" +#include "client.h" +#include "ircd.h" +#include "send.h" + +static int m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); + +struct Message echotags_msgtab = { + "ECHOTAGS", 0, 0, 0, MFLG_SLOW, + { mg_ignore, {m_echotags, 0}, mg_ignore, mg_ignore, mg_ignore, {m_echotags, 0} } +}; + +mapi_clist_av1 echotags_clist[] = { &echotags_msgtab, NULL }; + +DECLARE_MODULE_AV1(echotags, NULL, NULL, echotags_clist, NULL, NULL, "$Id$"); + +static int +m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +{ + int i; + + sendto_one_notice(source_p, ":*** You sent %zu tags.", msgbuf_p->n_tags); + + for (i = 0; i < msgbuf_p->n_tags; i++) + { + struct MsgTag *tag = &msgbuf_p->tags[i]; + + if (tag->value) + sendto_one_notice(source_p, ":*** %d: %s => %s", i, tag->key, tag->value); + else + sendto_one_notice(source_p, ":*** %d: %s", i, tag->key); + } + + return 0; +} + +