Ejemplo n.º 1
0
static void
me_undline(struct Client *client_p, struct Client *source_p,
           int parc, char *parv[])
{
  const char *addr = NULL;

  if (parc != 3 || EmptyString(parv[2]))
    return;

  addr = parv[2];

  if (!IsClient(source_p) || !match(parv[1], me.name))
    return;

  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(ULINE_TYPE,
      source_p->servptr->name,
      source_p->username, source_p->host,
      SHARED_UNDLINE))
  {
    if (remove_tdline_match(addr))
    {
      sendto_one(source_p,
                 ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
                 me.name, source_p->name, addr);
      sendto_realops_flags(UMODE_ALL, L_ALL,
                           "%s has removed the temporary D-Line for: [%s]",
                           get_oper_name(source_p), addr);
      ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
           source_p->name, addr);
      return;
    }

    if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0)
    {
      sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
                 me.name, source_p->name, addr);
      sendto_realops_flags(UMODE_ALL, L_ALL,
                           "%s has removed the D-Line for: [%s]",
                           get_oper_name(source_p), addr);
      ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
           get_oper_name(source_p), addr);
    }
    else
      sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found",
                 me.name, source_p->name, addr);
  }
}
Ejemplo n.º 2
0
static void
remove_resv(struct Client *source_p, const char *name)
{
	struct ConfItem *conf = NULL;
	int services = 0;

	if(IsServices(source_p))
		services = 1;

	if(IsChanPrefix(*name))
	{
		struct ResvChannel *resv_p;

		if(resv_channel_list.head == NULL || !(resv_p = hash_find_resv(name)))
		{
			if(!services)
				sendto_one(source_p,
					   ":%s NOTICE %s :A RESV does not exist for channel: %s",
					   me.name, source_p->name, name);
			return;
		}

		if(resv_p->conf)
		{
			if(!services)
				sendto_one(source_p,
					   ":%s NOTICE %s :The RESV for channel: %s is in ircd.conf and must be removed by hand.",
					   me.name, source_p->name, name);
			return;
		}

		delete_channel_resv(resv_p);
		remove_conf_line(CRESV_TYPE, source_p, name, NULL);

		if(!services)
		{
			sendto_one(source_p,
				   ":%s NOTICE %s :The RESV has been removed on channel: %s",
				   me.name, source_p->name, name);
			sendto_realops_flags(UMODE_ALL, L_ALL,
					     "%s has removed the RESV for channel: %s",
					     get_oper_name(source_p), name);
		}
	}
	else
	{
		struct MatchItem *resv_p = NULL;

		if((conf = find_exact_name_conf(NRESV_TYPE, name, NULL, NULL, NULL)) == NULL)
		{
			if(!services)
				sendto_one(source_p,
					   ":%s NOTICE %s :A RESV does not exist for nick: %s",
					   me.name, source_p->name, name);
			return;
		}

		resv_p = map_to_conf(conf);

		if(resv_p->action)
		{
			if(!services)
				sendto_one(source_p,
					   ":%s NOTICE %s :The RESV for nick: %s is in ircd.conf and must be removed by hand.",
					   me.name, source_p->name, name);
			return;
		}

		delete_conf_item(conf);
		remove_conf_line(NRESV_TYPE, source_p, name, NULL);

		if(!services)
		{
			sendto_one(source_p, ":%s NOTICE %s :The RESV has been removed on nick: %s",
				   me.name, source_p->name, name);
			sendto_realops_flags(UMODE_ALL, L_ALL,
					     "%s has removed the RESV for nick: %s",
					     get_oper_name(source_p), name);
		}
	}
}
Ejemplo n.º 3
0
static void
remove_resv (struct Client *source_p, char *name, int cluster)
{
  struct ConfItem *conf;

  if (IsChanPrefix (*name))
    {
      struct ResvChannel *resv_p;

      if (resv_channel_list.head == NULL || !(resv_p = hash_find_resv (name)))
	{
	  if (!cluster)
	    sendto_one (source_p,
			":%s NOTICE %s :A RESV does not exist for channel: %s",
			me.name, source_p->name, name);
	  return;
	}
      else if (resv_p->conf)
	{
	  if (!cluster)
	    sendto_one (source_p,
			":%s NOTICE %s :The RESV for channel: %s is in ircd.conf and must be removed by hand.",
			me.name, source_p->name, name);
	  return;
	}
      else
	{
	  delete_channel_resv (resv_p);
	  (void) remove_conf_line (CRESV_TYPE, source_p, name, NULL);

	  if (!cluster)
	    sendto_one (source_p,
			":%s NOTICE %s :The RESV has been removed on channel: %s",
			me.name, source_p->name, name);
	  sendto_realops_flags (UMODE_ALL, L_ALL,
				"%s has removed the RESV for channel: %s",
				get_oper_name (source_p), name);
	}
    }
  else if (clean_resv_nick (name))
    {
      struct MatchItem *resv_p;
      conf = find_matching_name_conf (NRESV_TYPE, name, NULL, NULL, 0);

      if (conf == NULL)
	{
	  if (!cluster)
	    sendto_one (source_p,
			":%s NOTICE %s :A RESV does not exist for nick: %s",
			me.name, source_p->name, name);
	  return;
	}
      resv_p = (struct MatchItem *) map_to_conf (conf);
      if (resv_p->action)
	{
	  if (!cluster)
	    sendto_one (source_p,
			":%s NOTICE %s :The RESV for nick: %s is in ircd.conf and must be removed by hand.",
			me.name, source_p->name, name);
	  return;
	}
      else
	{
	  delete_conf_item (conf);
	  (void) remove_conf_line (NRESV_TYPE, source_p, name, NULL);

	  if (!cluster)
	    sendto_one (source_p,
			":%s NOTICE %s :The RESV has been removed on nick: %s",
			me.name, source_p->name, name);
	  sendto_realops_flags (UMODE_ALL, L_ALL,
				"%s has removed the RESV for nick: %s",
				get_oper_name (source_p), name);
	}
    }
}
Ejemplo n.º 4
0
/*
** m_undline
** added May 28th 2000 by Toby Verrall <*****@*****.**>
** based totally on m_unkline
** added to hybrid-7 7/11/2000 --is
**
**      parv[0] = sender nick
**      parv[1] = dline to remove
*/
static void
mo_undline(struct Client *client_p, struct Client *source_p,
           int parc, char *parv[])
{
  char *addr = NULL, *user = NULL;
  char *target_server = NULL;

  if (!HasOFlag(source_p, OPER_FLAG_UNDLINE))
  {
    sendto_one(source_p, form_str(ERR_NOPRIVS),
               me.name, source_p->name, "undline");
    return;
  }

  if (parc < 2 || EmptyString(parv[1]))
  {
    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
               me.name, source_p->name, "UNDLINE");
    return;
  }

  if (parse_aline("UNDLINE", source_p, parc, parv, 0, &user,
                  &addr, NULL, &target_server, NULL) < 0)
    return;

  if (target_server != NULL)
  {
    sendto_match_servs(source_p, target_server, CAP_UNDLN,
                       "UNDLINE %s %s", target_server, addr);

    /* Allow ON to apply local unkline as well if it matches */
    if (!match(target_server, me.name))
      return;
  }
  else
    cluster_a_line(source_p, "UNDLINE", CAP_UNDLN, SHARED_UNDLINE,
                   "%s", addr);

  if (remove_tdline_match(addr))
  {
    sendto_one(source_p,
               ":%s NOTICE %s :Un-Dlined [%s] from temporary D-Lines",
               me.name, source_p->name, addr);
    sendto_realops_flags(UMODE_ALL, L_ALL,
                         "%s has removed the temporary D-Line for: [%s]",
                         get_oper_name(source_p), addr);
    ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
         source_p->name, addr);
    return;
  }

  if (remove_conf_line(DLINE_TYPE, source_p, addr, NULL) > 0)
  {
    sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
               me.name, source_p->name, addr);
    sendto_realops_flags(UMODE_ALL, L_ALL,
                         "%s has removed the D-Line for: [%s]",
                         get_oper_name(source_p), addr);
    ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
         get_oper_name(source_p), addr);
  }
  else
    sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found",
               me.name, source_p->name, addr);
}