diff --git a/modules/core/m_message.c b/modules/core/m_message.c index b53a42e..cc98043 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -488,6 +488,7 @@ msg_channel(int p_or_n, const char *command, int caps = 0; int len = 0; struct membership *msptr = find_channel_membership(chptr, source_p); + struct Metadata *md; if(MyClient(source_p)) { @@ -496,6 +497,23 @@ msg_channel(int p_or_n, const char *command, source_p->localClient->last = rb_current_time(); } + if(chptr->mode.mode & MODE_NOREPEAT) + { + md = channel_metadata_find(chptr, "NOREPEAT"); + if(md && (!ConfigChannel.exempt_cmode_K || !is_any_op(msptr))) + { + if(!(strcmp(md->value, strip_colour(text)))) + { + if(p_or_n != NOTICE) + sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, + form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); + return; + } + } + channel_metadata_delete(chptr, "NOREPEAT", 0); + channel_metadata_add(chptr, "NOREPEAT", strip_colour(text), 0); + } + if(chptr->mode.mode & MODE_NOCOLOR && (!ConfigChannel.exempt_cmode_c || !is_any_op(msptr))) { rb_strlcpy(text2, text, BUFSIZE); diff --git a/src/channel.c b/src/channel.c index 991c026..156b6df 100644 --- a/src/channel.c +++ b/src/channel.c @@ -105,7 +105,7 @@ allocate_channel(const char *chname) void free_channel(struct Channel *chptr) { - /* insert deletion of metadata here! */ + channel_metadata_delete(chptr, "NOREPEAT", 0); rb_free(chptr->chname); rb_bh_free(channel_heap, chptr); }