Пример #1
0
static int
mclient_kilroy(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    SetCork(source_p);
    sendto_one(source_p, ":%s NOTICE %s :                ___              ", me.name,
               source_p->name);
    sendto_one(source_p, ":%s NOTICE %s :___________mm__(O O)__mm_________", me.name,
               source_p->name);
    sendto_one(source_p, ":%s NOTICE %s :           \"\"    U    \"\"         ", me.name,
               source_p->name);
    ClearCork(source_p);
    sendto_one(source_p, ":%s NOTICE %s :Kilroy was here", me.name, source_p->name);
    return 0;
}
Пример #2
0
/*
 * do_admin
 *
 * inputs	- pointer to client to report to
 * output	- none
 * side effects	- admin info is sent to client given
 */
static void
do_admin(struct Client *source_p)
{
	const char *myname;
	const char *nick;

	if(IsClient(source_p))
		admin_spy(source_p);

	myname = get_id(&me, source_p);
	nick = EmptyString(source_p->name) ? "*" : get_id(source_p, source_p);
	SetCork(source_p);
	sendto_one(source_p, form_str(RPL_ADMINME), myname, nick, me.name);
	if(AdminInfo.name != NULL)
		sendto_one(source_p, form_str(RPL_ADMINLOC1), myname, nick, AdminInfo.name);
	if(AdminInfo.description != NULL)
		sendto_one(source_p, form_str(RPL_ADMINLOC2), myname, nick, AdminInfo.description);
	if(AdminInfo.email != NULL)
		sendto_one(source_p, form_str(RPL_ADMINEMAIL), myname, nick, AdminInfo.email);
	ClearCork(source_p);
	send_pop_queue(source_p);
}
Пример #3
0
/*
** mo_info
**  parv[0] = sender prefix
**  parv[1] = servername
*/
static int
mo_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) == HUNTED_ISME)
	{
		info_spy(source_p);
		SetCork(source_p);
		send_info_text(source_p);

		if(IsOper(source_p))
		{
			send_conf_options(source_p);
			sendto_one_numeric(source_p, RPL_INFO, ":%s",
					rb_lib_version());
                }
		send_birthdate_online_time(source_p);
		ClearCork(source_p);
		sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
	}

	return 0;
}
Пример #4
0
/*
** m_info
**  parv[0] = sender prefix
**  parv[1] = servername
*/
static int
m_info(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
	static time_t last_used = 0L;
	static int count;

	if (!check_limit(source_p, &last_used, &count, "INFO")) {
		sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
		return 0;
	}

	if(hunt_server(client_p, source_p, ":%s INFO :%s", 1, parc, parv) != HUNTED_ISME)
		return 0;

	info_spy(source_p);
	SetCork(source_p);
	send_info_text(source_p);
	send_birthdate_online_time(source_p);
	ClearCork(source_p);
	sendto_one_numeric(source_p, RPL_ENDOFINFO, form_str(RPL_ENDOFINFO));
	return 0;
}
Пример #5
0
/* clicap_generate()
 *   Generates a list of capabilities.
 *
 * Inputs: client to send to, subcmd to send,
 *	   flags to match against: 0 to do none, -1 if client has no flags,
 *	   int to whether we are doing CAP CLEAR
 * Outputs: None
 */
static void
clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clear)
{
	char buf[IRCD_BUFSIZE];
	char capbuf[IRCD_BUFSIZE];
	char *p;
	int buflen = 0;
	int curlen, mlen;
	unsigned int i;
	SetCork(source_p);
	mlen = sprintf(buf, ":%s CAP %s %s",
		       me.name, EmptyString(source_p->name) ? "*" : source_p->name, subcmd);

	p = capbuf;
	buflen = mlen;

	/* shortcut, nothing to do */
	if(flags == -1)
	{
		ClearCork(source_p);
		sendto_one(source_p, "%s :", buf);
		return;
	}

	for(i = 0; i < CLICAP_LIST_LEN; i++)
	{
		if(flags)
		{
			if(!IsCapable(source_p, clicap_list[i].cap_serv))
				continue;
			/* they are capable of this, check sticky */
			else if(clear && clicap_list[i].flags & CLICAP_FLAGS_STICKY)
				continue;
		}

		/* \r\n\0, possible "-~=", space, " *" */
		if(buflen + clicap_list[i].namelen >= IRCD_BUFSIZE - 10)
		{
			/* remove our trailing space -- if buflen == mlen
			 * here, we didnt even succeed in adding one.
			 */
			if(buflen != mlen)
				*(p - 1) = '\0';
			else
				*p = '\0';

			sendto_one(source_p, "%s * :%s", buf, capbuf);
			p = capbuf;
			buflen = mlen;
		}

		if(clear)
		{
			*p++ = '-';
			buflen++;

			/* needs a client ack */
			if(clicap_list[i].cap_cli && IsCapable(source_p, clicap_list[i].cap_cli))
			{
				*p++ = '~';
				buflen++;
			}
		}
		else
		{
			if(clicap_list[i].flags & CLICAP_FLAGS_STICKY)
			{
				*p++ = '=';
				buflen++;
			}

			/* if we're doing an LS, then we only send this if
			 * they havent ack'd
			 */
			if(clicap_list[i].cap_cli &&
			   (!flags || !IsCapable(source_p, clicap_list[i].cap_cli)))
			{
				*p++ = '~';
				buflen++;
			}
		}

		curlen = sprintf(p, "%s ", clicap_list[i].name);
		p += curlen;
		buflen += curlen;
	}

	/* remove trailing space */
	if(buflen != mlen)
		*(p - 1) = '\0';
	else
		*p = '\0';
	ClearCork(source_p);
	sendto_one(source_p, "%s :%s", buf, capbuf);
}