Add target change for channels.

This has a separate enabling option channel::channel_target_change.

It applies to PRIVMSG, NOTICE and TOPIC by unvoiced unopped non-opers.

The same slots are used for channels and users.
This commit is contained in:
Jilles Tjoelker 2010-08-29 01:26:00 +02:00
parent 8a419c6092
commit 717238d2a2
10 changed files with 73 additions and 15 deletions

View file

@ -39,6 +39,7 @@
#include "parse.h"
#include "modules.h"
#include "packet.h"
#include "tgchange.h"
static int m_topic(struct Client *, struct Client *, int, const char **);
static int ms_topic(struct Client *, struct Client *, int, const char **);
@ -114,6 +115,15 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
return 0;
}
if(MyClient(source_p) && !is_chanop_voiced(msptr) &&
!IsOper(source_p) &&
!add_channel_target(source_p, chptr))
{
sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, chptr->chname);
return 0;
}
if(((chptr->mode.mode & MODE_TOPICLIMIT) == 0 ||
is_chanop(msptr)) &&
(!MyClient(source_p) ||