示例#1
0
/*
** m_ping
**      parv[0] = sender prefix
**      parv[1] = origin
**      parv[2] = destination
*/
static void
m_ping(struct Client *client_p, struct Client *source_p,
       int parc, char *parv[])
{
  struct Client *target_p;
  char  *origin, *destination;

  if (parc < 2 || *parv[1] == '\0')
  {
    sendto_one(source_p, form_str(ERR_NOORIGIN), me.name, parv[0]);
    return;
  }

  origin = parv[1];
  destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */

  if (ConfigFileEntry.disable_remote && !IsOper(source_p))
  {
    sendto_one(source_p,":%s PONG %s :%s", me.name,
              (destination) ? destination : me.name, origin);
    return;
  }

  if (!EmptyString(destination) && irccmp(destination, me.name) != 0)
  {
    /* We're sending it across servers.. origin == client_p->name --fl_ */
    origin = client_p->name;

    /* XXX - sendto_server() ? --fl_ */
    if ((target_p = find_server(destination)) != NULL)
    {
      struct Client *ll_p;

      /* use the direct link for LL checking */
      ll_p = target_p->from;

      if(ServerInfo.hub && IsCapable(ll_p, CAP_LL))
      {
        if((ll_p->lazyLinkClientExists & target_p->localClient->serverMask) == 0)
          client_burst_if_needed(target_p, ll_p);
      }

      sendto_one(target_p,":%s PING %s :%s", parv[0],
                 origin, destination);
    }
    else
    {
      sendto_one(source_p, form_str(ERR_NOSUCHSERVER),
                 me.name, parv[0], destination);
      return;
    }
  }
  else
    sendto_one(source_p,":%s PONG %s :%s", me.name,
               (destination) ? destination : me.name, origin);
}
示例#2
0
static void
ms_nburst(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	char *nick;
	char *nick_new = NULL;
	char *nick_old = NULL;
	struct Client *target_p;
	char status;

	if(parc < 2 || *parv[1] == '\0')
		return;

	nick = parv[1];

	if(parc > 2)
		nick_new = parv[2];

	if(parc > 3)
		nick_old = parv[3];

	if(!ServerInfo.hub && IsCapable(client_p, CAP_LL))
		return;
#ifdef DEBUGLL
	sendto_realops_flags(UMODE_ALL, L_ALL, "NBURST called by %s for %s %s %s",
			     client_p->name,
			     nick, nick_new ? nick_new : "", nick_old ? nick_old : "");
#endif

	status = 'N';
	if((target_p = find_client(nick)) != NULL)
	{
		/* nick exists.  burst nick back to leaf */
		status = 'Y';
		client_burst_if_needed(client_p, target_p);
	}

	/* Send back LLNICK, if wanted */
	if(parc > 2)
		sendto_one(client_p, ":%s LLNICK %c %s %s", me.name, status, nick_new,
			   (nick_old ? nick_old : ""));
}