Enforce TS rules on MLOCKs.

This commit is contained in:
William Pitcock 2010-08-23 20:22:59 -05:00
parent e610316019
commit fc579e36e7
3 changed files with 10 additions and 7 deletions

View File

@ -293,7 +293,7 @@ void resv_chan_forcepart(const char *name, const char *reason, int temp_time);
extern void set_channel_mode(struct Client *client_p, struct Client *source_p, extern void set_channel_mode(struct Client *client_p, struct Client *source_p,
struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]); struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]);
extern void set_channel_mlock(struct Client *client_p, struct Client *source_p, extern void set_channel_mlock(struct Client *client_p, struct Client *source_p,
struct Channel *chptr, const char *newmlock); struct Channel *chptr, const char *newmlock, int propagate);
extern struct ChannelMode chmode_table[256]; extern struct ChannelMode chmode_table[256];

View File

@ -236,7 +236,7 @@ ms_mlock(struct Client *client_p, struct Client *source_p, int parc, const char
return 0; return 0;
if(IsServer(source_p)) if(IsServer(source_p))
set_channel_mlock(client_p, source_p, chptr, parv[3]); set_channel_mlock(client_p, source_p, chptr, parv[3], TRUE);
return 0; return 0;
} }

View File

@ -2087,7 +2087,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
/* If this mode char is locked, don't allow local users to change it. */ /* If this mode char is locked, don't allow local users to change it. */
if (MyClient(source_p) && chptr->mode_lock && strchr(chptr->mode_lock, c)) if (MyClient(source_p) && chptr->mode_lock && strchr(chptr->mode_lock, c))
{ {
sendto_one_numeric(source_p, ERR_MLOCKRESTRICTED, form_str(ERR_MLOCKRESTRICTED), chptr->name, c, chptr->mode_lock); sendto_one_numeric(source_p, ERR_MLOCKRESTRICTED, form_str(ERR_MLOCKRESTRICTED), chptr->chname, c, chptr->mode_lock);
continue; continue;
} }
chmode_table[(unsigned char) c].set_func(fakesource_p, chptr, alevel, chmode_table[(unsigned char) c].set_func(fakesource_p, chptr, alevel,
@ -2246,12 +2246,15 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
*/ */
void void
set_channel_mlock(struct Client *client_p, struct Client *source_p, set_channel_mlock(struct Client *client_p, struct Client *source_p,
struct Channel *chptr, const char *newmlock) struct Channel *chptr, const char *newmlock, int propagate)
{ {
rb_free(chptr->mode_lock); rb_free(chptr->mode_lock);
chptr->mode_lock = newmlock ? rb_strdup(newmlock) : NULL; chptr->mode_lock = newmlock ? rb_strdup(newmlock) : NULL;
sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s :%s", if (propagate)
source_p->id, (long) chptr->channelts, chptr->chname, {
chptr->mode_lock ? chptr->mode_lock : ""); sendto_server(client_p, NULL, CAP_TS6 | CAP_MLOCK, NOCAPS, ":%s MLOCK %ld %s :%s",
source_p->id, (long) chptr->channelts, chptr->chname,
chptr->mode_lock ? chptr->mode_lock : "");
}
} }