summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-05-04 21:17:10 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2013-05-04 21:17:10 +0000
commit113013274fb3b4ff32b442729e0ebb47aa747138 (patch)
tree56c5d466bd5c79f6f0e0eee39795761d7ef9e5a6 /modules/core
parent59c851e2f4bb85fb1b00f59903950703ac3c48bd (diff)
- Implemented channel mode +c. Known from other ircds, this mode basically
prevents users from sending messages including control codes to a channel that has this mode set git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@1938 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/m_message.c17
-rw-r--r--modules/core/m_part.c4
-rw-r--r--modules/core/m_sjoin.c3
3 files changed, 17 insertions, 7 deletions
diff --git a/modules/core/m_message.c b/modules/core/m_message.c
index 7fadaba..5aaf74b 100644
--- a/modules/core/m_message.c
+++ b/modules/core/m_message.c
@@ -409,7 +409,7 @@ static void
msg_channel(int p_or_n, const char *command, struct Client *client_p,
struct Client *source_p, struct Channel *chptr, char *text)
{
- int result;
+ int result = 0;
if (MyClient(source_p))
{
@@ -419,7 +419,7 @@ msg_channel(int p_or_n, const char *command, struct Client *client_p,
}
/* chanops and voiced can flood their own channel with impunity */
- if ((result = can_send(chptr, source_p, NULL)) < 0)
+ if ((result = can_send(chptr, source_p, NULL, text)) < 0)
{
if (result == CAN_SEND_OPV ||
!flood_attack_channel(p_or_n, source_p, chptr))
@@ -429,9 +429,16 @@ msg_channel(int p_or_n, const char *command, struct Client *client_p,
else
{
if (p_or_n != NOTICE)
- sendto_one(source_p, form_str(ERR_CANNOTSENDTOCHAN),
- ID_or_name(&me, client_p),
- ID_or_name(source_p, client_p), chptr->chname);
+ {
+ if (result == ERR_NOCTRLSONCHAN)
+ sendto_one(source_p, form_str(ERR_NOCTRLSONCHAN),
+ ID_or_name(&me, client_p),
+ ID_or_name(source_p, client_p), chptr->chname, text);
+ else
+ sendto_one(source_p, form_str(ERR_CANNOTSENDTOCHAN),
+ ID_or_name(&me, client_p),
+ ID_or_name(source_p, client_p), chptr->chname);
+ }
}
}
diff --git a/modules/core/m_part.c b/modules/core/m_part.c
index 3d1e83a..e999c6a 100644
--- a/modules/core/m_part.c
+++ b/modules/core/m_part.c
@@ -76,7 +76,7 @@ part_one_client(struct Client *client_p, struct Client *source_p,
* only allow /part reasons in -m chans
*/
if (reason[0] && (!MyConnect(source_p) ||
- ((can_send(chptr, source_p, ms) &&
+ ((can_send(chptr, source_p, ms, reason) &&
(source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
< CurrentTime))))
{
@@ -127,7 +127,7 @@ m_part(struct Client *client_p, struct Client *source_p,
return;
}
- if (parc > 2)
+ if (parc > 2 && !EmptyString(parv[2]))
strlcpy(reason, parv[2], sizeof(reason));
/* Finish the flood grace period... */
diff --git a/modules/core/m_sjoin.c b/modules/core/m_sjoin.c
index 65a5caa..8e10097 100644
--- a/modules/core/m_sjoin.c
+++ b/modules/core/m_sjoin.c
@@ -122,6 +122,9 @@ ms_sjoin(struct Client *client_p, struct Client *source_p,
{
switch (*s)
{
+ case 'c':
+ mode.mode |= MODE_NOCTRL;
+ break;
case 't':
mode.mode |= MODE_TOPICLIMIT;
break;