Пример #1
0
static void
ms_pong(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	struct Client *target_p;
	const 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];

	/* Now attempt to route the PONG, comstud pointed out routable PING
	 * is used for SPING.  routable PING should also probably be left in
	 *        -Dianora
	 * That being the case, we will route, but only for registered clients (a
	 * case can be made to allow them only from servers). -Shadowfax
	 */
	if(!EmptyString(destination) && !match(destination, me.name) && irccmp(destination, me.id))
	{
		if((target_p = find_client(destination)) || (target_p = find_server(destination)))
			sendto_one(target_p, ":%s PONG %s %s", parv[0], origin, destination);
		else
		{
			sendto_one(source_p, form_str(ERR_NOSUCHSERVER),
				   me.name, parv[0], destination);
			return;
		}
	}
	else if(!HasSentEob(source_p))
		server_eob(source_p);
}
Пример #2
0
static void
server_eob(struct Client *server)
{
  dlink_node *node = NULL;

  assert(IsServer(server));

  AddFlag(server, FLAGS_EOB);

  DLINK_FOREACH(node, server->serv->server_list.head)
    server_eob(node->data);
}
Пример #3
0
/*! \brief EOB command handler
 *
 * \param source_p Pointer to allocated Client struct from which the message
 *                 originally comes from.  This can be a local or remote client.
 * \param parc     Integer holding the number of supplied arguments.
 * \param parv     Argument vector where parv[0] .. parv[parc-1] are non-NULL
 *                 pointers.
 * \note Valid arguments for this command are:
 *      - parv[0] = command
 */
static int
ms_eob(struct Client *source_p, int parc, char *parv[])
{
  assert(IsServer(source_p));

  if (MyConnect(source_p))
    sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
                         "End of burst from %s (%u seconds)",
                         source_p->name,
                         (unsigned int)(CurrentTime - source_p->connection->firsttime));

  server_eob(source_p);

  sendto_server(source_p, 0, 0, ":%s EOB", source_p->id);
  return 0;
}