Ejemplo n.º 1
0
void
InitJupes()

{
	struct Jupe *tmpjupe;
	char sendstr[MAXLINE + 1];
	char **av;

	for (tmpjupe = JupeList; tmpjupe; tmpjupe = tmpjupe->next)
	{
		if (tmpjupe->isnick)
		{
#ifdef DANCER
			ircsprintf(sendstr, "NICK %s 1 1 +i juped juped.com %s :%s\r\n",
			           tmpjupe->name, Me.name, tmpjupe->reason ? tmpjupe->reason :
			           "Jupitered Nickname");
#else
			/* collide the nickname */
			ircsprintf(sendstr, "NICK %s 1 1 +i %s %s %s :%s\r\n",
			           tmpjupe->name, JUPED_USERNAME, JUPED_HOSTNAME, Me.name,
			           tmpjupe->reason ? tmpjupe->reason : "Jupitered Nickname");
#endif /* DANCER */

			toserv("%s", sendstr);

			SplitBuf(sendstr, &av);
			AddClient(av);
			MyFree(av);
		}
		else
		{
		  char *tptr;

		  /* check for wildcards */
		  for (tptr = tmpjupe->name; *tptr != '\0' && !IsMWildChar(*tptr); tptr++)
		    ;

		  if (*tptr == '\0')
		    {
			ircsprintf(sendstr, ":%s SERVER %s 2 :Juped: %s", Me.name,
			           tmpjupe->name, tmpjupe->reason);

			toserv(":%s SQUIT %s :%s (%s)\r\n%s\r\n",
			       Me.name,
			       tmpjupe->name,
			       tmpjupe->reason,
			       tmpjupe->who,
			       sendstr);

			SplitBuf(sendstr, &av);
			AddServer(5, av);
			MyFree(av);
		}
	}
	}
} /* InitJupes() */
Ejemplo n.º 2
0
static int
has_wildcards(const char *s)
{
  char c;

  while ((c = *s++))
    if (IsMWildChar(c))
      return 1;

  return 0;
}
int
has_wildcards(const char *str)
{
  const unsigned char *p = (const unsigned char *)str;

  for (; *p; ++p)
  {
    if (*p == '\\')
    {
      if (*++p == '\0')
        return 0;
    }
    else if (IsMWildChar(*p))
      return 1;
  }

  return 0;
}
Ejemplo n.º 4
0
void
DoJupeSquit(char *serv, char *reason, char *who)

{
	struct Server *tempserv, *prev;
	char *servptr;
	int nowild;

	/* check for wildcards */
	for (servptr = serv; *servptr != '\0' && !IsMWildChar(*servptr); servptr++)
	  ;

	nowild = (*servptr == '\0');

	for (tempserv = ServerList; tempserv; )
	{
		if (match(serv, tempserv->name))
		{
			/* squit the server */
			toserv("SQUIT %s :Juped: %s (%s)\r\n", tempserv->name, reason,
			       who);

			prev = tempserv->next;
			DeleteServer(tempserv); /* remove server from list */
			tempserv = prev;

			/* If the fake server is introduced before the remote server has quited,
			 * we get "server already exists" and services get SQUIT'ed,
			 * so we'll introduce it in s_squit()
			 */
			if (nowild)
			  return;
		}
		else
			tempserv = tempserv->next;
	}

	/* we don't want to introduce servers such as "irc.*"
	 */
	if (nowild)
	  FakeServer(serv, reason);
} /* DoJupeSquit() */