当前位置: 首页>>代码示例>>C++>>正文


C++ IsClient函数代码示例

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


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

示例1: xline_remove

/* static int remove_tkline_match(const char *host, const char *user)
 *
 * Inputs:      gecos
 * Output:      returns YES on success, NO if no tkline removed.
 * Side effects: Any matching tklines are removed.
 */
static void
xline_remove(struct Client *source_p, const struct aline_ctx *aline)
{
  struct GecosItem *gecos;

  if ((gecos = gecos_find(aline->mask, irccmp)) == NULL)
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":No X-Line for %s", aline->mask);

    return;
  }

  if (gecos->in_database == false)
  {
    if (IsClient(source_p))
      sendto_one_notice(source_p, &me, ":The X-Line for %s is in the configuration file and must be removed by hand",
                        gecos->mask);
    return;
  }

  if (IsClient(source_p))
    sendto_one_notice(source_p, &me, ":X-Line for [%s] is removed", gecos->mask);

  sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
                       "%s has removed the X-Line for: [%s]",
                       get_oper_name(source_p), gecos->mask);
  ilog(LOG_TYPE_RESV, "%s removed X-Line for [%s]",
       get_oper_name(source_p), gecos->mask);

  gecos_delete(gecos, false);
}
开发者ID:ircd-hybrid,项目名称:ircd-hybrid,代码行数:38,代码来源:m_unxline.c

示例2: mo_chgident

static void
mo_chgident(struct Client *client_p, struct Client *source_p,
            int parc, char *parv[])
{
  struct Client *target_p = NULL;

  if (MyClient(source_p) && !IsOperAdmin(source_p))
  {
    sendto_one(source_p, form_str(ERR_NOPRIVS),
               me.name, source_p->name, "CHGIDENT");
    return;
  }

  if (EmptyString(parv[2]))
  {
    parv[2] = parv[1];
    target_p = source_p;

    if (!IsClient(target_p))
      return;
  }
  else {
    target_p = find_client(parv[1]);

    if (target_p == NULL || !IsClient(target_p))
    {
      sendto_one(source_p, form_str(ERR_NOSUCHNICK),
                 me.name, source_p->name, parv[1]);
      return;
    }
  }

  if (strlen(parv[2]) > USERLEN || !*parv[2] || !valid_username(parv[2]))
  {
    sendto_one(source_p, ":%s NOTICE %s :Invalid username",
               me.name, source_p->name);
    return;
  }

  if (IsUserHostIp(target_p))
    delete_user_host(target_p->username, target_p->host, !MyConnect(target_p));

  strlcpy(target_p->username, parv[2], sizeof(target_p->username));

  add_user_host(target_p->username, target_p->host, !MyConnect(target_p));
  SetUserHost(target_p);

  if (MyClient(source_p))
  {
    sendto_server(client_p, NULL, NOCAPS, NOCAPS, ":%s ENCAP * CHGIDENT %s %s",
                  source_p->name, target_p->name, parv[2]);
    sendto_one(source_p, ":%s NOTICE %s :%s changed to %[email protected]%s",
               me.name, source_p->name, target_p->name, target_p->username,
               target_p->host);
  }

  if (MyConnect(target_p) && IsClient(source_p))
    sendto_one(target_p, ":%s NOTICE %s :You are now %[email protected]%s",
               me.name, target_p->name, target_p->username, target_p->host);
}
开发者ID:mdharris,项目名称:ircd,代码行数:60,代码来源:m_change.c

示例3: CastToClient

void Mob::ExpendAlternateAdvancementCharge(uint32 aa_id) {
	for(auto &iter : aa_ranks) {
		AA::Ability *ability = zone->GetAlternateAdvancementAbility(iter.first);
		if(ability && aa_id == ability->id) {
			if(iter.second.second > 0) {
				iter.second.second -= 1;

				if(iter.second.second == 0) {
					if(IsClient()) {
						AA::Rank *r = ability->GetRankByPointsSpent(iter.second.first);
						if(r) {
							CastToClient()->GetEPP().expended_aa += r->cost;
						}
					}
					if (IsClient()) {
						auto c = CastToClient();
						c->RemoveExpendedAA(ability->first_rank_id);
					}
					aa_ranks.erase(iter.first);
				}

				if(IsClient()) {
					Client *c = CastToClient();
					c->SaveAA();
					c->SendAlternateAdvancementPoints();
				}
			}

			return;
		}
	}
}
开发者ID:af4t,项目名称:Server,代码行数:32,代码来源:aa.cpp

示例4: ms_topic

static void
ms_topic(struct Client *client_p, struct Client *source_p,
         int parc, char *parv[])
{
  struct Channel *chptr = NULL;
  const char *from, *to;
  char topic_info[USERHOST_REPLYLEN];

  if (IsCapable(source_p->from, CAP_TS6) && HasID(source_p))
  {
    from = me.id;
    to = source_p->id;
  }
  else
  {
    from = me.name;
    to = source_p->name;
  }

  if (EmptyString(parv[1]))
  {
    sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS),
               from, to, "TOPIC");
    return;
  }

  if ((chptr = hash_find_channel(parv[1])) == NULL)
  {
    sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
               from, to, parv[1]);
    return;
  }

  if (!IsClient(source_p))
    strlcpy(topic_info, source_p->name, sizeof(topic_info));
  else
    snprintf(topic_info, sizeof(topic_info), "%s!%[email protected]%s", source_p->name,
             source_p->username, source_p->host);
  set_channel_topic(chptr, parv[2], topic_info, CurrentTime, 0);

  sendto_server(client_p, CAP_TS6, NOCAPS, ":%s TOPIC %s :%s",
                ID(source_p), chptr->chname,
                chptr->topic);
  sendto_server(client_p, NOCAPS, CAP_TS6, ":%s TOPIC %s :%s",
                source_p->name, chptr->chname,
                chptr->topic);

  if (!IsClient(source_p))
    sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s TOPIC %s :%s",
                         source_p->name,
                         chptr->chname, chptr->topic);

  else
    sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%[email protected]%s TOPIC %s :%s",
                         source_p->name,
                         source_p->username,
                         source_p->host,
                         chptr->chname, chptr->topic);
}
开发者ID:jmaurice,项目名称:ircd-hybrid,代码行数:59,代码来源:m_topic.c

示例5: GetPlayerRaceValue

bool Mob::CanUseAlternateAdvancementRank(AA::Rank *rank) {
	AA::Ability *ability = rank->base_ability;

	if(!ability)
		return false;

	if(!(ability->classes & (1 << GetClass()))) {
		return false;
	}

	// Passive and Active Shroud AAs
	// For now we skip them
	if(ability->category == 3 || ability->category == 4) {
		return false;
	}

	//the one titanium hack i will allow
	//just to make sure we dont crash the client with newer aas
	//we'll exclude any expendable ones
	if(IsClient() && CastToClient()->ClientVersionBit() & EQEmu::versions::maskTitaniumAndEarlier) {
		if(ability->charges > 0) {
			return false;
		}
	}

	if(IsClient()) {
		if(rank->expansion && !(CastToClient()->GetPP().expansions & (1 << (rank->expansion - 1)))) {
			return false;
		}
	} else {
		if(rank->expansion && !(RuleI(World, ExpansionSettings) & (1 << (rank->expansion - 1)))) {
			return false;
		}
	}

	auto race = GetPlayerRaceValue(GetBaseRace());
	race = race > 16 ? 1 : race;
	if(!(ability->races & (1 << (race - 1)))) {
		return false;
	}

	auto deity = GetDeityBit();
	if(!(ability->deities & deity)) {
		return false;
	}

	if(IsClient() && CastToClient()->Admin() < ability->status) {
		return false;
	}

	if(GetBaseRace() == 522) {
		//drakkin_heritage
		if(!(ability->drakkin_heritage & (1 << GetDrakkinHeritage()))) {
			return false;
		}
	}

	return true;
}
开发者ID:af4t,项目名称:Server,代码行数:59,代码来源:aa.cpp

示例6: CastToClient

void Mob::RemoveAura(int spawn_id, bool skip_strip, bool expired)
{
	for (int i = 0; i < aura_mgr.count; ++i) {
		auto &aura = aura_mgr.auras[i];
		if (aura.spawn_id == spawn_id) {
			if (aura.aura)
				aura.aura->Depop(skip_strip);
			if (expired && IsClient()) {
				CastToClient()->SendColoredText(
				    CC_Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
				// need to update client UI too
				auto app = new EQApplicationPacket(OP_UpdateAura, sizeof(AuraDestory_Struct));
				auto ads = (AuraDestory_Struct *)app->pBuffer;
				ads->action = 1; // delete
				ads->entity_id = spawn_id;
				CastToClient()->QueuePacket(app);
				safe_delete(app);
			}
			while (aura_mgr.count - 1 > i) {
				i++;
				aura.spawn_id = aura_mgr.auras[i].spawn_id;
				aura.icon = aura_mgr.auras[i].icon;
				aura.aura = aura_mgr.auras[i].aura;
				aura_mgr.auras[i].aura = nullptr;
				strn0cpy(aura.name, aura_mgr.auras[i].name, 64);
			}
			aura_mgr.count--;
			return;
		}
	}

	for (int i = 0; i < trap_mgr.count; ++i) {
		auto &aura = trap_mgr.auras[i];
		if (aura.spawn_id == spawn_id) {
			if (aura.aura)
				aura.aura->Depop(skip_strip);
			if (expired && IsClient())
				CastToClient()->SendColoredText(
				    CC_Yellow, StringFormat("%s has expired.", aura.name)); // TODO: verify color
			while (trap_mgr.count - 1 > i) {
				i++;
				aura.spawn_id = trap_mgr.auras[i].spawn_id;
				aura.icon = trap_mgr.auras[i].icon;
				aura.aura = trap_mgr.auras[i].aura;
				trap_mgr.auras[i].aura = nullptr;
				strn0cpy(aura.name, trap_mgr.auras[i].name, 64);
			}
			trap_mgr.count--;
			return;
		}
	}

	return;
}
开发者ID:SecretsOTheP,项目名称:Server,代码行数:54,代码来源:aura.cpp

示例7: RemoveAllAuras

void Mob::RemoveAllAuras()
{
	if (IsClient()) {
		database.SaveAuras(CastToClient());
		EQApplicationPacket outapp(OP_UpdateAura, 4);
		outapp.WriteUInt32(2);
		CastToClient()->QueuePacket(&outapp);
	}

	// this is sent on camp/zone, so it just despawns?
	if (aura_mgr.count) {
		for (auto &e : aura_mgr.auras) {
			if (e.aura)
				e.aura->Depop();
		}
	}

	aura_mgr.count = 0;

	if (trap_mgr.count) {
		for (auto &e : trap_mgr.auras) {
			if (e.aura)
				e.aura->Depop();
		}
	}

	trap_mgr.count = 0;

	return;
}
开发者ID:SecretsOTheP,项目名称:Server,代码行数:30,代码来源:aura.cpp

示例8: PlayAction

//------------------------------------------------------------------------
void CGunTurret::OnTargetLocked(IEntity *pTarget)
{
	if(pTarget)
		PlayAction(g_pItemStrings->lock);

	if(IsServer())
	{
		// if this turret has others linked, notify them about acquired target
		for(IEntityLink *pLink = GetEntity()->GetEntityLinks(); pLink; pLink = pLink->next)
		{
			if(0 != strcmp(pLink->name, "TargetInfo"))
				continue;

			IItem *pItem = g_pGame->GetIGameFramework()->GetIItemSystem()->GetItem(pLink->entityId);

			if(pItem)
			{
				SGameObjectEvent event(pTarget?eCGE_Turret_LockedTarget:eCGE_Turret_LostTarget, eGOEF_ToExtensions);
				event.ptr = pTarget;
				pItem->GetGameObject()->SendEvent(event);
			}
		}
	}

	if(IsClient())
	{
		m_pGameFramework->GetMusicLogic()->SetEvent(eMUSICLOGICEVENT_PLAYER_TURRET_ATTACK);
	}
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:30,代码来源:GunTurret.cpp

示例9: me_chghost

static void
me_chghost(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	struct Client *target_p = NULL;

	if(parc < 3)
		return;

	if(!IsServer(source_p))
		return;

	if((target_p = find_client(parv[1])) == NULL)
		return;

	if(!IsClient(target_p))
		return;

	if(strlen(parv[2]) > HOSTLEN || !*parv[2] || !valid_hostname(parv[2]))
		return;

	if(!strcmp(target_p->host, parv[2]))
		return;

	if(ConfigChannel.cycle_on_hostchange)
		do_hostchange_quits(target_p);

	strlcpy(target_p->host, parv[2], sizeof(target_p->host));

	if(ConfigChannel.cycle_on_hostchange)
		do_hostchange_joins(target_p);
}
开发者ID:diegoagudo,项目名称:redebr-ircd,代码行数:31,代码来源:m_chghost.c

示例10: m_away

/*
** m_away
**      parv[1] = away message
*/
static int
m_away(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
    if(MyClient(source_p) && source_p->localClient->next_away &&
       !IsFloodDone(source_p))
        flood_endgrace(source_p);

    if(!IsClient(source_p))
        return 0;

    if(parc < 2 || EmptyString(parv[1])) {
        /* Marking as not away */
        if(source_p->user->away != NULL) {
            /* we now send this only if they were away before --is */
            sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
                          ":%s AWAY", use_id(source_p));
            free_away(source_p);

            sendto_common_channels_local_butone(source_p, CLICAP_AWAY_NOTIFY, NOCAPS, ":%s!%[email protected]%s AWAY",
                                                source_p->name, source_p->username, source_p->host);
        }
        if(MyConnect(source_p))
            sendto_one_numeric(source_p, RPL_UNAWAY, form_str(RPL_UNAWAY));
        return 0;
    }

    /* Rate limit this because it is sent to common channels. */
    if (MyClient(source_p)) {
        if(!IsOper(source_p) &&
           source_p->localClient->next_away > rb_current_time()) {
            sendto_one(source_p, form_str(RPL_LOAD2HI),
                       me.name, source_p->name, "AWAY");
            return 0;
        }
        if(source_p->localClient->next_away < rb_current_time() -
           ConfigFileEntry.away_interval)
            source_p->localClient->next_away = rb_current_time();
        else
            source_p->localClient->next_away = rb_current_time() +
                                               ConfigFileEntry.away_interval;
    }


    if(source_p->user->away == NULL)
        allocate_away(source_p);
    if(strncmp(source_p->user->away, parv[1], AWAYLEN - 1)) {
        rb_strlcpy(source_p->user->away, parv[1], AWAYLEN);
        sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
                      ":%s AWAY :%s", use_id(source_p), source_p->user->away);
    }

    if(MyConnect(source_p))
        sendto_one_numeric(source_p, RPL_NOWAWAY, form_str(RPL_NOWAWAY));

    sendto_common_channels_local_butone(source_p, CLICAP_AWAY_NOTIFY, NOCAPS, ":%s!%[email protected]%s AWAY :%s",
                                        source_p->name, source_p->username, source_p->host,
                                        source_p->user->away);

    return 0;
}
开发者ID:CustomIRCd,项目名称:elemental-ircd,代码行数:64,代码来源:m_away.c

示例11: check_clean_nick

/* check_clean_nick()
 *
 * input        - pointer to source
 *              -
 *              - nickname
 *              - truncated nickname
 *              - origin of client
 *              - pointer to server nick is coming from
 * output       - none
 * side effects - if nickname is erroneous, or a different length to
 *                truncated nickname, return 1
 */
static int
check_clean_nick(struct Client *source_p, char *nick, struct Client *server_p)
{
  /*
   * The old code did some wacky stuff here, if the nick is invalid, kill it
   * and don't bother messing at all
   */
  if (!valid_nickname(nick, 0))
  {
    ++ServerStats.is_kill;
    sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE,
                         "Bad/long Nick: %s From: %s(via %s)",
                         nick, server_p->name, source_p->from->name);

    sendto_one(source_p, ":%s KILL %s :%s (Bad Nickname)",
               me.name, nick, me.name);

    /* Bad nick change */
    if (IsClient(source_p) && !MyConnect(source_p))
    {
      sendto_server(source_p, 0, 0, ":%s KILL %s :%s (Bad Nickname)",
                    me.id, source_p->id, me.name);
      AddFlag(source_p, FLAGS_KILLED);
      exit_client(source_p, "Bad Nickname");
    }

    return 1;
  }

  return 0;
}
开发者ID:qistchan,项目名称:ircd-hybrid,代码行数:43,代码来源:m_nick.c

示例12: ms_away

static void
ms_away(struct Client *client_p, struct Client *source_p,
        int parc, char *parv[])
{
  if (!IsClient(source_p))
    return;

  if (parc < 2 || EmptyString(parv[1]))
  {
    /* Marking as not away */
    if (source_p->away[0])
    {
      /* we now send this only if they were away before --is */
      sendto_server(client_p, CAP_TS6, NOCAPS,
                    ":%s AWAY", ID(source_p));
      sendto_server(client_p, NOCAPS, CAP_TS6,
                    ":%s AWAY", source_p->name);
      source_p->away[0] = '\0';
    }

    return;
  }

  strlcpy(source_p->away, parv[1], sizeof(source_p->away));

  sendto_server(client_p, CAP_TS6, NOCAPS,
                ":%s AWAY :%s", ID(source_p), source_p->away);
  sendto_server(client_p, NOCAPS, CAP_TS6,
                ":%s AWAY :%s", source_p->name, source_p->away);
}
开发者ID:mindspeaker,项目名称:oftc-hybrid,代码行数:30,代码来源:m_away.c

示例13: me_undline

static void
me_undline(struct Client *client_p, struct Client *source_p,
           int parc, char *parv[])
{
  const char *addr = NULL;

  if (parc != 3 || EmptyString(parv[2]))
    return;

  addr = parv[2];

  if (!IsClient(source_p) || match(parv[1], me.name))
    return;

  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE,
                                   source_p->servptr->name,
                                   source_p->username, source_p->host,
                                   SHARED_UNDLINE))
  {
    if (remove_dline_match(addr))
    {
      sendto_one(source_p,
                 ":%s NOTICE %s :D-Line for [%s] is removed",
                 me.name, source_p->name, addr);
      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
                           "%s has removed the D-Line for: [%s]",
                           get_oper_name(source_p), addr);
      ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
           get_oper_name(source_p), addr);
    }
    else
      sendto_one(source_p, ":%s NOTICE %s :No D-Line for [%s] found",
                 me.name, source_p->name, addr);
  }
}
开发者ID:jmaurice,项目名称:ircd-hybrid,代码行数:35,代码来源:m_dline.c

示例14: UpdateFPCharacter

//------------------------------------------------------------------------
void CItem::UpdateFPCharacter(float frameTime)
{
	if (IsClient())
	{
		ICharacterInstance *pCharacter = GetEntity()->GetCharacter(eIGS_FirstPerson);

		if (pCharacter && !m_idleAnimation[eIGS_FirstPerson].empty() && pCharacter->GetISkeletonAnim()->GetNumAnimsInFIFO(0)<1)
			PlayAction(m_idleAnimation[eIGS_FirstPerson], 0, true);
	}

	// need to explicitly update characters at this point
	// cause the entity system update occered earlier, with the last position
	for (int i=0; i<eIGS_Last; i++)
	{
		if (GetEntity()->GetSlotFlags(i)&ENTITY_SLOT_RENDER)
		{
			ICharacterInstance *pCharacter = GetEntity()->GetCharacter(i);
			if (pCharacter)
			{
				Matrix34 mloc = GetEntity()->GetSlotLocalTM(i,false);
				Matrix34 m34=GetEntity()->GetWorldTM()*mloc;
				QuatT renderLocation = QuatT(m34);
				pCharacter->GetISkeletonPose()->SetForceSkeletonUpdate(8);
				pCharacter->SkeletonPreProcess(renderLocation, renderLocation, GetISystem()->GetViewCamera(),0x55 );
				pCharacter->SetPostProcessParameter(renderLocation, renderLocation, 0, 1.0f, 0x55 ); 
			}
		}
	}

	IEntityRenderProxy *pProxy=GetRenderProxy();
	if (pProxy)
		pProxy->InvalidateLocalBounds();
}
开发者ID:AiYong,项目名称:CryGame,代码行数:34,代码来源:ItemView.cpp

示例15: change_remote_nick

/*!
 *
 * \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
 *      - parv[1] = nickname
 *      - parv[2] = timestamp
 */
static void
change_remote_nick(struct Client *source_p, char *parv[])
{
  int samenick = !irccmp(source_p->name, parv[1]);

  assert(!EmptyString(parv[1]));
  assert(IsClient(source_p));
  assert(source_p->name[0]);

  /* Client changing their nick */
  if (!samenick)
  {
    DelUMode(source_p, UMODE_REGISTERED);
    watch_check_hash(source_p, RPL_LOGOFF);
    source_p->tsinfo = atol(parv[2]);
    assert(source_p->tsinfo > 0);
  }

  sendto_common_channels_local(source_p, 1, 0, ":%s!%[email protected]%s NICK :%s",
                               source_p->name, source_p->username,
                               source_p->host, parv[1]);

  whowas_add_history(source_p, 1);
  sendto_server(source_p, 0, 0, ":%s NICK %s :%lu",
                source_p->id, parv[1], (unsigned long)source_p->tsinfo);

  /* Set the new nick name */
  hash_del_client(source_p);
  strlcpy(source_p->name, parv[1], sizeof(source_p->name));
  hash_add_client(source_p);

  if (!samenick)
    watch_check_hash(source_p, RPL_LOGON);
}
开发者ID:qistchan,项目名称:ircd-hybrid,代码行数:47,代码来源:m_nick.c


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