本文整理汇总了C++中IsServer函数的典型用法代码示例。如果您正苦于以下问题:C++ IsServer函数的具体用法?C++ IsServer怎么用?C++ IsServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsServer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DualSOCOM
//------------------------------------------------------------------------
//------------------------------------------------------------------------
//-------------------------------------------------------------------------
void CPlayerFeature::DualSOCOM(CActor *pActor)
{
if(pActor && !pActor->IsPlayer())
{
IInventory *pInventory=GetActorInventory(pActor);
if (pInventory)
{
if (IsServer())
{
m_pItemSystem->GiveItem(pActor, "SOCOM", false, false,false);
//m_pItemSystem->SetActorItem(pActor,"SOCOM",true);
}
}
}
}
示例2: do_numeric
/** Forwards a numeric message from a remote server.
* @param numeric Value of numeric message.
* @param nnn If non-zero, treat parv[1] as a numnick; else as a client name.
* @param cptr Client that originated the numeric.
* @param sptr Peer that sent us the numeric.
* @param parc Count of valid arguments in \a parv.
* @param parv Argument list.
* @return Zero (always).
*/
int do_numeric(int numeric, int nnn, struct Client *cptr, struct Client *sptr,
int parc, char *parv[])
{
struct Client *acptr = 0;
struct Channel *achptr = 0;
char num[4];
/* Avoid trash, we need it to come from a server and have a target */
if ((parc < 2) || !IsServer(sptr))
return 0;
/* Who should receive this message ? Will we do something with it ?
Note that we use findUser functions, so the target can't be neither
a server, nor a channel (?) nor a list of targets (?) .. u2.10
should never generate numeric replies to non-users anyway
Ahem... it can be a channel actually, csc bots use it :\ --Nem */
if (IsChannelName(parv[1]))
achptr = FindChannel(parv[1]);
else
acptr = (nnn) ? (findNUser(parv[1])) : (FindUser(parv[1]));
if (((!acptr) || (cli_from(acptr) == cptr)) && !achptr)
return 0;
/* Remap low number numerics, not that I understand WHY.. --Nemesi */
/* numerics below 100 talk about the current 'connection', you're not
* connected to a remote server so it doesn't make sense to send them
* remotely - but the information they contain may be useful, so we
* remap them up. Weird, but true. -- Isomer */
if (numeric < 100)
numeric += 100;
ircd_snprintf(0, num, sizeof(num), "%03d", numeric);
/* Since 2.10.10.pl14 we rewrite numerics from remote servers to appear to
* come from the local server
*/
if (acptr)
sendcmdto_one((feature_bool(FEAT_HIS_REWRITE) && !IsOper(acptr)) ?
&me : sptr,
num, num, acptr, "%C %s", acptr, parv[2]);
else
sendcmdto_channel_butone(feature_bool(FEAT_HIS_REWRITE) ? &me : sptr,
num, num, achptr, cptr, SKIP_DEAF | SKIP_BURST,
'\0', "%H %s", achptr, parv[2]);
return 0;
}
示例3: CMD_FUNC
/*
* Heavily modified from the ircu m_motd by codemastr
* Also svsmotd support added
*/
DLLFUNC CMD_FUNC(m_rules)
{
ConfigItem_tld *ptr;
aMotd *temp;
char userhost[USERLEN + HOSTLEN + 6];
if (IsServer(sptr))
return 0;
if (hunt_server_token(cptr, sptr, MSG_RULES, TOK_RULES, ":%s", 1, parc,
parv) != HUNTED_ISME)
return 0;
#ifndef TLINE_Remote
if (!MyConnect(sptr))
{
temp = rules;
goto playrules;
}
#endif
strlcpy(userhost,make_user_host(cptr->user->username, cptr->user->realhost), sizeof userhost);
ptr = Find_tld(sptr, userhost);
if (ptr)
{
temp = ptr->rules;
}
else
temp = rules;
playrules:
if (temp == NULL)
{
sendto_one(sptr, err_str(ERR_NORULES), me.name, parv[0]);
return 0;
}
sendto_one(sptr, rpl_str(RPL_RULESSTART), me.name, parv[0], me.name);
while (temp)
{
sendto_one(sptr, rpl_str(RPL_RULES), me.name, parv[0],
temp->line);
temp = temp->next;
}
sendto_one(sptr, rpl_str(RPL_ENDOFRULES), me.name, parv[0]);
return 0;
}
示例4: sendcmdto_common_channels_capab_butone
/** Send a (prefixed) command to all channels that \a from is on.
* @param[in] from Client originating the command.
* @param[in] cmd Long name of command.
* @param[in] tok Short name of command.
* @param[in] one Client direction to skip (or NULL).
* @param[in] pattern Format string for command arguments.
*/
void sendcmdto_common_channels_capab_butone(struct Client *from, const char *cmd,
const char *tok, struct Client *one,
int withcap, int skipcap,
const char *pattern, ...)
{
struct VarData vd;
struct MsgBuf *mb;
struct Membership *chan;
struct Membership *member;
assert(0 != from);
assert(0 != cli_from(from));
assert(0 != pattern);
assert(!IsServer(from) && !IsMe(from));
vd.vd_format = pattern; /* set up the struct VarData for %v */
va_start(vd.vd_args, pattern);
/* build the buffer */
mb = msgq_make(0, "%:#C %s %v", from, cmd, &vd);
va_end(vd.vd_args);
bump_sentalong(from);
/*
* loop through from's channels, and the members on their channels
*/
for (chan = cli_user(from)->channel; chan; chan = chan->next_channel) {
if (IsZombie(chan) || IsDelayedJoin(chan))
continue;
for (member = chan->channel->members; member;
member = member->next_member)
if (MyConnect(member->user)
&& -1 < cli_fd(cli_from(member->user))
&& member->user != one
&& cli_sentalong(member->user) != sentalong_marker
&& ((withcap == CAP_NONE) || CapActive(member->user, withcap))
&& ((skipcap == CAP_NONE) || !CapActive(member->user, skipcap))) {
cli_sentalong(member->user) = sentalong_marker;
send_buffer(member->user, mb, 0);
}
}
if (MyConnect(from) && from != one)
send_buffer(from, mb, 0);
msgq_clean(mb);
}
示例5: m_sxline
/*
* m_sxline() - add info ban line
*
* parv[0] = sender prefix
* parv[1] = info banned mask
*/
int m_sxline(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{
aConfItem *aconf;
char *reason = NULL;
char *mask;
int len;
if (!IsService(sptr) && !IsServer(cptr))
{
sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]);
return 0;
}
if(parc<3)
{
sendto_one(sptr, form_str(ERR_NEEDMOREPARAMS),
me.name, parv[0], "SXLINE");
return 0;
}
len=atoi(parv[1]);
mask = parv[2];
if ((strlen(mask) > len) && (mask[len])==':')
{
mask[len] = '\0';
reason = mask+len+1;
}
else
{ /* Bogus */
return 0;
}
if (!find_sxline(mask)) /* sxline does not exist */
{
aconf = make_conf();
DupString(aconf->name, mask);
DupString(aconf->passwd, reason);
aconf->next = sxlines;
sxlines = aconf;
sendto_serv_butone(cptr, ":%s SXLINE %d :%s:%s", sptr->name, len,
aconf->name,aconf->passwd);
}
return 0;
}
示例6: jupe_deactivate
/** Deactivate a jupe.
* @param[in] cptr Local client that sent us the jupe.
* @param[in] sptr Originator of the jupe.
* @param[in] jupe Jupe to deactivate.
* @param[in] lastmod New timestamp for last modification of the jupe.
* @param[in] flags Flags to set on the jupe.
* @return Zero.
*/
int
jupe_deactivate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
time_t lastmod, unsigned int flags)
{
unsigned int saveflags = 0;
assert(0 != jupe);
saveflags = jupe->ju_flags;
if (!JupeIsLocal(jupe)) {
if (flags & JUPE_LOCAL)
jupe->ju_flags |= JUPE_LDEACT;
else {
jupe->ju_flags &= ~JUPE_ACTIVE;
if (jupe->ju_lastmod >= lastmod) /* force lastmod to increase */
jupe->ju_lastmod++;
else
jupe->ju_lastmod = lastmod;
}
if ((saveflags & JUPE_ACTMASK) != JUPE_ACTIVE)
return 0; /* was inactive to begin with */
}
/* Inform ops and log it */
sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: "
"%s",
(feature_bool(FEAT_HIS_SNOTICES) || IsServer(sptr)) ?
cli_name(sptr) :
cli_name((cli_user(sptr))->server),
JupeIsLocal(jupe) ? "removing local" : "deactivating",
jupe->ju_server, jupe->ju_expire + TSoffset,
jupe->ju_reason);
log_write(LS_JUPE, L_INFO, LOG_NOSNOTICE,
"%#C %s JUPE for %s, expiring at %Tu: %s", sptr,
JupeIsLocal(jupe) ? "removing local" : "deactivating",
jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
if (JupeIsLocal(jupe))
jupe_free(jupe);
else if (!(flags & JUPE_LOCAL)) /* don't propagate local changes */
propagate_jupe(cptr, sptr, jupe);
return 0;
}
示例7: is_chan_op
int is_chan_op(aClient *cptr, aChannel *chptr)
{
Membership *lp;
/* chanop/halfop ? */
if (IsServer(cptr))
return 1;
if (chptr)
if ((lp = find_membership_link(cptr->user->channel, chptr)))
#ifdef PREFIX_AQ
return ((lp->flags & (CHFL_CHANOP|CHFL_CHANPROT|CHFL_CHANOWNER)));
#else
return ((lp->flags & CHFL_CHANOP));
#endif
return 0;
}
示例8:
aClient *find_match_server(char *mask)
{
aClient *acptr;
if (BadPtr(mask))
return NULL;
for (acptr = client, collapse(mask); acptr; acptr = acptr->next)
{
if (!IsServer(acptr) && !IsMe(acptr))
continue;
if (!match(mask, acptr->name))
break;
continue;
}
return acptr;
}
示例9: get_client_class
/*
* get_client_class
*
* inputs - pointer to client struct
* output - pointer to name of class
* side effects - NONE
*/
const char *
get_client_class(struct Client *target_p)
{
const char *retc = "unknown";
if(target_p == NULL || IsMe(target_p))
return retc;
if(IsServer(target_p))
{
struct server_conf *server_p = target_p->localClient->att_sconf;
return server_p->class_name;
}
return get_class_name(target_p->localClient->att_conf);;
}
示例10: ms_eob
/*! \brief EOB command handler
*
* \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
*/
static int
ms_eob(struct Client *source_p, int parc, char *parv[])
{
assert(IsServer(source_p));
if (MyConnect(source_p))
sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE,
"End of burst from %s (%u seconds)",
source_p->name,
(unsigned int)(CurrentTime - source_p->connection->firsttime));
server_eob(source_p);
sendto_server(source_p, 0, 0, ":%s EOB", source_p->id);
return 0;
}
示例11: StopSound
//------------------------------------------------------------------------
void CGunTurret::OnDestroyed()
{
CWeapon::OnDestroyed();
if(m_fm2)
{
if(m_fm2->IsFiring())
m_fm2->StopFire();
}
StopSound(m_lightSound);
m_lightSound = INVALID_SOUNDID;
if(IsServer())
GetGameObject()->ChangedNetworkState(ASPECT_STATEBITS);
}
示例12: crule_directcon
static int crule_directcon(int numargs, void *crulearg[])
{
int i;
struct Client *acptr;
/* adapted from m_trace and exit_one_client */
for (i = 0; i <= HighestFd; i++)
{
if (!(acptr = LocalClientArray[i]) || !IsServer(acptr))
continue;
if (match((char *)crulearg[0], cli_name(acptr)))
continue;
return (1);
}
return (0);
}
示例13: ms_pong
static int
ms_pong(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
const char *destination;
destination = parv[2];
source_p->flags &= ~FLAGS_PINGSENT;
/* Now attempt to route the PONG, comstud pointed out routable PING
* is used for SPING. routable PING should also probably be left in
* -Dianora
* That being the case, we will route, but only for registered clients (a
* case can be made to allow them only from servers). -Shadowfax
*/
if(!EmptyString(destination) && !match(destination, me.name) &&
irccmp(destination, me.id))
{
if((target_p = find_client(destination)) ||
(target_p = find_server(NULL, destination)))
sendto_one(target_p, ":%s PONG %s %s",
get_id(source_p, target_p), parv[1],
get_id(target_p, target_p));
else
{
if(!IsDigit(*destination))
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), destination);
return 0;
}
}
/* destination is us, emulate EOB */
if(IsServer(source_p) && !HasSentEob(source_p))
{
if(MyConnect(source_p))
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"End of burst (emulated) from %s (%d seconds)",
source_p->name,
(signed int) (CurrentTime - source_p->localClient->firsttime));
SetEob(source_p);
eob_count++;
call_hook(h_server_eob, source_p);
}
return 0;
}
示例14: mo_squit
/*
* mo_squit (oper)
*
* parv[0] = sender prefix
* parv[1] = server name
* parv[2] = comment (optional)
*
*/
int mo_squit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
const char* server;
struct Client *acptr;
struct Client *acptr2;
char *comment;
if (parc < 2)
return need_more_params(sptr, "SQUIT");
if (parc < 3 || BadPtr(parv[2]))
comment = cli_name(sptr);
else
comment = parv[2];
server = parv[1];
/*
* The following allows wild cards in SQUIT. Only useful
* when the command is issued by an oper.
*/
for (acptr = GlobalClientList; (acptr = next_client(acptr, server));
acptr = cli_next(acptr)) {
if (IsServer(acptr) || IsMe(acptr))
break;
}
/* Not found? Bugger. */
if (!acptr || IsMe(acptr))
return send_reply(sptr, ERR_NOSUCHSERVER, server);
/*
* Look for a matching server that is closer,
* that way we won't accidentally squit two close
* servers like davis.* and davis-r.* when typing
* /SQUIT davis*
*/
for (acptr2 = cli_serv(acptr)->up; acptr2 != &me;
acptr2 = cli_serv(acptr2)->up)
if (!match(server, cli_name(acptr2)))
acptr = acptr2;
/* Disallow local opers to squit remote servers */
if (IsLocOp(sptr) && !MyConnect(acptr))
return send_reply(sptr, ERR_NOPRIVILEGES);
return exit_client(cptr, acptr, sptr, comment);
}
示例15: ms_eob
/*
** ms_eob
** parv[0] = sender prefix
** parv[1] = opt. comma separated list of SIDs for which this EOB is
** also valid
*/
static int
ms_eob(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *copy, *state, *id;
struct Client *target_p;
int act = 0;
if(!HasSentEob(source_p))
{
if(MyConnect(source_p))
{
sendto_realops_flags(UMODE_ALL, L_ALL,
"End of burst from %s (%d seconds)",
source_p->name,
(signed int)(rb_current_time() -
source_p->localClient->firsttime));
sendto_one(source_p, ":%s EOBACK", me.id);
}
act = 1;
SetEob(source_p);
eob_count++;
}
if(parc > 1 && *parv[1] != '\0')
{
copy = LOCAL_COPY(parv[1]);
for(id = rb_strtok_r(copy, ",", &state); id != NULL;
id = rb_strtok_r(NULL, ",", &state))
{
target_p = find_id(id);
if(target_p != NULL && IsServer(target_p) &&
target_p->from == client_p &&
!HasSentEob(target_p))
{
SetEob(target_p);
eob_count++;
act = 1;
}
}
}
if(!act)
return 0;
sendto_server(client_p, NULL, CAP_IRCNET, NOCAPS, ":%s EOB%s%s",
source_p->id,
parc > 1 ? " :" : "", parc > 1 ? parv[1] : "");
return 0;
}