Keep forward channels in sync after a netjoin.
Arbitrarily prefer a forward channel to no forward channel and an alphabetically higher forward channel to a lower one. This is a simplistic implementation that generates one MODE message to local clients for each ban removed (to be replaced). For simplicity and to avoid amplification of incoming MODE messages, regular modes may still desync the forward channel of a ban.
This commit is contained in:
parent
6929cd012b
commit
d1316b193b
1 changed files with 31 additions and 0 deletions
|
@ -240,6 +240,35 @@ ms_mlock(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
possibly_remove_lower_forward(struct Client *fakesource_p, int mems,
|
||||||
|
struct Channel *chptr, rb_dlink_list *banlist, int mchar,
|
||||||
|
const char *mask, const char *forward)
|
||||||
|
{
|
||||||
|
struct Ban *actualBan;
|
||||||
|
rb_dlink_node *ptr;
|
||||||
|
|
||||||
|
RB_DLINK_FOREACH(ptr, banlist->head)
|
||||||
|
{
|
||||||
|
actualBan = ptr->data;
|
||||||
|
if(!irccmp(actualBan->banstr, mask) &&
|
||||||
|
(actualBan->forward == NULL ||
|
||||||
|
irccmp(actualBan->forward, forward) < 0))
|
||||||
|
{
|
||||||
|
sendto_channel_local(mems, chptr, ":%s MODE %s -%c %s%s%s",
|
||||||
|
fakesource_p->name,
|
||||||
|
chptr->chname,
|
||||||
|
mchar,
|
||||||
|
actualBan->banstr,
|
||||||
|
actualBan->forward ? "$" : "",
|
||||||
|
actualBan->forward ? actualBan->forward : "");
|
||||||
|
rb_dlinkDelete(&actualBan->node, banlist);
|
||||||
|
free_ban(actualBan);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||||
{
|
{
|
||||||
|
@ -347,6 +376,8 @@ ms_bmask(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
*forward++ = '\0';
|
*forward++ = '\0';
|
||||||
if(*forward == '\0')
|
if(*forward == '\0')
|
||||||
tlen--, forward = NULL;
|
tlen--, forward = NULL;
|
||||||
|
possibly_remove_lower_forward(fakesource_p, mems,
|
||||||
|
chptr, banlist, parv[3][0], s, forward);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(add_id(fakesource_p, chptr, s, forward, banlist, mode_type))
|
if(add_id(fakesource_p, chptr, s, forward, banlist, mode_type))
|
||||||
|
|
Loading…
Reference in a new issue