X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/5e413b1372dabb744426dc20b08da3cc28b39a79..1ccc642277721bfb8b7108c2c05edf7c921acbfb:/ircd/tgchange.c diff --git a/ircd/tgchange.c b/ircd/tgchange.c index c8e595aa..1f4ebdc0 100644 --- a/ircd/tgchange.c +++ b/ircd/tgchange.c @@ -38,29 +38,14 @@ static int add_hashed_target(struct Client *source_p, uint32_t hashv); struct Channel * find_allowing_channel(struct Client *source_p, struct Client *target_p) { - rb_dlink_node *ps = source_p->user->channel.head; - rb_dlink_node *pt = target_p->user->channel.head; + rb_dlink_node *ps, *pt; + struct membership *ms, *mt; + struct Channel *chptr; - while (ps && pt) + ITER_COMM_CHANNELS(ps, pt, source_p->user->channel.head, target_p->user->channel.head, ms, mt, chptr) { - struct membership *ms = ps->data; - struct membership *mt = pt->data; - int d; - if (ms->chptr == mt->chptr) - { - if (is_chanop_voiced(ms)) - return ms->chptr; - ps = ps->next; - pt = pt->next; - continue; - } - d = irccmp(ms->chptr->chname, mt->chptr->chname); - if (d < 0) - ps = ps->next; - else if (d > 0) - pt = pt->next; - else - assert("different channels can't have equal names" && false); + if (ms != NULL && mt != NULL && is_chanop_voiced(ms)) + return chptr; } return NULL; }