• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ BadPtr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BadPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ BadPtr函数的具体用法?C++ BadPtr怎么用?C++ BadPtr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BadPtr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: m_notice

/**
 * Handle NOTICE commands
 *
 * @param source is the nick of the person whom sent the notice
 * @param receiver is the nick whom it was sent to
 * @param msg is the message that was sent
 *
 * @return always returns MOD_CONT
 */
int m_notice(char *source, char *receiver, char *msg)
{
    char *temp = NULL;
    char *version;
    char *clean;

    if (BadPtr(source) || BadPtr(receiver) || BadPtr(msg)) {
        return MOD_CONT;
    }

    if (!stricmp(receiver, s_StatServ)
        || (s_StatServ_alias && !stricmp(receiver, s_StatServ_alias))) {
        clean = normalizeBuffer(msg);
        doCleanBuffer((char *) clean);
        temp = myStrGetToken(clean, ' ', 0);
        if (!temp) {
            free(clean);
            return MOD_CONT;
        }
        if (!stricmp(temp, "VERSION")) {
            version = myStrGetTokenRemainder(clean, ' ', 1);
            handle_ctcp_version(source, version);
            free(version);
        }
        free(clean);
        free(temp);
    }

    return MOD_CONT;
}
开发者ID:danopia,项目名称:denora,代码行数:39,代码来源:messages.c


示例2: m_svslogin

/*
 * SVSLOGIN message
 *
 * parv[0]: source
 * parv[1]: propagation mask
 * parv[2]: target PUID
 * parv[3]: ESVID
 */
static int m_svslogin(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	if (!SASL_SERVER || MyClient(sptr) || (parc < 3) || !parv[3])
		return 0;

	if (!stricmp(parv[1], me.name))
	{
		aClient *target_p;

		/* is the PUID valid? */
		if ((target_p = decode_puid(parv[2])) == NULL)
			return 0;

		if (target_p->user == NULL)
			make_user(target_p);

		strlcpy(target_p->user->svid, parv[3], sizeof(target_p->user->svid));

		sendto_one(target_p, err_str(RPL_LOGGEDIN), me.name,
			   BadPtr(target_p->name) ? "*" : target_p->name,
			   BadPtr(target_p->name) ? "*" : target_p->name,
			   BadPtr(target_p->user->username) ? "*" : target_p->user->username,
			   BadPtr(target_p->user->realhost) ? "*" : target_p->user->realhost,
			   target_p->user->svid, target_p->user->svid);

		return 0;
	}

	/* not for us; propagate. */
	sendto_serv_butone_token(cptr, parv[0], MSG_SVSLOGIN, TOK_SVSLOGIN, "%s %s %s",
				 parv[1], parv[2], parv[3]);

	return 0;
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:42,代码来源:m_sasl.c


示例3: ms_links

/*
 * ms_links - server message handler
 *
 * parv[0] = sender prefix
 * parv[1] = servername mask
 *
 * or
 *
 * parv[0] = sender prefix
 * parv[1] = server to query
 * parv[2] = servername mask
 */
int
ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   char *mask;
   struct Client *acptr;

   if (parc > 2)
   {
     if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) !=
         HUNTED_ISME)
       return 0;
     mask = parv[2];
   }
   else
     mask = parc < 2 ? 0 : parv[1];
 
   for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr))
   {
     if (!IsServer(acptr) && !IsMe(acptr))
       continue;
     if (!BadPtr(mask) && match(mask, cli_name(acptr)))
       continue;
     send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up),
                cli_hopcount(acptr), cli_serv(acptr)->prot,
                ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)"));
   }
 
   send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask);
   return 0;
 }
开发者ID:Niichan,项目名称:snircd,代码行数:42,代码来源:m_links.c


示例4: parse_d_file

void
parse_d_file(FBFILE * file)
{
	struct ConfItem *aconf;
	char *reason_field = (char *) NULL;
	char *host_field = (char *) NULL;
	char line[BUFSIZE];
	char *p;

	while (fbgets(line, sizeof(line), file))
	{
		if((p = strchr(line, '\n')))
			*p = '\0';

		if((*line == '\0') || (line[0] == '#'))
			continue;

		host_field = getfield(line);
		if(BadPtr(host_field))
			continue;

		reason_field = getfield(NULL);
		if(BadPtr(reason_field))
			continue;

		aconf = make_conf();
		aconf->status = CONF_DLINE;
		conf_add_fields(aconf, host_field, reason_field, "", 0, NULL);
		conf_add_d_conf(aconf);
	}
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:31,代码来源:kdparse.c


示例5: parse_resv_file

void
parse_resv_file(FBFILE * file)
{
	char *reason_field;
	char *host_field;
	char line[BUFSIZE];
	char *p;

	while (fbgets(line, sizeof(line), file))
	{
		if((p = strchr(line, '\n')))
			*p = '\0';

		if((*line == '\0') || (line[0] == '#'))
			continue;

		host_field = getfield(line);
		if(BadPtr(host_field))
			continue;

		reason_field = getfield(NULL);
		if(BadPtr(reason_field))
			continue;

		if(IsChannelName(host_field))
			create_resv(host_field, reason_field, RESV_CHANNEL);
		else if(clean_resv_nick(host_field))
			create_resv(host_field, reason_field, RESV_NICK);
	}
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:30,代码来源:kdparse.c


示例6: get_listener_name

inline char *
get_listener_name(aListener *lptr)
{
   static char nbuf[HOSTLEN * 2 + USERLEN + 5];

   ircsprintf(nbuf, "%s[@%s.%d][%s]", me.name, BadPtr(lptr->vhost_string) ?
              "0.0.0.0" : lptr->vhost_string, lptr->port, 
               BadPtr(lptr->allow_string) ?  "*" : lptr->allow_string);

   return nbuf;
}
开发者ID:TrapSquad,项目名称:realistichat,代码行数:11,代码来源:s_misc.c


示例7: CMD_FUNC

DLLFUNC CMD_FUNC(m_starttls)
{
	if (!MyConnect(sptr) || !IsUnknown(sptr))
		return 0;
#ifndef USE_SSL
	/* sendnotice(sptr, "This server does not support SSL"); */
	/* or numeric 691? */
	/* actually... it's probably best to just act like we don't know this command...? */
	sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "STARTTLS");
	return 0;
#else
	if (iConf.ssl_options & SSLFLAG_NOSTARTTLS)
	{
		sendto_one(sptr, err_str(ERR_NOTREGISTERED), me.name, "STARTTLS");
		return 0;
	}
	if (IsSecure(sptr))
	{
		sendto_one(sptr, err_str(ERR_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*", "STARTTLS failed. Already using TLS.");
		return 0;
	}
	dbuf_delete(&sptr->recvQ, 1000000); /* Clear up any remaining plaintext commands */
	sendto_one(sptr, rpl_str(RPL_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*");
	send_queued(sptr);

	SetSSLStartTLSHandshake(sptr);
	Debug((DEBUG_DEBUG, "Starting SSL handshake (due to STARTTLS) for %s", sptr->sockhost));
	if ((sptr->ssl = SSL_new(ctx_server)) == NULL)
		goto fail;
	sptr->flags |= FLAGS_SSL;
	SSL_set_fd(sptr->ssl, sptr->fd);
	SSL_set_nonblocking(sptr->ssl);
	if (!ircd_SSL_accept(sptr, sptr->fd)) {
		Debug((DEBUG_DEBUG, "Failed SSL accept handshake in instance 1: %s", sptr->sockhost));
		SSL_set_shutdown(sptr->ssl, SSL_RECEIVED_SHUTDOWN);
		SSL_smart_shutdown(sptr->ssl);
		SSL_free(sptr->ssl);
		goto fail;
	}

	/* HANDSHAKE IN PROGRESS */
	return 0;
fail:
	/* Failure */
	sendto_one(sptr, err_str(ERR_STARTTLS), me.name, !BadPtr(sptr->name) ? sptr->name : "*", "STARTTLS failed");
	sptr->ssl = NULL;
	sptr->flags &= ~FLAGS_SSL;
	SetUnknown(sptr);
	return 0;
#endif
}
开发者ID:JourneymanGeek,项目名称:rabbitircd,代码行数:51,代码来源:m_starttls.c


示例8: do_jumpserver_exit_client

static int do_jumpserver_exit_client(aClient *sptr)
{
#ifdef USE_SSL
	if (IsSecure(sptr) && jss->ssl_server)
		sendto_one(sptr, rpl_str(RPL_REDIR), me.name,
			BadPtr(sptr->name) ? "*" : sptr->name,
			jss->ssl_server, jss->ssl_port);
	else
#endif
		sendto_one(sptr, rpl_str(RPL_REDIR), me.name,
			BadPtr(sptr->name) ? "*" : sptr->name,
			jss->server, jss->port);
 	return exit_client(sptr, sptr, sptr, jss->reason);
}
开发者ID:RanadeepPolavarapu,项目名称:IRCd,代码行数:14,代码来源:jumpserver.32.c


示例9: exit_banned_client

/*
 * exit_banned_client()
 *
 * Sends an appropriate ban message and disconnects a client.
 */
int
exit_banned_client(aClient *cptr, int loc, char type, char *banmsg, int fast)
{
    char rbuf[512];
    char *target = "*";
    char *reason = "<no reason specified>";
    
    if (cptr->name[0])
        target = cptr->name;
    
    if (!BadPtr(banmsg))
        reason = banmsg;
    
    ircsnprintf(rbuf, sizeof(rbuf), "%c-banned: %s", type, reason);
    
    if (!fast)
    {
      sendto_one(&me, cptr, "NOTICE %s :*** You are banned from %s", target,
                   loc ? me.name : Network_Name);
      sendto_one(&me, cptr, "NOTICE %s :*** Reason: %s", target, reason);
      sendto_one(&me, cptr, "NOTICE %s :*** Connection info: %s [%s]", target,
                   get_client_name(cptr, FALSE),
                   cipntoa(cptr));
      sendto_one(&me, cptr, "NOTICE %s :*** Ban contact: %s", target,
                   loc ? Local_Kline_Address : Network_Kline_Address);
      sendto_one(&me, cptr, "NOTICE %s :*** When contacting %s, please include "
                   "all of the information shown above", target, Network_Name);
      sendto_one(&me, cptr, err_str(ERR_YOUREBANNEDCREEP), me.name, target, rbuf);
        
        throttle_force(cipntoa(cptr));
    }
    
    return exit_client(cptr, cptr, &me, rbuf);
}
开发者ID:TrapSquad,项目名称:realistichat,代码行数:39,代码来源:s_misc.c


示例10: strlen

/*
**  Get Channel block for i (and allocate a new channel
**  block, if it didn't exists before).
*/
aChannel *get_channel(aClient *cptr, char *chname, int flag)
{
	aChannel *chptr;
	int  len;

	if (BadPtr(chname))
		return NULL;

	len = strlen(chname);
	if (MyClient(cptr) && len > CHANNELLEN)
	{
		len = CHANNELLEN;
		*(chname + CHANNELLEN) = '\0';
	}
	if ((chptr = find_channel(chname, (aChannel *)NULL)))
		return (chptr);
	if (flag == CREATE)
	{
		chptr = (aChannel *)MyMalloc(sizeof(aChannel) + len);
		bzero((char *)chptr, sizeof(aChannel));
		strncpyzt(chptr->chname, chname, len + 1);
		if (channel)
			channel->prevch = chptr;
		chptr->topic = NULL;
		chptr->topic_nick = NULL;
		chptr->prevch = NULL;
		chptr->nextch = channel;
		chptr->creationtime = MyClient(cptr) ? TStime() : (TS)0;
		channel = chptr;
		(void)add_to_channel_hash_table(chname, chptr);
		IRCstats.channels++;
		RunHook2(HOOKTYPE_CHANNEL_CREATE, cptr, chptr);
	}
	return chptr;
}
开发者ID:HengeSense,项目名称:Technokats-Website,代码行数:39,代码来源:channel.c


示例11: mo_list

/*
** mo_list
**      parv[0] = sender prefix
**      parv[1] = channel
*/
static void mo_list(struct Client *client_p,
                   struct Client *source_p,
                   int parc,
                   char *parv[])
{

  /* If its a LazyLinks connection, let uplink handle the list
   * even for opers!
   */

  if( uplink && IsCapable( uplink, CAP_LL) )
    {
      if(parc < 2)
	sendto_one( uplink, ":%s LIST", source_p->name );
      else
	sendto_one( uplink, ":%s LIST %s", source_p->name, parv[1] );
      return;
    }

  /* If no arg, do all channels *whee*, else just one channel */
  if (parc < 2 || BadPtr(parv[1]))
    {
      list_all_channels(source_p);
    }
  else
    {
      list_named_channel(source_p,parv[1]);
    }
}
开发者ID:Cloudxtreme,项目名称:ircd-3,代码行数:34,代码来源:m_list.c


示例12: if

/*
** collapse a pattern string into minimal components.
** This particular version is "in place", so that it changes the pattern
** which is to be reduced to a "minimal" size.
*/
char *collapse(char *pattern)
{
	char *s = pattern, *s1, *t;

	if (BadPtr(pattern))
		return pattern;
	/*
	 * Collapse all \** into \*, \*[?]+\** into \*[?]+
	 */
	for (; *s; s++)
		if (*s == '\\')
			if (!*(s + 1))
				break;
			else
				s++;
		else if (*s == '*')
		{
			if (*(t = s1 = s + 1) == '*')
				while (*t == '*')
					t++;
			else if (*t == '?')
				for (t++, s1++; *t == '*' || *t == '?'; t++)
					if (*t == '?')
						*s1++ = *t;
			while ((*s1++ = *t++))
				;
		}
	return pattern;
}
开发者ID:ItsAGeekThing,项目名称:Xtheme,代码行数:34,代码来源:match.c


示例13: m_whowas

/*
** m_whowas
**      parv[0] = sender prefix
**      parv[1] = nickname queried
*/
static void
m_whowas(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	static time_t last_used = 0L;

	if(parc < 2 || BadPtr(parv[1]))
	{
		sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, parv[0]);
		return;
	}

	if((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
	{
		sendto_one(source_p, form_str(RPL_LOAD2HI),
			   me.name, source_p->name, "WHOWAS");
		sendto_one(source_p, form_str(RPL_ENDOFWHOWAS), me.name, parv[0], parv[1]);
		return;
	}
	else
	{
		last_used = CurrentTime;
	}

	whowas_do(client_p, source_p, parc, parv);
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:30,代码来源:m_whowas.c


示例14: m_sasl

/*
 * SASL message
 *
 * parv[0]: prefix
 * parv[1]: distribution mask
 * parv[2]: target PUID
 * parv[3]: mode/state
 * parv[4]: data
 * parv[5]: out-of-bound data
 */
static int m_sasl(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
	if (!SASL_SERVER || MyClient(sptr) || (parc < 4) || !parv[4])
		return 0;

	if (!stricmp(parv[1], me.name))
	{
		aClient *target_p;

		/* is the PUID valid? */
		if ((target_p = decode_puid(parv[2])) == NULL)
			return 0;

		if (target_p->user == NULL)
			make_user(target_p);

		/* reject if another SASL agent is answering */
		if (*target_p->sasl_agent && stricmp(parv[0], target_p->sasl_agent))
			return 0;
		else
			strlcpy(target_p->sasl_agent, parv[0], sizeof(target_p->sasl_agent));

		if (*parv[3] == 'C')
			sendto_one(target_p, "AUTHENTICATE %s", parv[4]);
		else if (*parv[3] == 'D')
		{
			if (*parv[4] == 'F')
				sendto_one(target_p, err_str(ERR_SASLFAIL), me.name, BadPtr(target_p->name) ? "*" : target_p->name);
			else if (*parv[4] == 'S')
			{
				target_p->sasl_complete++;
				sendto_one(target_p, err_str(RPL_SASLSUCCESS), me.name, BadPtr(target_p->name) ? "*" : target_p->name);
			}

			*target_p->sasl_agent = '\0';
		}

		return 0;
	}

	/* not for us; propagate. */
	sendto_serv_butone_token(cptr, parv[0], MSG_SASL, TOK_SASL, "%s %s %c %s %s",
				 parv[1], parv[2], *parv[3], parv[4], parc > 5 ? parv[5] : "");

	return 0;
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:56,代码来源:m_sasl.c


示例15: m_quit

/*
 * m_quit - client message handler
 *
 * parv[0]        = sender prefix
 * parv[parc - 1] = comment
 */
int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
    char *quitnocolour = 0;
    int quittype = 0;
    int ret = 0;

    assert(0 != cptr);
    assert(0 != sptr);
    assert(cptr == sptr);

    ret = find_fline(cptr, sptr, parv[parc-1], WFFLAG_QUIT, parv[1]);
    if (ret != 0) {
        if (ret == 2)
            return CPTR_KILLED;
        else
            parv[parc - 1] = "";
    }

    if (cli_user(sptr)) {
        struct Membership* chan;
        for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) {
            if (!IsZombie(chan) && !member_can_send_to_channel(chan))
                quittype |= 1;
            if (chan->channel->mode.mode & MODE_NOQUITPARTS)
                quittype |= 2;
            if (parc > 1 && !BadPtr(parv[parc - 1]) && HasColour(parv[parc - 1])) {
                if (chan->channel->mode.mode & MODE_NOCOLOUR)
                    quittype |= 2;
                else if (chan->channel->mode.mode & MODE_STRIP)
                    quittype |= 4;
            }
        }
    }
    if (parc > 1 && !BadPtr(parv[parc - 1])) {
        if (quittype & 1)
            return exit_client(cptr, sptr, sptr, "Signed off");
        else if (quittype & 2)
            return exit_client(cptr, sptr, sptr, "Quit");
        else if (quittype & 4 ) {
            if (!quitnocolour) quitnocolour = (char*)StripColour(parv[parc - 1]);
            return exit_client_msg(cptr, sptr, sptr, "Quit: %s", quitnocolour);
        } else
            return exit_client_msg(cptr, sptr, sptr, "Quit: %s", parv[parc - 1]);
    } else
        return exit_client(cptr, sptr, sptr, "Quit");
}
开发者ID:macressler,项目名称:nefarious,代码行数:52,代码来源:m_quit.c


示例16: m_join

/** Handle a JOIN message from a client connection.
 * See @ref m_functions for discussion of the arguments.
 * @param[in] cptr Client that sent us the message.
 * @param[in] sptr Original source of message.
 * @param[in] parc Number of arguments.
 * @param[in] parv Argument vector.
 */
int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{
  struct JoinBuf join;
  struct JoinBuf create;
  char *p = 0;
  char *chanlist;
  char *name;
  char *keys;

  if (parc < 2 || *parv[1] == '\0')
    return need_more_params(sptr, "JOIN");

  if (!IsAnOper(sptr) && IsRestrictJoin(sptr)) {
    send_reply(sptr, ERR_BANNEDFROMCHAN, parv[1]);
    return 0;
  }

  joinbuf_init(&join, sptr, cptr, JOINBUF_TYPE_JOIN, 0, 0);
  joinbuf_init(&create, sptr, cptr, JOINBUF_TYPE_CREATE, 0, TStime());

  chanlist = last0(cptr, sptr, parv[1]); /* find last "JOIN 0" */

  keys = parv[2]; /* remember where keys are */

  for (name = ircd_strtok(&p, chanlist, ","); name;
       name = ircd_strtok(&p, 0, ",")) {
    char *key = 0;

    /* If we have any more keys, take the first for this channel. */
    if (!BadPtr(keys)
        && (keys = strchr(key = keys, ',')))
      *keys++ = '\0';

    /* Empty keys are the same as no keys. */
    if (key && !key[0])
      key = 0;

    if (!IsChannelName(name) || !strIsIrcCh(name))
    {
      /* bad channel name */
      send_reply(sptr, ERR_NOSUCHCHANNEL, name);
      continue;
    }

    if (cli_user(sptr)->joined >= get_client_maxchans(sptr)
	&& !HasPriv(sptr, PRIV_CHAN_LIMIT)) {
      send_reply(sptr, ERR_TOOMANYCHANNELS, name);
      break; /* no point processing the other channels */
    }

    do_join(cptr, sptr, &join, &create, name, key, 0);
  }

  joinbuf_flush(&join); /* must be first, if there's a JOIN 0 */
  joinbuf_flush(&create);

  return 0;
}
开发者ID:evilnet,项目名称:nefarious2,代码行数:65,代码来源:m_join.c


示例17: whowas_do

static int
whowas_do(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	struct Whowas *temp;
	int cur = 0;
	int max = -1, found = 0;
	char *p, *nick;

	if(parc < 2 || BadPtr(parv[1]))
	{
		sendto_one(source_p, form_str(ERR_NONICKNAMEGIVEN), me.name, parv[0]);
		return 0;
	}
	if(parc > 2)
		max = atoi(parv[2]);
	if(parc > 3)
		if(hunt_server(client_p, source_p, ":%s WHOWAS %s %s :%s", 3, parc, parv))
			return 0;


	if((p = strchr(parv[1], ',')))
		*p = '\0';

	nick = parv[1];

	temp = WHOWASHASH[hash_whowas_name(nick)];
	found = 0;
	for (; temp; temp = temp->next)
	{
		if(!irccmp(nick, temp->name))
		{
			sendto_one(source_p, form_str(RPL_WHOWASUSER),
				   me.name, parv[0], temp->name,
				   temp->username,
                                   (IsOperAdmin(source_p))? temp->hostname : temp->rhostname, temp->realname);

			if(ConfigServerHide.hide_servers && !IsOper(source_p))
				sendto_one(source_p, form_str(RPL_WHOISSERVER),
					   me.name, parv[0], temp->name,
					   ServerInfo.network_name, myctime(temp->logoff));
			else
				sendto_one(source_p, form_str(RPL_WHOISSERVER),
					   me.name, parv[0], temp->name,
					   temp->servername, myctime(temp->logoff));

			cur++;
			found++;
		}
		if(max > 0 && cur >= max)
			break;
	}
	if(!found)
		sendto_one(source_p, form_str(ERR_WASNOSUCHNICK), me.name, parv[0], nick);

	sendto_one(source_p, form_str(RPL_ENDOFWHOWAS), me.name, parv[0], parv[1]);
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:57,代码来源:m_whowas.c


示例18: m_privmsg

/**
 * Handle PRIVMSG commands
 *
 * @param source is the nick of the person whom sent the privmsg
 * @param receiver is the nick whom it was sent to
 * @param msg is the message that was sent
 *
 * @return always returns MOD_CONT
 */
int m_privmsg(char *source, char *receiver, char *msg)
{
    char *s;
    User *u;
    PrivMsg *p;

    if (BadPtr(source) || BadPtr(receiver) || BadPtr(msg)) {
        return MOD_CONT;
    }

    u = user_find(source);

    if (!u) {
        alog(LOG_NONEXISTANT, "%s: user record for %s not found", msg,
             source);
        denora_cmd_notice(receiver, source,
                          getstring(NULL, USER_RECORD_NOT_FOUND));
        return MOD_CONT;
    }

    if (*receiver == '#') {
        if (denora->do_sql && !LargeNet) {
            if (stricmp(u->nick, s_StatServ)
                || stricmp(u->nick, s_StatServ_alias)) {
                do_cstats(u, receiver, msg);
            }
        }
    } else {
        /* If a server is specified ([email protected] format), make sure it matches
         * us, and strip it off. */
        s = strchr(receiver, '@');
        if (s) {
            *s++ = 0;
            if (stricmp(s, ServerName) != 0)
                return MOD_CONT;
        }
        p = findPrivMsg(receiver);
        if (p) {
            p->handler(u, msg);
            SET_SEGV_LOCATION();
        }
    }
    return MOD_CONT;
}
开发者ID:danopia,项目名称:denora,代码行数:53,代码来源:messages.c


示例19: m_nospoof

/*
** m_nospoof - allows clients to respond to no spoofing patch
**	parv[0] = prefix
**	parv[1] = code
*/
DLLFUNC int  m_nospoof(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
#ifdef NOSPOOF
	unsigned long result;
#endif
Debug((DEBUG_NOTICE, "NOSPOOF"));

#ifdef NOSPOOF
	if (IsNotSpoof(cptr))
		return 0;
	if (IsRegistered(cptr))
		return 0;
	if (!*sptr->name)
		return 0;
	if (BadPtr(parv[1]))
		goto temp;
	result = strtoul(parv[1], NULL, 16);
	/* Accept code in second parameter (ircserv) */
	if (result != sptr->nospoof)
	{
		if (BadPtr(parv[2]))
			goto temp;
		result = strtoul(parv[2], NULL, 16);
		if (result != sptr->nospoof)
			goto temp;
	}
	sptr->nospoof = 0;
	if (USE_BAN_VERSION && MyConnect(sptr))
		sendto_one(sptr, ":[email protected]%s PRIVMSG %s :\1VERSION\1",
			   me.name, sptr->name);

	if (sptr->user && sptr->name[0])
		return register_user(cptr, sptr, sptr->name,
		    sptr->user->username, NULL, NULL, NULL);
	return 0;
      temp:
	/* Homer compatibility */
	sendto_one(cptr, ":%[email protected]%s PRIVMSG %s :\1VERSION\1",
	    cptr->nospoof, me.name, cptr->name);
#endif
	return 0;
}
开发者ID:cyocom,项目名称:Technokats-Website,代码行数:47,代码来源:m_pingpong.c


示例20: handle_command

/*
 * handle_command
 *
 * inputs	- pointer to message block
 *		- pointer to client
 *		- pointer to client message is from
 *		- count of number of args
 *		- pointer to argv[] array
 * output	- -1 if error from server
 * side effects	-
 */
static int
handle_command(struct Message *mptr, struct Client *client_p,
	       struct Client *from, int i, char *hpara[MAXPARA])
{
	MessageHandler handler = 0;

	if(IsServer(client_p))
		mptr->rcount++;

	mptr->count++;

	/* New patch to avoid server flooding from unregistered connects
	   - Pie-Man 07/27/2000 */

	if(!IsRegistered(client_p))
	{
		/* if its from a possible server connection
		 * ignore it.. more than likely its a header thats sneaked through
		 */

		if(IsAnyServer(client_p) && !(mptr->flags & MFLG_UNREG))
			return (1);
	}

	handler = mptr->handlers[client_p->handler];

	/* check right amount of params is passed... --is */
	if(i < (int)mptr->parameters)
	{
		if(!IsServer(client_p))
		{
			sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS),
				   me.name, BadPtr(hpara[0]) ? "*" : hpara[0], mptr->cmd);
			if(MyClient(client_p))
				return (1);
			else
				return (-1);
		}

		sendto_realops_flags(UMODE_ALL, L_ALL,
				     "Dropping server %s due to (invalid) command '%s'"
				     "with only %d arguments (expecting %d).",
				     client_p->name, mptr->cmd, i, mptr->parameters);
		ilog(L_CRIT, "Insufficient parameters (%d) for command '%s' from %s.",
		     i, mptr->cmd, client_p->name);

		exit_client(client_p, client_p, client_p,
			    "Not enough arguments to server command.");
		return (-1);
	}

	(*handler) (client_p, from, i, hpara);
	return (1);
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:65,代码来源:parse.c



注:本文中的BadPtr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Balise_Group_Close_InfraLib函数代码示例发布时间:2022-05-30
下一篇:
C++ B_TRANSLATE_SYSTEM_NAME函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap