Ejemplo n.º 1
0
/* Completely removes a channel.
 *
 * This includes the removal of all channel-bans, -exempts and -invites, as
 * well as all user flags related to the channel.
 */
static void remove_channel(struct chanset_t *chan)
{
  int i;
  module_entry *me;

  /* Remove the channel from the list, so that noone can pull it
   * away from under our feet during the check_tcl_part() call. */
  (void) chanset_unlink(chan);

  if ((me = module_find("irc", 1, 3)) != NULL)
    (me->funcs[IRC_DO_CHANNEL_PART]) (chan);

  clear_channel(chan, 0);
  noshare = 1;
  /* Remove channel-bans */
  while (chan->bans)
    u_delban(chan, chan->bans->mask, 1);
  /* Remove channel-exempts */
  while (chan->exempts)
    u_delexempt(chan, chan->exempts->mask, 1);
  /* Remove channel-invites */
  while (chan->invites)
    u_delinvite(chan, chan->invites->mask, 1);
  /* Remove channel specific user flags */
  user_del_chan(chan->dname);
  noshare = 0;
  nfree(chan->channel.key);
  for (i = 0; i < MODES_PER_LINE_MAX && chan->cmode[i].op; i++)
    nfree(chan->cmode[i].op);
  if (chan->key)
    nfree(chan->key);
  if (chan->rmkey)
    nfree(chan->rmkey);
  nfree(chan);
}
Ejemplo n.º 2
0
/* Completely removes a channel.
 * This includes the removal of all channel-bans, -exempts and -invites, as
 * well as all user flags related to the channel.
 */
static void remove_channel(struct chanset_t *chan)
{
   clear_channel(chan, 0);
   noshare = 1;
   /* Remove channel-bans */
   while (chan->bans)
     u_delban(chan, chan->bans->mask, 1);
   /* Remove channel-exempts */
   while (chan->exempts)
     u_delexempt(chan, chan->exempts->mask, 1);
   /* Remove channel-invites */
   while (chan->invites)
     u_delinvite(chan, chan->invites->mask, 1);
   /* Remove channel specific user flags */
   user_del_chan(chan->name);
   noshare = 0;
   killchanset(chan);
}
Ejemplo n.º 3
0
/* Check for expired timed-exemptions
 */
static void check_expired_exempts(void)
{
  maskrec *u, *u2;
  struct chanset_t *chan;
  masklist *b, *e;
  int match;

  if (!use_exempts)
    return;
  for (u = global_exempts; u; u = u2) {
    u2 = u->next;
    if (!(u->flags & MASKREC_PERM) && (now >= u->expire)) {
      putlog(LOG_MISC, "*", "%s %s (%s)", EXEMPTS_NOLONGER,
             u->mask, MISC_EXPIRED);
      for (chan = chanset; chan; chan = chan->next) {
        match = 0;
        b = chan->channel.ban;
        while (b->mask[0] && !match) {
          if (mask_match(b->mask, u->mask))
            match = 1;
          else
            b = b->next;
        }
        if (match)
          putlog(LOG_MISC, chan->dname,
                 "Exempt not expired on channel %s. Ban still set!",
                 chan->dname);
        else
          for (e = chan->channel.exempt; e->mask[0]; e = e->next)
            if (!rfc_casecmp(e->mask, u->mask) &&
                expired_mask(chan, e->who) && e->timer != now) {
              add_mode(chan, '-', 'e', u->mask);
              e->timer = now;
            }
      }
      u_delexempt(NULL, u->mask, 1);
    }
  }
  /* Check for specific channel-domain exempts expiring */
  for (chan = chanset; chan; chan = chan->next) {
    for (u = chan->exempts; u; u = u2) {
      u2 = u->next;
      if (!(u->flags & MASKREC_PERM) && (now >= u->expire)) {
        match = 0;
        b = chan->channel.ban;
        while (b->mask[0] && !match) {
          if (mask_match(b->mask, u->mask))
            match = 1;
          else
            b = b->next;
        }
        if (match)
          putlog(LOG_MISC, chan->dname,
                 "Exempt not expired on channel %s. Ban still set!",
                 chan->dname);
        else {
          putlog(LOG_MISC, "*", "%s %s %s %s (%s)", EXEMPTS_NOLONGER,
                 u->mask, MISC_ONLOCALE, chan->dname, MISC_EXPIRED);
          for (e = chan->channel.exempt; e->mask[0]; e = e->next)
            if (!rfc_casecmp(e->mask, u->mask) &&
                expired_mask(chan, e->who) && e->timer != now) {
              add_mode(chan, '-', 'e', u->mask);
              e->timer = now;
            }
          u_delexempt(chan, u->mask, 1);
        }
      }
    }
  }
}