struct chanset_t* find_common_opped_chan(bd::String nick) { for (struct chanset_t* chan = chanset; chan; chan = chan->next) { if (channel_active(chan) && (me_op(chan) || me_voice(chan))) { if (ismember(chan, nick.c_str())) return chan; } } return NULL; }
/* Report the channel status of every active channel to dcc chat every * 5 minutes. */ static void status_log() { masklist *b; memberlist *m; struct chanset_t *chan; char s[20], s2[20]; int chops, halfops, voice, nonops, bans, invites, exempts; if (!server_online) return; for (chan = chanset; chan != NULL; chan = chan->next) { if (channel_active(chan) && channel_logstatus(chan) && !channel_inactive(chan)) { chops = 0; voice = 0; halfops = 0; for (m = chan->channel.member; m && m->nick[0]; m = m->next) { if (chan_hasop(m)) chops++; else if (chan_hashalfop(m)) halfops++; else if (chan_hasvoice(m)) voice++; } nonops = (chan->channel.members - (chops + voice + halfops)); for (bans = 0, b = chan->channel.ban; b->mask[0]; b = b->next) bans++; for (exempts = 0, b = chan->channel.exempt; b->mask[0]; b = b->next) exempts++; for (invites = 0, b = chan->channel.invite; b->mask[0]; b = b->next) invites++; sprintf(s, "%d", exempts); sprintf(s2, "%d", invites); putlog(LOG_MISC, chan->dname, "%s%s (%s) : [m/%d o/%d h/%d v/%d n/%d b/%d e/%s I/%s]", me_op(chan) ? "@" : me_voice(chan) ? "+" : me_halfop(chan) ? "%" : "", chan->dname, getchanmode(chan), chan->channel.members, chops, halfops, voice, nonops, bans, use_exempts ? s : "-", use_invites ? s2 : "-"); } } }