本文整理汇总了C++中sendto_one_numeric函数的典型用法代码示例。如果您正苦于以下问题:C++ sendto_one_numeric函数的具体用法?C++ sendto_one_numeric怎么用?C++ sendto_one_numeric使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendto_one_numeric函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mo_info
/*
** 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;
}
示例2: m_info
/*
** 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;
}
示例3: m_message
/*
* inputs - flag privmsg or notice
* - pointer to command "PRIVMSG" or "NOTICE"
* - pointer to source_p
* - pointer to channel
*/
static void
m_message(int p_or_n, const char *command, struct Client *source_p, int parc, char *parv[])
{
if (parc < 2 || EmptyString(parv[1]))
{
if (p_or_n != NOTICE)
sendto_one_numeric(source_p, &me, ERR_NORECIPIENT, command);
return;
}
if (parc < 3 || EmptyString(parv[2]))
{
if (p_or_n != NOTICE)
sendto_one_numeric(source_p, &me, ERR_NOTEXTTOSEND);
return;
}
/* Finish the flood grace period... */
if (MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
if (build_target_list(p_or_n, command, source_p, parv[1], parv[2]) < 0)
return;
for (unsigned int i = 0; i < ntargets; ++i)
{
switch (targets[i].type)
{
case ENTITY_CLIENT:
msg_client(p_or_n, command, source_p, targets[i].ptr, parv[2]);
break;
case ENTITY_CHANNEL:
msg_channel(p_or_n, command, source_p, targets[i].ptr,
targets[i].flags, parv[2]);
break;
}
}
}
示例4: ms_tmode
static int
ms_tmode(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr = NULL;
struct membership *msptr;
/* Now, try to find the channel in question */
if(!IsChanPrefix(parv[2][0]) || !check_channel_name(parv[2]))
{
sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), parv[2]);
return 0;
}
chptr = find_channel(parv[2]);
if(chptr == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[2]);
return 0;
}
/* TS is higher, drop it. */
if(atol(parv[1]) > chptr->channelts)
return 0;
if(IsServer(source_p))
{
set_channel_mode(client_p, source_p, chptr, NULL, parc - 3, parv + 3);
}
else
{
msptr = find_channel_membership(chptr, source_p);
set_channel_mode(client_p, source_p, chptr, msptr, parc - 3, parv + 3);
}
return 0;
}
示例5: m_version
/*! \brief VERSION 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
* - parv[1] = nickname/servername
*/
static int
m_version(struct Client *source_p, int parc, char *parv[])
{
static time_t last_used = 0;
if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
{
sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "VERSION");
return 0;
}
last_used = CurrentTime;
if (!ConfigServerHide.disable_remote_commands)
if (hunt_server(source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
return 0;
sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
me.name, serveropts);
isupport_show(source_p);
return 0;
}
示例6: mo_version
/*
* mo_version - VERSION command handler
* parv[1] = remote server
*/
static int
mo_version(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(hunt_server(client_p, source_p, ":%s VERSION :%s", 1, parc, parv) == HUNTED_ISME) {
sendto_one_numeric(source_p, RPL_VERSION, form_str(RPL_VERSION),
ircd_version, serno,
me.name, confopts(source_p), TS_CURRENT,
ServerInfo.sid);
show_isupport(source_p);
}
return 0;
}
示例7: mo_locops
/*! \brief LOCOPS 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
* - parv[1] = message text
*/
static int
mo_locops(struct Client *source_p, int parc, char *parv[])
{
const char *const message = parv[1];
if (!HasOFlag(source_p, OPER_FLAG_LOCOPS))
{
sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "locops");
return 0;
}
if (EmptyString(message))
{
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "LOCOPS");
return 0;
}
sendto_realops_flags(UMODE_LOCOPS, L_ALL, SEND_LOCOPS, "from %s: %s",
source_p->name, message);
cluster_distribute(source_p, "LOCOPS", 0, CLUSTER_LOCOPS, message);
return 0;
}
示例8: m_time
/*
* m_time
* parv[1] = servername
*/
static int
m_time(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
/* this is not rate limited, so end the grace period */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
if(hunt_server(client_p, source_p, ":%s TIME :%s", 1, parc, parv) == HUNTED_ISME)
sendto_one_numeric(source_p, RPL_TIME, form_str(RPL_TIME),
me.name, date());
return 0;
}
示例9: mo_wallops
/*! \brief WALLOPS 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
* - parv[1] = message text
*/
static int
mo_wallops(struct Client *source_p, int parc, char *parv[])
{
const char *message = parv[1];
if (!HasOFlag(source_p, OPER_FLAG_WALLOPS))
{
sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "wallops");
return 0;
}
if (EmptyString(message))
{
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "WALLOPS");
return 0;
}
sendto_wallops_flags(UMODE_WALLOP, source_p, "%s", message);
sendto_server(source_p, NOCAPS, NOCAPS, ":%s WALLOPS :%s",
source_p->id, message);
return 0;
}
示例10: forcepart_channels
static void
forcepart_channels(struct Client *client_p, struct Client *source_p, struct Client *target_p, const char *channels, const char *reason)
{
struct Channel *chptr = NULL;
struct membership *msptr = NULL;
char *name;
char *p = NULL;
char *chanlist;
chanlist = LOCAL_COPY(channels);
for(name = rb_strtok_r(chanlist, ",", &p); name; name = rb_strtok_r(NULL, ",", &p))
{
if((chptr = find_channel(name)) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), name);
continue;
}
if((msptr = find_channel_membership(chptr, target_p)) == NULL)
{
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL),
target_p->name, name);
continue;
}
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s PART %s :%s", use_id(target_p), chptr->chname, reason);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname, reason);
remove_user_from_channel(msptr);
}
return;
}
示例11: recurse_report_messages
static void
recurse_report_messages(struct Client *source_p, const struct MessageTree *mtree)
{
if (mtree->msg)
sendto_one_numeric(source_p, &me, RPL_STATSCOMMANDS,
mtree->msg->cmd,
mtree->msg->count, mtree->msg->bytes,
mtree->msg->rcount);
for (unsigned int i = 0; i < MAXPTRLEN; ++i)
if (mtree->pointers[i])
recurse_report_messages(source_p, mtree->pointers[i]);
}
示例12: mr_starttls
static int
mr_starttls(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
#ifdef HAVE_LIBCRYPTO
ssl_ctl_t *ctl;
rb_fde_t *F[2];
if (!MyConnect(client_p))
return 0;
if (rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &F[0], &F[1], "STARTTLS ssld session") == -1)
{
ilog_error("error creating SSL/TLS socketpair for ssld slave");
sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "Unable to create SSL/TLS socketpair for ssld offload slave");
return 1;
}
s_assert(client_p->localClient != NULL);
/* clear out any remaining plaintext lines */
rb_linebuf_donebuf(&client_p->localClient->buf_recvq);
sendto_one_numeric(client_p, RPL_STARTTLS, form_str(RPL_STARTTLS));
send_queued(client_p);
ctl = start_ssld_accept(client_p->localClient->F, F[1], rb_get_fd(F[0]));
if (ctl != NULL)
{
client_p->localClient->F = F[0];
client_p->localClient->ssl_ctl = ctl;
SetSSL(client_p);
}
else
return 1;
#endif
return 0;
}
示例13: me_dehelper
static int me_dehelper(struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
struct Client *target_p = find_person(parv[1]);
if(!target_p)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), me.name, parv[1]);
return 0;
}
if(!MyClient(target_p))
return 0;
do_dehelper(source_p, target_p);
return 0;
}
示例14: mo_globops
/*! \brief GLOBOPS 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
* - parv[1] = message text
*/
static int
mo_globops(struct Client *source_p, int parc, char *parv[])
{
const char *const message = parv[1];
if (!HasOFlag(source_p, OPER_FLAG_GLOBOPS))
{
sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "globops");
return 0;
}
if (EmptyString(message))
{
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "GLOBOPS");
return 0;
}
sendto_server(source_p, 0, 0, ":%s GLOBOPS :%s",
source_p->id, message);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_GLOBAL, "from %s: %s",
source_p->name, message);
return 0;
}
示例15: m_motd
/*
** m_motd
** parv[0] = sender prefix
** parv[1] = servername
*/
static int
m_motd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
/* safe enough to give this on a local connect only */
sendto_one_numeric(source_p, s_RPL(RPL_LOAD2HI), "MOTD");
sendto_one_numeric(source_p, s_RPL(RPL_ENDOFMOTD));
return 0;
}
else
last_used = rb_current_time();
if(hunt_server(client_p, source_p, ":%s MOTD :%s", 1, parc, parv) != HUNTED_ISME)
return 0;
motd_spy(source_p);
send_user_motd(source_p);
return 0;
}