本文整理汇总了C++中sendto_one_notice函数的典型用法代码示例。如果您正苦于以下问题:C++ sendto_one_notice函数的具体用法?C++ sendto_one_notice怎么用?C++ sendto_one_notice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendto_one_notice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: module_unload
/*! \brief UNLOAD subcommand handler
* Attempts to unload a module, throwing an error if
* the module could not be found
* \param source_p Pointer to client issuing the command
* \param arg Additional argument which might be needed by this handler
*/
static void
module_unload(struct Client *source_p, const char *arg)
{
const char *m_bn = NULL;
const struct module *modp = NULL;
if ((modp = findmodule_byname((m_bn = libio_basename(arg)))) == NULL)
{
sendto_one_notice(source_p, &me, ":Module %s is not loaded", m_bn);
return;
}
if (modp->flags & MODULE_FLAG_CORE)
{
sendto_one_notice(source_p, &me, ":Module %s is a core module and may not be unloaded",
m_bn);
return;
}
if (modp->flags & MODULE_FLAG_NOUNLOAD)
{
sendto_one_notice(source_p, &me, ":Module %s is a resident module and may not be unloaded",
m_bn);
return;
}
if (unload_one_module(m_bn, 1) == -1)
sendto_one_notice(source_p, &me, ":Module %s is not loaded", m_bn);
}
示例2: mo_mkpasswd
/* mo_mkpasswd - mkpasswd message handler
* parv[1] = password
* parv[2] = type
*/
static int
mo_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *salt;
const char *hashtype;
const char hashdefault[] = "SHA512";
if(EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
if(parc < 3)
hashtype = hashdefault;
else
hashtype = parv[2];
if(!irccmp(hashtype, "SHA256"))
salt = make_sha256_salt(16);
else if(!irccmp(hashtype, "SHA512"))
salt = make_sha512_salt(16);
else if(!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else {
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
}
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
return 0;
}
示例3: m_mkpasswd
/* m_mkpasswd - mkpasswd message handler
* parv[1] = password
* parv[2] = type
*/
static int
m_mkpasswd(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
char *salt;
const char *hashtype;
const char hashdefault[] = "SHA512";
if (EmptyString(parv[1])) {
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
}
if (parc < 3)
hashtype = hashdefault;
else
hashtype = parv[2];
if ((last_used + ConfigFileEntry.pace_wait) > rb_current_time()) {
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
return 0;
} else
last_used = rb_current_time();
if (!irccmp(hashtype, "SHA256"))
salt = make_sha256_salt(16);
else if (!irccmp(hashtype, "SHA512"))
salt = make_sha512_salt(16);
else if (!irccmp(hashtype, "MD5"))
salt = make_md5_salt(8);
else {
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
}
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], rb_crypt(parv[1], salt));
return 0;
}
示例4: list_quote_commands
/*
* list_quote_commands() sends the client all the available commands.
* Four to a line for now.
*/
static void
list_quote_commands(struct Client *source_p)
{
unsigned int j = 0;
const char *names[4] = { "", "", "", "" };
sendto_one_notice(source_p, &me, ":Available QUOTE SET commands:");
for (const struct SetStruct *tab = set_cmd_table; tab->handler; ++tab)
{
names[j++] = tab->name;
if (j > 3)
{
sendto_one_notice(source_p, &me, ":%s %s %s %s",
names[0], names[1],
names[2], names[3]);
j = 0;
names[0] = names[1] = names[2] = names[3] = "";
}
}
if (j)
sendto_one_notice(source_p, &me, ":%s %s %s %s",
names[0], names[1],
names[2], names[3]);
}
示例5: quote_max
/* SET MAX */
static void
quote_max(struct Client *source_p, const char *arg, int newval)
{
if (newval > 0)
{
if (newval > MAXCLIENTS_MAX)
{
sendto_one_notice(source_p, &me, ":You cannot set MAXCLIENTS to > %d, restoring to %d",
MAXCLIENTS_MAX, ConfigServerInfo.max_clients);
return;
}
if (newval < MAXCLIENTS_MIN)
{
sendto_one_notice(source_p, &me, ":You cannot set MAXCLIENTS to < %d, restoring to %d",
MAXCLIENTS_MIN, ConfigServerInfo.max_clients);
return;
}
ConfigServerInfo.max_clients = newval;
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s set new MAXCLIENTS to %d (%d current)",
get_oper_name(source_p), ConfigServerInfo.max_clients, Count.local);
}
else
sendto_one_notice(source_p, &me, ":Current MAXCLIENTS = %d (%d)",
ConfigServerInfo.max_clients, Count.local);
}
示例6: quote_autoconn
/* SET AUTOCONN */
static void
quote_autoconn(struct Client *source_p, const char *arg, int newval)
{
if (!EmptyString(arg))
{
struct MaskItem *conf = find_exact_name_conf(CONF_SERVER, NULL, arg, NULL, NULL);
if (conf)
{
if (newval)
SetConfAllowAutoConn(conf);
else
ClearConfAllowAutoConn(conf);
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
"%s has changed AUTOCONN for %s to %i",
get_oper_name(source_p), arg, newval);
sendto_one_notice(source_p, &me, ":AUTOCONN for %s is now set to %i",
arg, newval);
}
else
sendto_one_notice(source_p, &me, ":Cannot find %s", arg);
}
else
sendto_one_notice(source_p, &me, ":Please specify a server name!");
}
示例7: mo_restart
/*! \brief RESTART 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] = server name
*/
static int
mo_restart(struct Client *source_p, int parc, char *parv[])
{
char buf[IRCD_BUFSIZE] = "";
const char *const name = parv[1];
if (!HasOFlag(source_p, OPER_FLAG_RESTART))
{
sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "restart");
return 0;
}
if (EmptyString(name))
{
sendto_one_notice(source_p, &me, ":Need server name /restart %s", me.name);
return 0;
}
if (irccmp(name, me.name))
{
sendto_one_notice(source_p, &me, ":Mismatch on /restart %s", me.name);
return 0;
}
snprintf(buf, sizeof(buf), "received RESTART command from %s",
get_client_name(source_p, HIDE_IP));
server_die(buf, 1);
return 0;
}
示例8: 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);
}
示例9: do_modreload
static void
do_modreload(struct Client *source_p, const char *module)
{
int modindex;
int check_core;
char *m_bn = rb_basename(module);
if((modindex = findmodule_byname(m_bn)) == -1)
{
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
rb_free(m_bn);
return;
}
check_core = modlist[modindex]->core;
if(unload_one_module(m_bn, true) == false)
{
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
rb_free(m_bn);
return;
}
if((load_one_module(m_bn, modlist[modindex]->origin, check_core) == false) && check_core)
{
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
"Error reloading core module: %s: terminating ircd", m_bn);
ilog(L_MAIN, "Error loading core module %s: terminating ircd", m_bn);
exit(0);
}
rb_free(m_bn);
}
示例10: do_chghost
static int
do_chghost(struct Client *source_p, struct Client *target_p,
const char *newhost, int is_encap)
{
if (!clean_host(newhost))
{
sendto_realops_snomask(SNO_GENERAL, is_encap ? L_ALL : L_NETWIDE, "%s attempted to change hostname for %s to %s (invalid)",
IsServer(source_p) ? source_p->name : get_oper_name(source_p),
target_p->name, newhost);
/* sending this remotely may disclose important
* routing information -- jilles */
if (is_encap ? MyClient(target_p) : !ConfigServerHide.flatten_links)
sendto_one_notice(target_p, ":*** Notice -- %s attempted to change your hostname to %s (invalid)",
source_p->name, newhost);
return 0;
}
change_nick_user_host(target_p, target_p->name, target_p->username, newhost, 0, "Changing host");
if (irccmp(target_p->host, target_p->orighost))
{
SetDynSpoof(target_p);
if (MyClient(target_p))
sendto_one_numeric(target_p, RPL_HOSTHIDDEN, "%s :is now your hidden host (set by %s)", target_p->host, source_p->name);
}
else
{
ClearDynSpoof(target_p);
if (MyClient(target_p))
sendto_one_numeric(target_p, RPL_HOSTHIDDEN, "%s :hostname reset by %s", target_p->host, source_p->name);
}
if (MyClient(source_p))
sendto_one_notice(source_p, ":Changed hostname for %s to %s", target_p->name, target_p->host);
if (!IsServer(source_p) && !IsService(source_p))
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s changed hostname for %s to %s", get_oper_name(source_p), target_p->name, target_p->host);
return 1;
}
示例11: do_modunload
static void
do_modunload(struct Client *source_p, const char *module)
{
int modindex;
char *m_bn = rb_basename(module);
if((modindex = findmodule_byname(m_bn)) == -1)
{
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
rb_free(m_bn);
return;
}
if(modlist[modindex]->core)
{
sendto_one_notice(source_p, ":Module %s is a core module and may not be unloaded", m_bn);
rb_free(m_bn);
return;
}
if(unload_one_module(m_bn, true) == false)
sendto_one_notice(source_p, ":Module %s is not loaded", m_bn);
rb_free(m_bn);
}
示例12: mo_die
/*! \brief DIE 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] = server name
*/
static int
mo_die(struct Client *source_p, int parc, char *parv[])
{
char buf[IRCD_BUFSIZE] = "";
if (!HasOFlag(source_p, OPER_FLAG_DIE))
{
sendto_one_numeric(source_p, &me, ERR_NOPRIVS, "die");
return 0;
}
if (parc < 2 || EmptyString(parv[1]))
{
sendto_one_notice(source_p, &me, ":Need server name /die %s", me.name);
return 0;
}
if (irccmp(parv[1], me.name))
{
sendto_one_notice(source_p, &me, ":Mismatch on /die %s", me.name);
return 0;
}
snprintf(buf, sizeof(buf), "received DIE command from %s",
get_client_name(source_p, HIDE_IP));
server_die(buf, 0);
return 0;
}
示例13: list_quote_commands
/*
* list_quote_commands() sends the client all the available commands.
* Four to a line for now.
*/
static void
list_quote_commands(struct Client *source_p)
{
int i;
int j = 0;
const char *names[4];
sendto_one_notice(source_p, ":Available QUOTE SET commands:");
names[0] = names[1] = names[2] = names[3] = "";
for (i = 0; set_cmd_table[i].handler; i++)
{
names[j++] = set_cmd_table[i].name;
if(j > 3)
{
sendto_one_notice(source_p, ":%s %s %s %s",
names[0], names[1], names[2], names[3]);
j = 0;
names[0] = names[1] = names[2] = names[3] = "";
}
}
if(j)
sendto_one_notice(source_p, ":%s %s %s %s",
names[0], names[1], names[2], names[3]);
}
示例14: quote_max
/* SET MAX */
static void
quote_max(struct Client *source_p, const char *arg, int newval)
{
if(newval > 0) {
if(newval > maxconnections - MAX_BUFFER) {
sendto_one_notice(source_p,
":You cannot set MAXCLIENTS to > %d",
maxconnections - MAX_BUFFER);
return;
}
if(newval < 32) {
sendto_one_notice(source_p, ":You cannot set MAXCLIENTS to < 32 (%d:%d)",
GlobalSetOptions.maxclients, rb_getmaxconnect());
return;
}
GlobalSetOptions.maxclients = newval;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s!%[email protected]%s set new MAXCLIENTS to %d (%lu current)",
source_p->name, source_p->username, source_p->host,
GlobalSetOptions.maxclients,
rb_dlink_list_length(&lclient_list));
return;
} else {
sendto_one_notice(source_p, ":Current Maxclients = %d (%lu)",
GlobalSetOptions.maxclients, rb_dlink_list_length(&lclient_list));
}
}
示例15: m_ban
static int
m_ban(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_one_notice(source_p, ":The BAN command is not user-accessible.");
sendto_one_notice(source_p, ":To ban a user from a channel, see /QUOTE HELP CMODE");
if (IsOper(source_p))
sendto_one_notice(source_p, ":To ban a user from a server or from the network, see /QUOTE HELP KLINE");
return 0;
}