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

C++ IsAnOper函数代码示例

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

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



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

示例1: CMD_FUNC

/*
 * m_userhost added by Darren Reed 13/8/91 to aid clients and reduce
 * the need for complicated requests like WHOIS. It returns user/host
 * information only (no spurious AWAY labels or channels).
 * Re-written by Dianora 1999
 */
DLLFUNC CMD_FUNC(m_userhost)
{

	char *p;		/* scratch end pointer */
	char *cn;		/* current name */
	struct Client *acptr;
	char response[5][NICKLEN * 2 + CHANNELLEN + USERLEN + HOSTLEN + 30];
	int  i;			/* loop counter */

	if (parc < 2)
	{
		sendto_one(sptr, rpl_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "USERHOST");
		return 0;
	}

	/* The idea is to build up the response string out of pieces
	 * none of this strlen() nonsense.
	 * 5 * (NICKLEN*2+CHANNELLEN+USERLEN+HOSTLEN+30) is still << sizeof(buf)
	 * and our ircsprintf() truncates it to fit anyway. There is
	 * no danger of an overflow here. -Dianora
	 */
	response[0][0] = response[1][0] = response[2][0] =
	    response[3][0] = response[4][0] = '\0';

	cn = parv[1];

	for (i = 0; (i < 5) && cn; i++)
	{
		if ((p = strchr(cn, ' ')))
			*p = '\0';

		if ((acptr = find_person(cn, NULL)))
		{
			ircsprintf(response[i], "%s%s=%c%[email protected]%s",
			    acptr->name,
			    (IsAnOper(acptr) && (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr)))
				? "*" : "",
			    (acptr->user->away) ? '-' : '+',
			    acptr->user->username,
			    ((acptr != sptr) && !IsOper(sptr)
			    && IsHidden(acptr) ? acptr->user->virthost :
			    acptr->user->realhost));
		}
		if (p)
			p++;
		cn = p;
	}

	sendto_one(sptr, rpl_str(RPL_USERHOST), me.name, parv[0],
	    response[0], response[1], response[2], response[3], response[4]);

	return 0;
}
开发者ID:Hamper,项目名称:LineIRCd,代码行数:60,代码来源:m_userhost.c


示例2: send_who_reply

static void send_who_reply(aClient *sptr, aClient *acptr, 
			   char *channel, char *status, char *xstat)
{
	char *stat;
	char *host;
	int flat = (FLAT_MAP && !IsAnOper(sptr)) ? 1 : 0;

	stat = malloc(strlen(status) + strlen(xstat) + 1);
	sprintf(stat, "%s%s", status, xstat);

	if (IsAnOper(sptr))
	{
		if (who_flags & WF_REALHOST)
			host = acptr->user->realhost;
		else if (who_flags & WF_IP)
			host = (acptr->user->ip_str ? acptr->user->ip_str : 
			        acptr->user->realhost);
		else
			host = GetHost(acptr);
	}
	else
		host = GetHost(acptr);
					

	if (IsULine(acptr) && !IsOper(sptr) && HIDE_ULINES)
	        sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,
        	     channel,       /* channel name */
	             acptr->user->username, /* user name */
        	     host,		    /* hostname */
	             "hidden",              /* let's hide the server from normal users if the server is a uline and HIDE_ULINES is on */
        	     acptr->name,           /* nick */
	             stat,                  /* status */
        	     0,                     /* hops (hidden) */
	             acptr->info            /* realname */
             	);

	else
		sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,      
		     channel,       /* channel name */
		     acptr->user->username,      /* user name */
		     host,		         /* hostname */
		     acptr->user->server,        /* server name */
		     acptr->name,                /* nick */
		     stat,                       /* status */
		     flat ? 0 : acptr->hopcount, /* hops */ 
		     acptr->info                 /* realname */
		     );
	free(stat);
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:49,代码来源:m_who.c


示例3: m_lag

DLLFUNC int m_lag(aClient *cptr, aClient *sptr, int parc, char *parv[])
{

	if (MyClient(sptr))
		if (!IsAnOper(sptr))
		{
			sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
			    parv[0]);
			return 0;
		}

	if (parc < 2)
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "LAG");
		return 0;
	}
	if (*parv[1] == '\0')
	{
		sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
		    me.name, parv[0], "LAG");
		return 0;
	}
	if (hunt_server_token(cptr, sptr, MSG_LAG, TOK_LAG, ":%s", 1, parc,
	    parv) == HUNTED_NOSUCH)
	{
		return 0;
	}

	sendto_one(sptr, ":%s NOTICE %s :Lag reply -- %s %s %li",
	    me.name, sptr->name, me.name, parv[1], TStime());

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


示例4: show_opers

static void 
show_opers(aClient *cptr, char *name) 
{
    aClient *cptr2;
    DLink *lp;
    int j = 0;

    for (lp = oper_list; lp; lp = lp->next)
    {
    cptr2 = lp->value.cptr;

    if (!IsAnOper(cptr))
    {
        if (cptr2->umode & UMODE_h)
        {
        sendto_one(cptr, ":%s %d %s :%s (%[email protected]%s) Idle: %ld",
               me.name, RPL_STATSDEBUG, name, cptr2->name,
               cptr2->user->username, cptr2->user->host,
               (long)(timeofday - cptr2->user->last));
        j++;
        }
    }
    else
    {
        sendto_one(cptr, ":%s %d %s :%s (%[email protected]%s) Idle: %ld",
               me.name, RPL_STATSDEBUG, name, cptr2->name,
               cptr2->user->username, cptr2->user->host,
               (long)(timeofday - cptr2->user->last));
        j++;
    }
    }
    sendto_one(cptr, ":%s %d %s :%d OPER%s", me.name, RPL_STATSDEBUG,
           name, j, (j == 1) ? "" : "s");
}
开发者ID:Apsu,项目名称:bahamut,代码行数:34,代码来源:m_stats.c


示例5: m_svso

int m_svso(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
        aClient *acptr;
        long fLag;

        if (!IsULine(sptr))
                return 0;

        if (parc < 3)
                return 0;

        if (!(acptr = find_person(parv[1], (aClient *)NULL)))
                return 0;

        if (!MyClient(acptr))
        {
                sendto_one(acptr, ":%s SVSO %s %s", parv[0], parv[1], parv[2]);
                return 0;
        }

        if (*parv[2] == '+')
        {
                int     *i, flag;
                char *m = NULL;
                for (m = (parv[2] + 1); *m; m++)
                {
                        for (i = oper_access; (flag = *i); i += 2)
                        {
                                if (*m == (char) *(i + 1))
                                {
                                        acptr->oflag |= flag;
                                        break;
                                }
                        }
                }
        }
        if (*parv[2] == '-')
        {
                fLag = acptr->umodes;
                if (IsOper(acptr) && !IsHideOper(acptr))
                {
                        IRCstats.operators--;
                        VERIFY_OPERCOUNT(acptr, "svso");
                }
                if (IsAnOper(acptr))
                        delfrom_fdlist(acptr->slot, &oper_fdlist);
                acptr->umodes &=
                    ~(UMODE_OPER | UMODE_LOCOP | UMODE_HELPOP |UMODE_SERVICES |
                    UMODE_SADMIN | UMODE_ADMIN | UMODE_COADMIN);
                acptr->umodes &=
                    ~(UMODE_NETADMIN | UMODE_WHOIS);
                acptr->umodes &=
                    ~(UMODE_KIX | UMODE_DEAF | UMODE_HIDEOPER | UMODE_VICTIM);
                acptr->oflag = 0;
		remove_oper_snomasks(acptr);
		RunHook2(HOOKTYPE_LOCAL_OPER, acptr, 0);
                send_umode_out(acptr, acptr, fLag);
        }
	return 0;
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:60,代码来源:m_svso.c


示例6: show_servers

/* show_servers
 * replies to stats v requests
 */
static void 
show_servers(aClient *cptr, char *name)
{
    aClient *cptr2;
    DLink *lp;
    int j = 0;

    for (lp = server_list; lp; lp = lp->next)
    {
    cptr2 = lp->value.cptr;

#ifdef HIDEULINEDSERVS
    if(IsULine(cptr2) && !IsAnOper(cptr))
        continue;
#endif
    j++;
    sendto_one(cptr, ":%s %d %s :%s (%s!%[email protected]%s) Idle: %ld",
           me.name, RPL_STATSDEBUG, name, cptr2->name,
           (cptr2->serv->bynick[0] ? cptr2->serv->bynick : "Remote."),
           (cptr2->serv->byuser[0] ? cptr2->serv->byuser : "*"),
           (cptr2->serv->byhost[0] ? cptr2->serv->byhost : "*"),
           (long)(timeofday - cptr2->lasttime));
    }
    sendto_one(cptr, ":%s %d %s :%d Server%s", me.name, RPL_STATSDEBUG,
           name, j, (j == 1) ? "" : "s");
}
开发者ID:Apsu,项目名称:bahamut,代码行数:29,代码来源:m_stats.c


示例7: umode_allow_opers

int umode_allow_opers(aClient *sptr, int what)
{
	if (MyClient(sptr))
		return IsAnOper(sptr) ? 1 : 0;
	else
		return 1;
}
开发者ID:cyocom,项目名称:Technokats-Website,代码行数:7,代码来源:umodes.c


示例8: m_globops

/*
 * m_globops (write to *all* opers currently online)
 *      parv[0] = sender prefix
 *      parv[1] = message text
 */
int m_globops(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{ 
  char* message;

  message = parc > 1 ? parv[1] : NULL;
  
  if (EmptyString(message))
    {
      sendto_one(sptr, form_str(ERR_NEEDMOREPARAMS),
                 me.name, parv[0], "GLOBOPS");
      return 0;
    }

  if (!IsServer(sptr) && MyConnect(sptr) && !IsAnOper(sptr))
    {
      sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]);
      return(0);
    }

  sendto_serv_butone(IsServer(cptr) ? cptr : NULL,
                       ":%s GLOBOPS :%s", parv[0], message);
					   
  sendto_globops("from %s: %s", parv[0], message);
	
  return 0;
}
开发者ID:diegoagudo,项目名称:ptlink.ircd,代码行数:31,代码来源:m_wallops.c


示例9: mo_trace

/** Handle a TRACE message from a local oper.
 *
 * \a parv has the following elements:
 * \li \a parv[1] is the nick or servername to trace
 * \li \a parv[2] is the optional 'target' server to trace from
 *
 * 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 mo_trace(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
    if (feature_bool(FEAT_HIS_TRACE) && !IsAnOper(sptr))
        return send_reply(cptr, ERR_NOPRIVILEGES);
    do_trace(cptr, sptr, parc, parv);
    return 0;
}
开发者ID:jast,项目名称:ircu-now,代码行数:19,代码来源:m_trace.c


示例10: m_lnotice

/*
 * m_lnotice (send notice to all local users)
 *      parv[0] = sender prefix
 *      parv[1] = message text
 */
int m_lnotice(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{ 
  char* message;
  struct Client *acptr;

  message = parc > 1 ? parv[1] : NULL;
  
  if (EmptyString(message))
    {
      sendto_one(sptr, form_str(ERR_NEEDMOREPARAMS),
                 me.name, parv[0], "LNOTICE");
      return 0;
    }

  if (MyClient(sptr) && !IsAnOper(sptr))
    {
      sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]);
      return(0);
    }

  for(acptr = local_cptr_list; acptr; acptr = acptr->next_local_client)
    {      
      sendto_one(acptr,":%s NOTICE %s :%s",
         me.name, acptr->name, parv[1]);
    }

  sendto_ops("LNOTICE sent by \2%s\2",parv[0]);
  sendto_serv_butone(&me, ":%s GLOBOPS :LNOTICE on %s :%s", 
    me.name, sptr->name, parv[1]);

  return 0;      
}	                                 	
开发者ID:diegoagudo,项目名称:ptlink.ircd,代码行数:37,代码来源:m_wallops.c


示例11: extended_operoverride

/* This function adds as an extra (weird) operoverride.
 * Currently it's only used if you try to operoverride for a +z channel,
 * if you then do '/join #chan override' it will put the channel -z and allow you directly in.
 * This is to avoid attackers from using 'race conditions' to prevent you from joining.
 * PARAMETERS: sptr = the client, chptr = the channel, mval = mode value (eg MODE_ONLYSECURE),
 *             mchar = mode char (eg 'z')
 * RETURNS: 1 if operoverride, 0 if not.
 */
int extended_operoverride(aClient *sptr, aChannel *chptr, char *key, int mval, char mchar)
{
    unsigned char invited = 0;
    Link *lp;

    if (!IsAnOper(sptr) || !OPCanOverride(sptr))
        return 0;

    for (lp = sptr->user->invited; lp; lp = lp->next)
        if (lp->value.chptr == chptr)
        {
            invited = 1;
            break;
        }
    if (invited)
    {
        if (key && !strcasecmp(key, "override"))
        {
            sendto_channelprefix_butone(NULL, &me, chptr, PREFIX_OP|PREFIX_ADMIN|PREFIX_OWNER,
                                        ":%s NOTICE @%s :setting channel -%c due to OperOverride request from %s",
                                        me.name, chptr->chname, mchar, sptr->name);
            sendto_serv_butone(&me, ":%s MODE %s -%c 0", me.name, chptr->chname, mchar);
            sendto_channel_butserv(chptr, &me, ":%s MODE %s -%c", me.name, chptr->chname, mchar);
            chptr->mode.mode &= ~mval;
            return 1;
        }
    }
    return 0;
}
开发者ID:blank4,项目名称:unrealircd,代码行数:37,代码来源:m_join.c


示例12: m_svsnoop

int m_svsnoop(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
        aClient *acptr;

        if (!(IsULine(sptr) && parc > 2))
                return 0;
        /* svsnoop bugfix --binary */
        if (hunt_server_token(cptr, sptr, MSG_SVSNOOP, TOK_SVSNOOP, "%s :%s", 1, parc,
            parv) == HUNTED_ISME)
        {
                if (parv[2][0] == '+')
                {
                        SVSNOOP = 1;
                        sendto_ops("This server has been placed in NOOP mode");
                        for (acptr = &me; acptr; acptr = acptr->prev)
                        {
                                if (MyClient(acptr) && IsAnOper(acptr))
                                {
                                        if (IsOper(acptr))
                                        {
                                                IRCstats.operators--;
                                                VERIFY_OPERCOUNT(acptr, "svsnoop");
                                        }
					if (IsAnOper(acptr))
                                                delfrom_fdlist(acptr->slot, &oper_fdlist);
										if (IsTotalInvis(acptr)) {
											sendto_channels_inviso_join(acptr);
										}
                                        acptr->umodes &= ~(UMODE_OPER|UMODE_HELPOP|UMODE_SADMIN|UMODE_ADMIN|UMODE_LOCOP|UMODE_SERVICES|UMODE_NETADMIN);
										acptr->umodes &= ~(UMODE_WHOIS|UMODE_KIX|UMODE_HIDEOPER|UMODE_HIDEWHOIS|UMODE_TOTALINVIS|UMODE_MODEWALK|UMODE_NOFAKELAG);
                                        acptr->oflag = 0;
                                        remove_oper_snomasks(acptr);
										sendto_one(acptr, ":%s NOTICE %s :*** Your OFLAGS have been cleared, because this server has been placed in NOOP mode", me.name, acptr->name);
					RunHook2(HOOKTYPE_LOCAL_OPER, acptr, 0);
                                }
                        }

                }
                else
                {
                        SVSNOOP = 0;
                        sendto_ops("This server is no longer in NOOP mode");
                }
        }
	return 0;
}
开发者ID:Hamper,项目名称:LineIRCd,代码行数:46,代码来源:m_svsnoop.c


示例13: 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


示例14:

DLLFUNC char *privdeaf_checkmsg(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{
	if ((acptr->umodes & UMODE_PRIVDEAF) && !IsAnOper(sptr) && !IsULine(sptr) && !IsServer(sptr))
	{
		sendnotice(sptr, "Message to '%s' not delivered: User does not accept private messages", acptr->name);
		return NULL;
	} else
		return text;
}
开发者ID:GeekShed,项目名称:gs-ircd,代码行数:9,代码来源:m_privdeaf.c


示例15:

DLLFUNC char *privdeaf_checkmsg(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice)
{
	if ((acptr->umodes & UMODE_PRIVDEAF) && !IsAnOper(sptr) && !IsULine(sptr) && !IsServer(sptr))
	{
		sendnotice(sptr, "Message to '%s' has not been sent. The user has +D set. This blocks private messages.", acptr->name);
		return NULL;
	} else
		return text;
}
开发者ID:lukemods,项目名称:infinity-irc,代码行数:9,代码来源:m_privdeaf.c


示例16: mo_close

/*
 * mo_close - oper message handler
 * - added by Darren Reed Jul 13 1992.
 */
int mo_close(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
  assert(0 != cptr);
  assert(cptr == sptr);
  assert(IsAnOper(sptr));

  return send_reply(sptr, RPL_CLOSEEND,
		    net_close_unregistered_connections(sptr));
}
开发者ID:DamnIO,项目名称:DamnIRCd,代码行数:13,代码来源:m_close.c


示例17: make_who_status

static void make_who_status(aClient *sptr, aClient *acptr, aChannel *channel, 
			    Member *cm, char *status, int cansee)
{
int i = 0;

	if (acptr->user->away)
		status[i++] = 'G';
	else
		status[i++] = 'H';

	if (IsARegNick(acptr))
		status[i++] = 'r';

	if (acptr->umodes & UMODE_BOT)
		status[i++] = 'B';

	if (IsAnOper(acptr) && (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr)))
		status[i++] = '*';

	if (IsAnOper(acptr) && (IsHideOper(acptr) && sptr != acptr && IsAnOper(sptr)))
		status[i++] = '!';
  
	if (cansee & WHO_OPERSEE)
		status[i++] = '?';

	if (cm)
        {
#ifdef PREFIX_AQ
		if (cm->flags & CHFL_CHANOWNER)
			status[i++] = '~';
		else if (cm->flags & CHFL_CHANPROT)
			status[i++] = '&';
		else
#endif
		if (cm->flags & CHFL_CHANOP)
			status[i++] = '@';
		else if (cm->flags & CHFL_HALFOP)
			status[i++] = '%';
		else if (cm->flags & CHFL_VOICE)
			status[i++] = '+';
	}

	status[i] = '\0';
}
开发者ID:Adam-,项目名称:unrealircd,代码行数:44,代码来源:m_who.c


示例18: foo

void foo()
{
  if (mask && ((mask[0] == '\0') ||
          (mask[1] == '\0' && ((mask[0] == '0') || (mask[0] == '*')))))
	      mask = NULL;
        if ((acptr = FindUser(nick)) &&
	            ((!(bitsel & WHOSELECT_OPER)) || IsAnOper(acptr)) &&
		                Process(acptr) && SHOW_MORE(sptr, counter))
        mask = NULL;
}
开发者ID:Distrotech,项目名称:indent,代码行数:10,代码来源:brackets.c


示例19: m_whowas

/*
 * m_whowas - generic message handler
 *
 * parv[0] = sender prefix
 * parv[1] = nickname queried
 * parv[2] = maximum returned items (optional, default is unlimited)
 * parv[3] = remote server target (Opers only, max returned items 20)
 */
int m_whowas(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
    struct Whowas *temp;
    int cur = 0;
    int max = -1, found = 0;
    char *p, *nick, *s;

    if (parc < 2)
    {
        send_reply(sptr, ERR_NONICKNAMEGIVEN);
        return 0;
    }
    if (parc > 2)
        max = atoi(parv[2]);
    if (parc > 3)
        if (hunt_server_cmd(sptr, CMD_WHOWAS, cptr, 1, "%s %s :%C", 3, parc, parv))
            return 0;

    parv[1] = canonize(parv[1]);
    if (!MyConnect(sptr) && (max > 20))
        max = 20;                   /* Set max replies at 20 */
    for (s = parv[1]; (nick = ircd_strtok(&p, s, ",")); s = 0)
    {
        /* Search through bucket, finding all nicknames that match */
        found = 0;
        for (temp = whowashash[hash_whowas_name(nick)]; temp; temp = temp->hnext)
        {
            if (0 == ircd_strcmp(nick, temp->name))
            {
                send_reply(sptr, RPL_WHOWASUSER, temp->name, temp->username,
                           temp->hostname, temp->realname);
                if (IsAnOper(sptr) && temp->realhost)
                    send_reply(sptr, RPL_WHOISACTUALLY, temp->name, temp->username, temp->realhost, "<untracked>");
                send_reply(sptr, RPL_WHOISSERVER, temp->name,
                           (feature_bool(FEAT_HIS_WHOIS_SERVERNAME) && !IsOper(sptr)) ?
                           feature_str(FEAT_HIS_SERVERNAME) :
                           temp->servername,
                           myctime(temp->logoff));
                if (temp->away)
                    send_reply(sptr, RPL_AWAY, temp->name, temp->away);
                cur++;
                found++;
            }
            if (max >= 0 && cur >= max)
                break;
        }
        if (!found)
            send_reply(sptr, ERR_WASNOSUCHNICK, nick);
        /* To keep parv[1] intact for ENDOFWHOWAS */
        if (p)
            p[-1] = ',';
    }
    send_reply(sptr, RPL_ENDOFWHOWAS, parv[1]);
    return 0;
}
开发者ID:NetGamers,项目名称:ircng,代码行数:63,代码来源:m_whowas.c


示例20: feature_report

/** Report all F-lines to a user.
 * @param[in] to Client requesting statistics.
 * @param[in] sd Stats descriptor for request (ignored).
 * @param[in] param Extra parameter from user (ignored).
 */
void
feature_report(struct Client* to, const struct StatDesc* sd, char* param)
{
  char changed;
  int report;
  int i;

  /* send header so the client knows what we are showing */
  send_reply(to, SND_EXPLICIT | RPL_STATSHEADER,
    "F Feature/Log Value");

  for (i = 0; features[i].type; i++) {
    if ((features[i].flags & FEAT_NODISP) ||
	(features[i].flags & FEAT_MYOPER && !MyOper(to)) ||
	(features[i].flags & FEAT_OPER && !IsAnOper(to)))
      continue; /* skip this one */

 
    changed = (features[i].flags & FEAT_MARK) ? 'F' : 'f';
    report = (features[i].flags & FEAT_MARK) || sd->sd_funcdata;

    switch (features[i].flags & FEAT_MASK) {
    case FEAT_NONE:
      if (features[i].report) /* let the callback handle this */
	(*features[i].report)(to, report);
      break;


    case FEAT_INT: /* Report an F-line with integer values */
      if (features[i].flags & FEAT_MARK) /* it's been changed */
	send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "F %s %d",
		   features[i].type, features[i].v_int);
      break;

    case FEAT_BOOL: /* Report an F-line with boolean values */
      if (report) /* it's been changed */
	send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "%c %s %s",
		   changed, features[i].type, features[i].v_int ? "TRUE" : "FALSE");
      break;

    case FEAT_STR: /* Report an F-line with string values */
      if (report) { /* it's been changed */
	if (features[i].v_str)
	  send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "%c %s %s",
		     changed, features[i].type, features[i].v_str);
	else /* Actually, F:<type> would reset it; you want F:<type>: */
	  send_reply(to, SND_EXPLICIT | RPL_STATSFLINE, "%c %s",
		     changed, features[i].type);
      }
      break;
    }
  }
}
开发者ID:NX-Andro,项目名称:nefarious,代码行数:58,代码来源:ircd_features.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ IsAnimValList函数代码示例发布时间:2022-05-30
下一篇:
C++ IsAltair函数代码示例发布时间: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