modules/cap_account_tag: new module providing the account-tag cap as a proof of concept
This commit is contained in:
parent
48a2b7c182
commit
815fbc146f
3 changed files with 97 additions and 34 deletions
|
@ -8,6 +8,7 @@ LIBS += $(top_srcdir)/libratbox/src/libratbox.la $(top_srcdir)/ircd/libircd.la
|
|||
auto_load_moddir=@moduledir@/autoload
|
||||
|
||||
auto_load_mod_LTLIBRARIES = \
|
||||
cap_account_tag.la \
|
||||
chm_nocolour.la \
|
||||
chm_noctcp.la \
|
||||
m_accept.la \
|
||||
|
|
|
@ -134,13 +134,16 @@ am__uninstall_files_from_dir = { \
|
|||
am__installdirs = "$(DESTDIR)$(auto_load_moddir)" \
|
||||
"$(DESTDIR)$(moduledir)"
|
||||
LTLIBRARIES = $(auto_load_mod_LTLIBRARIES) $(module_LTLIBRARIES)
|
||||
chm_nocolour_la_LIBADD =
|
||||
chm_nocolour_la_SOURCES = chm_nocolour.c
|
||||
chm_nocolour_la_OBJECTS = chm_nocolour.lo
|
||||
cap_account_tag_la_LIBADD =
|
||||
cap_account_tag_la_SOURCES = cap_account_tag.c
|
||||
cap_account_tag_la_OBJECTS = cap_account_tag.lo
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
chm_nocolour_la_LIBADD =
|
||||
chm_nocolour_la_SOURCES = chm_nocolour.c
|
||||
chm_nocolour_la_OBJECTS = chm_nocolour.lo
|
||||
chm_noctcp_la_LIBADD =
|
||||
chm_noctcp_la_SOURCES = chm_noctcp.c
|
||||
chm_noctcp_la_OBJECTS = chm_noctcp.lo
|
||||
|
@ -416,37 +419,38 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
|||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = chm_nocolour.c chm_noctcp.c core/m_ban.c core/m_die.c \
|
||||
core/m_error.c core/m_join.c core/m_kick.c core/m_kill.c \
|
||||
core/m_message.c core/m_mode.c core/m_nick.c core/m_part.c \
|
||||
core/m_quit.c core/m_server.c core/m_squit.c m_accept.c \
|
||||
m_admin.c m_away.c m_cap.c m_capab.c m_certfp.c m_challenge.c \
|
||||
m_chghost.c m_close.c m_cmessage.c m_connect.c m_dline.c \
|
||||
m_encap.c m_etrace.c m_grant.c m_help.c m_info.c m_invite.c \
|
||||
m_ison.c m_kline.c m_knock.c m_links.c m_list.c m_locops.c \
|
||||
m_lusers.c m_map.c m_monitor.c m_motd.c m_names.c m_oper.c \
|
||||
m_operspy.c m_pass.c m_ping.c m_pong.c m_post.c m_privs.c \
|
||||
m_rehash.c m_restart.c m_resv.c m_sasl.c m_scan.c m_services.c \
|
||||
m_set.c m_signon.c m_snote.c m_starttls.c m_stats.c m_svinfo.c \
|
||||
m_tb.c m_testline.c m_testmask.c m_tginfo.c m_time.c m_topic.c \
|
||||
m_trace.c m_unreject.c m_user.c m_userhost.c m_users.c \
|
||||
m_version.c m_wallops.c m_who.c m_whois.c m_whowas.c m_xline.c \
|
||||
sno_routing.c
|
||||
DIST_SOURCES = chm_nocolour.c chm_noctcp.c core/m_ban.c core/m_die.c \
|
||||
core/m_error.c core/m_join.c core/m_kick.c core/m_kill.c \
|
||||
core/m_message.c core/m_mode.c core/m_nick.c core/m_part.c \
|
||||
core/m_quit.c core/m_server.c core/m_squit.c m_accept.c \
|
||||
m_admin.c m_away.c m_cap.c m_capab.c m_certfp.c m_challenge.c \
|
||||
m_chghost.c m_close.c m_cmessage.c m_connect.c m_dline.c \
|
||||
m_encap.c m_etrace.c m_grant.c m_help.c m_info.c m_invite.c \
|
||||
m_ison.c m_kline.c m_knock.c m_links.c m_list.c m_locops.c \
|
||||
m_lusers.c m_map.c m_monitor.c m_motd.c m_names.c m_oper.c \
|
||||
m_operspy.c m_pass.c m_ping.c m_pong.c m_post.c m_privs.c \
|
||||
m_rehash.c m_restart.c m_resv.c m_sasl.c m_scan.c m_services.c \
|
||||
m_set.c m_signon.c m_snote.c m_starttls.c m_stats.c m_svinfo.c \
|
||||
m_tb.c m_testline.c m_testmask.c m_tginfo.c m_time.c m_topic.c \
|
||||
m_trace.c m_unreject.c m_user.c m_userhost.c m_users.c \
|
||||
m_version.c m_wallops.c m_who.c m_whois.c m_whowas.c m_xline.c \
|
||||
SOURCES = cap_account_tag.c chm_nocolour.c chm_noctcp.c core/m_ban.c \
|
||||
core/m_die.c core/m_error.c core/m_join.c core/m_kick.c \
|
||||
core/m_kill.c core/m_message.c core/m_mode.c core/m_nick.c \
|
||||
core/m_part.c core/m_quit.c core/m_server.c core/m_squit.c \
|
||||
m_accept.c m_admin.c m_away.c m_cap.c m_capab.c m_certfp.c \
|
||||
m_challenge.c m_chghost.c m_close.c m_cmessage.c m_connect.c \
|
||||
m_dline.c m_encap.c m_etrace.c m_grant.c m_help.c m_info.c \
|
||||
m_invite.c m_ison.c m_kline.c m_knock.c m_links.c m_list.c \
|
||||
m_locops.c m_lusers.c m_map.c m_monitor.c m_motd.c m_names.c \
|
||||
m_oper.c m_operspy.c m_pass.c m_ping.c m_pong.c m_post.c \
|
||||
m_privs.c m_rehash.c m_restart.c m_resv.c m_sasl.c m_scan.c \
|
||||
m_services.c m_set.c m_signon.c m_snote.c m_starttls.c \
|
||||
m_stats.c m_svinfo.c m_tb.c m_testline.c m_testmask.c \
|
||||
m_tginfo.c m_time.c m_topic.c m_trace.c m_unreject.c m_user.c \
|
||||
m_userhost.c m_users.c m_version.c m_wallops.c m_who.c \
|
||||
m_whois.c m_whowas.c m_xline.c sno_routing.c
|
||||
DIST_SOURCES = cap_account_tag.c chm_nocolour.c chm_noctcp.c \
|
||||
core/m_ban.c core/m_die.c core/m_error.c core/m_join.c \
|
||||
core/m_kick.c core/m_kill.c core/m_message.c core/m_mode.c \
|
||||
core/m_nick.c core/m_part.c core/m_quit.c core/m_server.c \
|
||||
core/m_squit.c m_accept.c m_admin.c m_away.c m_cap.c m_capab.c \
|
||||
m_certfp.c m_challenge.c m_chghost.c m_close.c m_cmessage.c \
|
||||
m_connect.c m_dline.c m_encap.c m_etrace.c m_grant.c m_help.c \
|
||||
m_info.c m_invite.c m_ison.c m_kline.c m_knock.c m_links.c \
|
||||
m_list.c m_locops.c m_lusers.c m_map.c m_monitor.c m_motd.c \
|
||||
m_names.c m_oper.c m_operspy.c m_pass.c m_ping.c m_pong.c \
|
||||
m_post.c m_privs.c m_rehash.c m_restart.c m_resv.c m_sasl.c \
|
||||
m_scan.c m_services.c m_set.c m_signon.c m_snote.c \
|
||||
m_starttls.c m_stats.c m_svinfo.c m_tb.c m_testline.c \
|
||||
m_testmask.c m_tginfo.c m_time.c m_topic.c m_trace.c \
|
||||
m_unreject.c m_user.c m_userhost.c m_users.c m_version.c \
|
||||
m_wallops.c m_who.c m_whois.c m_whowas.c m_xline.c \
|
||||
sno_routing.c
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
|
@ -659,6 +663,7 @@ AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined \
|
|||
-shared -export-symbols-regex _mheader
|
||||
auto_load_moddir = @moduledir@/autoload
|
||||
auto_load_mod_LTLIBRARIES = \
|
||||
cap_account_tag.la \
|
||||
chm_nocolour.la \
|
||||
chm_noctcp.la \
|
||||
m_accept.la \
|
||||
|
@ -847,6 +852,9 @@ clean-moduleLTLIBRARIES:
|
|||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
cap_account_tag.la: $(cap_account_tag_la_OBJECTS) $(cap_account_tag_la_DEPENDENCIES) $(EXTRA_cap_account_tag_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) -rpath $(auto_load_moddir) $(cap_account_tag_la_OBJECTS) $(cap_account_tag_la_LIBADD) $(LIBS)
|
||||
|
||||
chm_nocolour.la: $(chm_nocolour_la_OBJECTS) $(chm_nocolour_la_DEPENDENCIES) $(EXTRA_chm_nocolour_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(LINK) -rpath $(auto_load_moddir) $(chm_nocolour_la_OBJECTS) $(chm_nocolour_la_LIBADD) $(LIBS)
|
||||
|
||||
|
@ -1117,6 +1125,7 @@ mostlyclean-compile:
|
|||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cap_account_tag.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chm_nocolour.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chm_noctcp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_accept.Plo@am__quote@
|
||||
|
|
53
modules/cap_account_tag.c
Normal file
53
modules/cap_account_tag.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* charybdis: an advanced ircd.
|
||||
* cap_account_tag.c: implement the account-tag IRCv3.2 capability
|
||||
*
|
||||
* Copyright (c) 2016 William Pitcock <nenolod@dereferenced.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice is present in all copies.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "stdinc.h"
|
||||
#include "modules.h"
|
||||
#include "hook.h"
|
||||
#include "client.h"
|
||||
#include "ircd.h"
|
||||
#include "send.h"
|
||||
#include "s_conf.h"
|
||||
#include "s_user.h"
|
||||
#include "s_serv.h"
|
||||
#include "numeric.h"
|
||||
#include "chmode.h"
|
||||
#include "inline/stringops.h"
|
||||
|
||||
static void cap_account_tag_process(hook_data *);
|
||||
|
||||
mapi_hfn_list_av1 cap_account_tag_hfnlist[] = {
|
||||
{ "outbound_msgbuf", (hookfn) cap_account_tag_process },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
cap_account_tag_process(hook_data *data)
|
||||
{
|
||||
struct MsgBuf *msgbuf = data->arg1;
|
||||
|
||||
if (IsPerson(data->client) && *data->client->user->suser)
|
||||
msgbuf_append_tag(msgbuf, "account", data->client->user->suser, CLICAP_ACCOUNT_TAG);
|
||||
}
|
||||
|
||||
DECLARE_MODULE_AV1(cap_account_tag, NULL, NULL, NULL, NULL, cap_account_tag_hfnlist, "$Revision$");
|
Loading…
Reference in a new issue