diff --git a/include/h.h b/include/h.h index bfe8abc6b..d1f87e29b 100644 --- a/include/h.h +++ b/include/h.h @@ -269,6 +269,8 @@ extern void sendto_channelprefix_butone(aClient *one, aClient *from, aChannel *c int prefix, char *pattern, ...) __attribute__((format(printf,5,6))); extern void sendto_channel_butone(aClient *, aClient *, aChannel *, char *, ...) __attribute__((format(printf,4,5))); +void sendto_channel_butone_with_capability(aClient *one, unsigned int cap, + aClient *from, aChannel *chptr, char *pattern, ...) __attribute__((format(printf,5,6))); extern void sendto_channel_butserv_butone(aChannel *chptr, aClient *from, aClient *one, char *pattern, ...) __attribute__((format(printf,4,5))); extern void sendto_common_channels(aClient *, char *, ...) __attribute__((format(printf,2,3))); diff --git a/include/struct.h b/include/struct.h index 94ff95dbb..9c40877da 100644 --- a/include/struct.h +++ b/include/struct.h @@ -326,7 +326,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */ #define PROTO_NICKv2 0x0008 /* Negotiated NICKv2 protocol */ #define PROTO_SJOIN2 0x0010 /* Negotiated SJOIN2 protocol */ #define PROTO_UMODE2 0x0020 /* Negotiated UMODE2 protocol */ -//0x0080 unused (was ziplinks) +#define PROTO_INVITENOTIFY 0x0080 /* client supports invite-notify */ #define PROTO_VL 0x0100 /* Negotiated VL protocol */ #define PROTO_SJ3 0x0200 /* Negotiated SJ3 protocol */ #define PROTO_VHP 0x0400 /* Send hostnames in NICKv2 even if not sethosted */ diff --git a/modules.conf b/modules.conf index 367bbaa93..f81f87fc4 100644 --- a/modules.conf +++ b/modules.conf @@ -107,3 +107,11 @@ loadmodule "modules/m_nopost"; loadmodule "modules/m_issecure"; loadmodule "modules/m_cap"; loadmodule "modules/m_sasl"; + +/* + * invite-notify capability (draft). + * + * This module implements support for clients which support the invite-notify + * capability draft. + */ +loadmodule "modules/cap_invitenotify"; diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index 76f0a0dd9..89a07ebe8 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -55,7 +55,7 @@ R_MODULES= \ m_mode.so m_watch.so m_part.so m_join.so m_motd.so m_opermotd.so \ m_botmotd.so m_lusers.so m_names.so m_svsnolag.so m_addmotd.so \ m_svslusers.so m_starttls.so m_nopost.so m_issecure.so m_cap.so \ - m_sasl.so + m_sasl.so cap_invitenotify.so #note change of .c to .o COMMANDS=m_sethost.o m_chghost.o m_chgident.o m_setname.o m_setident.o \ @@ -514,6 +514,10 @@ m_sasl.so: m_sasl.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_sasl.so m_sasl.c +cap_invitenotify.so: cap_invitenotify.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o cap_invitenotify.so cap_invitenotify.c + ############################################################################# # and now the remaining modules... ############################################################################# diff --git a/src/send.c b/src/send.c index a429f2996..8541af907 100644 --- a/src/send.c +++ b/src/send.c @@ -296,6 +296,38 @@ void sendto_channel_butone(aClient *one, aClient *from, aChannel *chptr, } } +void sendto_channel_butone_with_capability(aClient *one, unsigned int cap, + aClient *from, aChannel *chptr, char *pattern, ...) +{ + va_list vl; + Member *lp; + aClient *acptr; + int i; + + ++current_serial; + for (lp = chptr->members; lp; lp = lp->next) + { + acptr = lp->cptr; + /* skip the one and deaf clients (unless sendanyways is set) */ + if (acptr->from == one || (IsDeaf(acptr) && !(sendanyways == 1))) + continue; + if (!CHECKPROTO(acptr, cap)) + continue; + if (MyConnect(acptr)) /* (It is always a client) */ + vsendto_prefix_one(acptr, from, pattern, vl); + else if (acptr->from->serial != current_serial) + { + acptr->from->serial = current_serial; + /* + * Burst messages comes here.. + */ + va_start(vl, pattern); + vsendto_prefix_one(acptr, from, pattern, vl); + va_end(vl); + } + } +} + void sendto_channelprefix_butone(aClient *one, aClient *from, aChannel *chptr, int prefix, char *pattern, ...)