本文整理汇总了C++中chanuser_find函数的典型用法代码示例。如果您正苦于以下问题:C++ chanuser_find函数的具体用法?C++ chanuser_find怎么用?C++ chanuser_find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chanuser_find函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cs_cmd_devoice
static void cs_cmd_devoice(sourceinfo_t *si, int parc, char *parv[])
{
char *chan = parv[0];
char *nick = parv[1];
mychan_t *mc;
user_t *tu;
chanuser_t *cu;
if (!chan)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "DEVOICE");
command_fail(si, fault_needmoreparams, _("Syntax: DEVOICE <#channel> [nickname]"));
return;
}
mc = mychan_find(chan);
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_VOICE))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
/* figure out who we're going to devoice */
if (!nick)
tu = si->su;
else
{
if (!(tu = user_find_named(nick)))
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not online."), nick);
return;
}
}
if (is_internal_client(tu))
return;
cu = chanuser_find(mc->chan, tu);
if (!cu)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not on \2%s\2."), tu->nick, mc->name);
return;
}
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_DEL, 'v', CLIENT_NAME(tu));
cu->modes &= ~CSTATUS_VOICE;
if (si->c == NULL && tu != si->su)
change_notify(chansvs.nick, tu, "You have been devoiced on %s by %s", mc->name, get_source_name(si));
logcommand(si, CMDLOG_DO, "DEVOICE: \2%s!%[email protected]%s\2 on \2%s\2", tu->nick, tu->user, tu->vhost, mc->name);
if (!chanuser_find(mc->chan, si->su))
command_success_nodata(si, _("\2%s\2 has been devoiced on \2%s\2."), tu->nick, mc->name);
}
开发者ID:Cloudxtreme,项目名称:atheme-6.0,代码行数:60,代码来源:voice.c
示例2: cs_cmd_invite
static void
cs_cmd_invite(struct sourceinfo *si, int parc, char *parv[])
{
char *chan = parv[0];
struct mychan *mc;
if (si->su == NULL)
{
command_fail(si, fault_noprivs, STR_IRC_COMMAND_ONLY, "INVITE");
return;
}
/* This command is not useful if the user is already in the channel,
* ignore it if it is a fantasy command so users can program bots to
* react on it without interference from ChanServ.
*/
if (si->c != NULL)
return;
if (!chan)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "INVITE");
command_fail(si, fault_needmoreparams, _("Syntax: INVITE <#channel>"));
return;
}
if (!(mc = mychan_find(chan)))
{
command_fail(si, fault_nosuch_target, STR_IS_NOT_REGISTERED, chan);
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, STR_CHANNEL_IS_CLOSED, chan);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_INVITE))
{
command_fail(si, fault_noprivs, STR_NOT_AUTHORIZED);
return;
}
if (!mc->chan)
{
command_fail(si, fault_nosuch_target, STR_CHANNEL_IS_EMPTY, mc->name);
return;
}
if (chanuser_find(mc->chan, si->su))
{
command_fail(si, fault_noprivs, _("You're already on \2%s\2."), mc->name);
return;
}
invite_sts(si->service->me, si->su, mc->chan);
logcommand(si, CMDLOG_DO, "INVITE: \2%s\2", mc->name);
command_success_nodata(si, _("You have been invited to \2%s\2."), mc->name);
}
开发者ID:atheme,项目名称:atheme,代码行数:60,代码来源:invite.c
示例3: asuka_notice_channel_sts
/* NOTICE wrapper */
static void asuka_notice_channel_sts(user_t *from, channel_t *target, const char *text)
{
if (from == NULL || chanuser_find(target, from))
sts("%s O %s :%s", from ? from->uid : me.numeric, target->name, text);
else
sts("%s O %s :[%s:%s] %s", me.numeric, target->name, from->nick, target->name, text);
}
开发者ID:danopia,项目名称:atheme,代码行数:8,代码来源:bircd.c
示例4: cs_cmd_invite
static void cs_cmd_invite(sourceinfo_t *si, int parc, char *parv[])
{
char *chan = parv[0];
mychan_t *mc;
if (si->su == NULL)
{
command_fail(si, fault_noprivs, _("\2%s\2 can only be executed via IRC."), "INVITE");
return;
}
/* This command is not useful if the user is already in the channel,
* ignore it if it is a fantasy command so users can program bots to
* react on it without interference from ChanServ.
*/
if (si->c != NULL)
return;
if (!chan)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "INVITE");
command_fail(si, fault_needmoreparams, _("Syntax: INVITE <#channel>"));
return;
}
mc = mychan_find(chan);
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan);
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, _("\2%s\2 is closed."), chan);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_INVITE))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
if (!mc->chan)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is currently empty."), mc->name);
return;
}
if (chanuser_find(mc->chan, si->su))
{
command_fail(si, fault_noprivs, _("You're already on \2%s\2."), mc->name);
return;
}
invite_sts(si->service->me, si->su, mc->chan);
logcommand(si, CMDLOG_DO, "INVITE: \2%s\2", mc->name);
command_success_nodata(si, _("You have been invited to \2%s\2."), mc->name);
}
开发者ID:Gryllida,项目名称:atheme,代码行数:60,代码来源:invite.c
示例5: check_forward
/* ircd allows forwards to existing channels; the target channel must be
* +F or the setter must have ops in it */
static bool check_forward(const char *value, channel_t *c, mychan_t *mc, user_t *u, myuser_t *mu)
{
channel_t *target_c;
mychan_t *target_mc;
chanuser_t *target_cu;
if (!VALID_GLOBAL_CHANNEL_PFX(value) || strlen(value) > 50)
return false;
if (u == NULL && mu == NULL)
return true;
target_c = channel_find(value);
target_mc = mychan_from(target_c);
if (target_c == NULL && target_mc == NULL)
return false;
if (target_c != NULL && target_c->modes & CMODE_FTARGET)
return true;
if (target_mc != NULL && target_mc->mlock_on & CMODE_FTARGET)
return true;
if (u != NULL)
{
target_cu = chanuser_find(target_c, u);
if (target_cu != NULL && target_cu->modes & CSTATUS_OP)
return true;
if (chanacs_user_flags(target_mc, u) & CA_SET)
return true;
}
else if (mu != NULL)
if (chanacs_entity_has_flag(target_mc, entity(mu), CA_SET))
return true;
return false;
}
开发者ID:hce,项目名称:zohlai,代码行数:33,代码来源:charybdis.c
示例6: cm_noext_hook
/* -------------------------------------------------------------------------- *
* -------------------------------------------------------------------------- */
static int cm_noext_hook(struct client *cptr, struct channel *chptr,
intptr_t type, const char *text)
{
struct chanuser *cuptr = chanuser_find(chptr, cptr);
if(cuptr == NULL && (chptr->modes & CHFLG(n)))
{
numeric_send(cptr, ERR_CANNOTSENDTOCHAN, chptr->name);
return 1;
}
return 0;
}
开发者ID:darcyg,项目名称:chaosircd,代码行数:15,代码来源:cm_noext.c
示例7: cs_cmd_topic
static void cs_cmd_topic(char *origin)
{
char *chan = strtok(NULL, " ");
char *topic = strtok(NULL, "");
mychan_t *mc;
channel_t *c;
user_t *u;
if (!chan || !topic)
{
notice(chansvs.nick, origin, STR_INSUFFICIENT_PARAMS, "TOPIC");
notice(chansvs.nick, origin, "Syntax: TOPIC <#channel> <topic>");
return;
}
c = channel_find(chan);
if (!c)
{
notice(chansvs.nick, origin, "\2%s\2 is not registered.", chan);
return;
}
mc = mychan_find(chan);
if (!mc)
{
notice(chansvs.nick, origin, "Channel \2%s\2 is not registered.", chan);
return;
}
if (metadata_find(mc, METADATA_CHANNEL, "private:close:closer"))
{
notice(chansvs.nick, origin, "\2%s\2 is closed.", chan);
return;
}
u = user_find_named(origin);
if (!chanacs_user_has_flag(mc, u, CA_TOPIC))
{
notice(chansvs.nick, origin, "You are not authorized to perform this operation.");
return;
}
handle_topic(c, origin, CURRTIME, topic);
topic_sts(chan, origin, CURRTIME, topic);
logcommand(chansvs.me, u, CMDLOG_SET, "%s TOPIC", mc->name);
if (!chanuser_find(c, u))
notice(chansvs.nick, origin, "Topic set to \2%s\2 on \2%s\2.", topic, chan);
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:50,代码来源:topic.c
示例8: asuka_notice_channel_sts
/* NOTICE wrapper */
static void asuka_notice_channel_sts(user_t *from, channel_t *target, const char *text)
{
if (target->modes & CMODE_NONOTICE)
{
/* asuka sucks */
/* remove that stupid +N mode before it blocks our notice
* -- jilles */
sts("%s M %s -N", from ? from->uid : me.numeric, target->name);
target->modes &= ~CMODE_NONOTICE;
}
if (from == NULL || chanuser_find(target, from))
sts("%s O %s :%s", from ? from->uid : me.numeric, target->name, text);
else
sts("%s O %s :[%s:%s] %s", me.numeric, target->name, from->nick, target->name, text);
}
开发者ID:atheme,项目名称:atheme,代码行数:16,代码来源:asuka.c
示例9: cs_cmd_topicswap
//.........这里部分代码省略.........
time_t prevtopicts;
char topicbuf[BUFSIZE];
char commbuf[BUFSIZE];
char *pos = NULL;
char *search = NULL;
char *replace = NULL;
size_t search_size = 0;
size_t replace_size = 0;
size_t copylen = 0;
if (parc < 2)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "TOPICSWAP");
command_fail(si, fault_needmoreparams, _("Syntax: TOPICSWAP <#channel> <search>:[<replace>]"));
return;
}
mowgli_strlcpy(commbuf, parv[1], BUFSIZE);
search = commbuf;
pos = strrchr(commbuf, ':');
if (!pos || pos == commbuf)
{
command_fail(si, fault_badparams, STR_INSUFFICIENT_PARAMS, "TOPICSWAP");
command_fail(si, fault_badparams, _("Syntax: TOPICSWAP <#channel> <search>:[<replace>]"));
return;
}
mc = mychan_find(chan);
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan);
return;
}
c = channel_find(chan);
if (!c)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is currently empty."), chan);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_TOPIC))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, _("\2%s\2 is closed."), chan);
return;
}
if (!c->topic)
topicbuf[0] = '\0';
else
mowgli_strlcpy(topicbuf, c->topic, BUFSIZE);
*pos = '\0';
replace = pos + 1;
search_size = strlen(search);
replace_size = strlen(replace);
pos = strstr(topicbuf, search);
if (!pos)
{
command_fail(si, fault_badparams, _("Channel \2%s\2 does not have \2%s\2 in its topic."), chan, search);
return;
}
copylen = strlen(pos + search_size) + 1;
if (pos - topicbuf + replace_size + copylen > BUFSIZE)
goto invalid_error;
memmove(pos + search_size + (replace_size - search_size), pos + search_size, copylen);
memcpy(pos, replace, replace_size);
if (!validtopic(topicbuf))
{
invalid_error:
command_fail(si, fault_badparams, _("The new topic is invalid or too long."));
return;
}
if (si->su != NULL)
topicsetter = si->su->nick;
else if (si->smu != NULL)
topicsetter = entity(si->smu)->name;
else
topicsetter = "unknown";
prevtopicts = c->topicts;
handle_topic(c, topicsetter, CURRTIME, topicbuf);
topic_sts(c, si->service->me, topicsetter, CURRTIME, prevtopicts, topicbuf);
logcommand(si, CMDLOG_DO, "TOPICSWAP: \2%s\2", mc->name);
if (si->su == NULL || !chanuser_find(c, si->su))
command_success_nodata(si, _("Topic set to \2%s\2 on \2%s\2."), c->topic, chan);
}
开发者ID:ChatLounge,项目名称:ChatServices,代码行数:101,代码来源:topic.c
示例10: cs_cmd_register
static void
cs_cmd_register(struct sourceinfo *si, int parc, char *parv[])
{
struct channel *c;
struct chanuser *cu;
struct mychan *mc;
char *name = parv[0];
char str[21];
hook_channel_register_check_t hdatac;
hook_channel_req_t hdata;
unsigned int fl;
/* This command is not useful on registered channels, ignore it if
* it is a fantasy command so users can program bots to react on
* it without interference from ChanServ.
*/
if (si->c != NULL)
return;
if (!name)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "REGISTER");
command_fail(si, fault_needmoreparams, _("To register a channel: REGISTER <#channel>"));
return;
}
if (*name != '#')
{
command_fail(si, fault_badparams, STR_INVALID_PARAMS, "REGISTER");
command_fail(si, fault_badparams, _("Syntax: REGISTER <#channel>"));
return;
}
if (si->smu->flags & MU_WAITAUTH)
{
command_fail(si, fault_notverified, _("You need to verify your email address before you may register channels."));
return;
}
// make sure it isn't already registered
if ((mc = mychan_find(name)))
{
if (! (mc->flags & MC_PRIVATE))
command_fail(si, fault_alreadyexists, _("\2%s\2 is already registered to \2%s\2."), mc->name, mychan_founder_names(mc));
else
command_fail(si, fault_alreadyexists, _("\2%s\2 is already registered."), mc->name);
return;
}
// make sure the channel exists
if (!(c = channel_find(name)))
{
command_fail(si, fault_nosuch_target, _("The channel \2%s\2 must exist in order to register it."), name);
return;
}
// make sure they're in it
if (!(cu = chanuser_find(c, si->su)))
{
command_fail(si, fault_noprivs, _("You must be in \2%s\2 in order to register it."), name);
return;
}
// make sure they're opped (or protected/owner on unreal/inspircd)
if (!((CSTATUS_OP | CSTATUS_PROTECT | CSTATUS_OWNER) & cu->modes))
{
command_fail(si, fault_noprivs, _("You must be a channel operator in \2%s\2 in order to register it."), name);
return;
}
if (metadata_find(si->smu, "private:restrict:setter"))
{
command_fail(si, fault_noprivs, _("You have been restricted from registering channels by network staff."));
return;
}
if ((unsigned int)(CURRTIME - ratelimit_firsttime) > config_options.ratelimit_period)
{
ratelimit_count = 0;
ratelimit_firsttime = CURRTIME;
}
if (ratelimit_count > config_options.ratelimit_uses && !has_priv(si, PRIV_FLOOD))
{
command_fail(si, fault_toomany, _("The system is currently too busy to process your registration, please try again later."));
slog(LG_INFO, "CHANSERV:REGISTER:THROTTLED: \2%s\2 by \2%s\2", name, entity(si->smu)->name);
return;
}
hdatac.si = si;
hdatac.name = name;
hdatac.chan = c;
hdatac.approved = 0;
hook_call_channel_can_register(&hdatac);
if (hdatac.approved != 0)
return;
if (!myentity_can_register_channel(entity(si->smu)))
{
command_fail(si, fault_toomany, _("You have too many channels registered."));
//.........这里部分代码省略.........
开发者ID:lstarnes1024,项目名称:atheme,代码行数:101,代码来源:register.c
示例11: cs_cmd_kick
static void cs_cmd_kick(sourceinfo_t *si, int parc, char *parv[])
{
char *chan = parv[0];
char *nick = parv[1];
char *reason = parv[2];
mychan_t *mc;
user_t *tu;
chanuser_t *cu;
char reasonbuf[BUFSIZE];
if (!chan || !nick)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "KICK");
command_fail(si, fault_needmoreparams, _("Syntax: KICK <#channel> <nickname> [reason]"));
return;
}
mc = mychan_find(chan);
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_REMOVE))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, _("\2%s\2 is closed."), chan);
return;
}
/* figure out who we're going to kick */
if (!(tu = user_find_named(nick)))
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not online."), nick);
return;
}
/* if target is a service, bail. --nenolod */
if (is_internal_client(tu))
return;
cu = chanuser_find(mc->chan, tu);
if (!cu)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not on \2%s\2."), tu->nick, mc->name);
return;
}
if (cu->modes & CSTATUS_OWNER || cu->modes & CSTATUS_PROTECT)
{
command_fail(si, fault_noprivs, _("\2%s\2 is protected from kicks; you cannot kick them."), tu->nick);
return;
}
snprintf(reasonbuf, BUFSIZE, "(%s) %s", get_source_name(si), reason ? reason : "No reason given");
try_kick(chansvs.me->me, mc->chan, tu, reasonbuf);
logcommand(si, CMDLOG_DO, "KICK: \2%s!%[email protected]%s\2 from \2%s\2", tu->nick, tu->user, tu->vhost, mc->name);
if (si->su != tu && !chanuser_find(mc->chan, si->su))
command_success_nodata(si, _("\2%s\2 has been kicked from \2%s\2."), tu->nick, mc->name);
}
开发者ID:Cloudxtreme,项目名称:atheme-6.0,代码行数:66,代码来源:kick.c
示例12: cs_cmd_owner
static void cs_cmd_owner(sourceinfo_t *si, int parc, char *parv[])
{
char *chan = parv[0];
char *nick = parv[1];
mychan_t *mc;
user_t *tu;
chanuser_t *cu;
char *nicklist;
char *strtokctx;
if (ircd->uses_owner == false)
{
command_fail(si, fault_noprivs, _("The IRCd software you are running does not support this feature."));
return;
}
if (!chan)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "OWNER");
command_fail(si, fault_needmoreparams, _("Syntax: OWNER <#channel> [nickname] [...]"));
return;
}
mc = mychan_find(chan);
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_USEOWNER))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, _("\2%s\2 is closed."), chan);
return;
}
nicklist = (!nick ? strdup(si->su->nick) : strdup(nick));
nick = strtok_r(nicklist, " ", &strtokctx);
do
{
if (invert_purpose(si, parc, chan, &nick, '-', &cs_cmd_deowner))
continue;
/* figure out who we're going to op */
if (!(tu = user_find_named(nick)))
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not online."), nick);
continue;
}
if (is_internal_client(tu))
continue;
/* SECURE check; we can skip this if sender == target, because we already verified */
if ((si->su != tu) && (mc->flags & MC_SECURE) && !chanacs_user_has_flag(mc, tu, CA_OP) && !chanacs_user_has_flag(mc, tu, CA_AUTOOP))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
command_fail(si, fault_noprivs, _("\2%s\2 has the SECURE option enabled, and \2%s\2 does not have appropriate access."), mc->name, tu->nick);
continue;
}
cu = chanuser_find(mc->chan, tu);
if (!cu)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not on \2%s\2."), tu->nick, mc->name);
continue;
}
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_ADD, ircd->owner_mchar[1], CLIENT_NAME(tu));
cu->modes |= CSTATUS_OWNER;
if (si->c == NULL && tu != si->su)
change_notify(chansvs.nick, tu, "You have been set as owner on %s by %s", mc->name, get_source_name(si));
logcommand(si, CMDLOG_DO, "OWNER: \2%s!%[email protected]%s\2 on \2%s\2", tu->nick, tu->user, tu->vhost, mc->name);
if (si->su == NULL || !chanuser_find(mc->chan, si->su))
command_success_nodata(si, _("\2%s\2 has been set as owner on \2%s\2."), tu->nick, mc->name);
} while ((nick = strtok_r(NULL, " ", &strtokctx)) != NULL);
free(nicklist);
}
开发者ID:Desuneko,项目名称:atheme,代码行数:85,代码来源:owner.c
示例13: snprintf
static mowgli_node_t *inspircd_next_matching_ban(channel_t *c, user_t *u, int type, mowgli_node_t *first)
{
chanban_t *cb;
mowgli_node_t *n;
char hostbuf[NICKLEN+USERLEN+HOSTLEN];
char realbuf[NICKLEN+USERLEN+HOSTLEN];
char ipbuf[NICKLEN+USERLEN+HOSTLEN];
char *p;
snprintf(hostbuf, sizeof hostbuf, "%s!%[email protected]%s", u->nick, u->user, u->vhost);
snprintf(realbuf, sizeof realbuf, "%s!%[email protected]%s", u->nick, u->user, u->host);
/* will be [email protected] if ip unknown, doesn't matter */
snprintf(ipbuf, sizeof ipbuf, "%s!%[email protected]%s", u->nick, u->user, u->ip);
MOWGLI_ITER_FOREACH(n, first)
{
channel_t *target_c;
cb = n->data;
if (cb->type != type)
continue;
if ((!match(cb->mask, hostbuf) || !match(cb->mask, realbuf) || !match(cb->mask, ipbuf)) || !match_cidr(cb->mask, ipbuf))
return n;
if (cb->mask[1] == ':' && strchr("MRUjrm", cb->mask[0]))
{
bool matched = false;
p = cb->mask + 2;
if (*(p - 1) != ':')
p = NULL;
switch (cb->mask[0])
{
case 'M':
case 'R':
matched = u->myuser != NULL && !(u->myuser->flags & MU_WAITAUTH) && (p == NULL || !match(p, entity(u->myuser)->name));
break;
case 'U':
matched = u->myuser == NULL;
break;
case 'j':
if (p == NULL)
continue;
target_c = channel_find(p);
if (target_c == NULL || (target_c->modes & (CMODE_PRIV | CMODE_SEC)))
continue;
matched = chanuser_find(target_c, u) != NULL;
break;
case 'r':
if (p == NULL)
continue;
matched = !match(p, u->gecos);
break;
case 'm':
matched = (!match(p, hostbuf) || !match(p, realbuf) || !match(p, ipbuf)) || !match_cidr(p, ipbuf);
break;
default:
continue;
}
if (matched)
return n;
}
}
开发者ID:XthemeOrg,项目名称:Xtheme,代码行数:67,代码来源:inspircd.c
示例14: cs_cmd_halfop
static void cs_cmd_halfop(sourceinfo_t *si, int parc, char *parv[])
{
char *chan = parv[0];
char *nick = parv[1];
mychan_t *mc;
user_t *tu;
chanuser_t *cu;
if (!ircd->uses_halfops)
{
command_fail(si, fault_noprivs, _("Your IRC server does not support halfops."));
return;
}
if (!chan)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "HALFOP");
command_fail(si, fault_needmoreparams, _("Syntax: HALFOP <#channel> [nickname]"));
return;
}
mc = mychan_find(chan);
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_HALFOP))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, _("\2%s\2 is closed."), chan);
return;
}
/* figure out who we're going to halfop */
if (!nick)
tu = si->su;
else
{
if (!(tu = user_find_named(nick)))
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not online."), nick);
return;
}
}
if (is_internal_client(tu))
return;
/* SECURE check; we can skip this if sender == target, because we already verified */
if ((si->su != tu) && (mc->flags & MC_SECURE) && !chanacs_user_has_flag(mc, tu, CA_HALFOP) && !chanacs_user_has_flag(mc, tu, CA_AUTOHALFOP))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
command_fail(si, fault_noprivs, _("\2%s\2 has the SECURE option enabled, and \2%s\2 does not have appropriate access."), mc->name, tu->nick);
return;
}
cu = chanuser_find(mc->chan, tu);
if (!cu)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is not on \2%s\2."), tu->nick, mc->name);
return;
}
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_ADD, 'h', CLIENT_NAME(tu));
cu->modes |= ircd->halfops_mode;
if (si->c == NULL && tu != si->su)
change_notify(chansvs.nick, tu, "You have been halfopped on %s by %s", mc->name, get_source_name(si));
logcommand(si, CMDLOG_DO, "HALFOP: \2%s!%[email protected]%s\2 on \2%s\2", tu->nick, tu->user, tu->vhost, mc->name);
if (!chanuser_find(mc->chan, si->su))
command_success_nodata(si, _("\2%s\2 has been halfopped on \2%s\2."), tu->nick, mc->name);
}
开发者ID:carriercomm,项目名称:blitzed-atheme,代码行数:80,代码来源:halfop.c
示例15: cs_cmd_down
static void cs_cmd_down(sourceinfo_t *si, int parc, char *parv[])
{
chanuser_t *cu;
mychan_t *mc;
char *name = parv[0];
if (!name)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "DOWN");
command_fail(si, fault_needmoreparams, "Syntax: DOWN <#channel>");
return;
}
if (!(mc = mychan_find(name)))
{
command_fail(si, fault_nosuch_target, "\2%s\2 is not registered.", name);
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, "\2%s\2 is closed.", name);
return;
}
if (!mc->chan)
{
command_fail(si, fault_nosuch_target, "\2%s\2 does not exist.", name);
return;
}
if (!si->su)
return; // needs to be done over IRC
cu = chanuser_find(mc->chan, si->su);
if (!cu)
{
command_fail(si, fault_nosuch_target, "You are not on \2%s\2.", mc->name);
return;
}
chanacs_user_flags(mc, cu->user);
// Don't check NOOP, because they are explicitly requesting status
if (ircd->uses_owner)
{
if (ircd->owner_mode & cu->modes)
{
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_DEL, ircd->owner_mchar[1], CLIENT_NAME(cu->user));
cu->modes &= ~ircd->owner_mode;
}
}
if (ircd->uses_protect)
{
if (ircd->protect_mode & cu->modes)
{
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_DEL, ircd->protect_mchar[1], CLIENT_NAME(cu->user));
cu->modes &= ~ircd->protect_mode;
}
}
if ((CSTATUS_OP & cu->modes))
{
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_DEL, 'o', CLIENT_NAME(cu->user));
cu->modes &= ~CSTATUS_OP;
}
if (ircd->uses_halfops)
{
if (ircd->halfops_mode & cu->modes)
{
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_DEL, ircd->halfops_mchar[1], CLIENT_NAME(cu->user));
cu->modes &= ~ircd->halfops_mode;
}
}
if ((CSTATUS_VOICE & cu->modes))
{
modestack_mode_param(chansvs.nick, mc->chan, MTYPE_DEL, 'v', CLIENT_NAME(cu->user));
cu->modes &= ~CSTATUS_VOICE;
}
command_success_nodata(si, "Downed successfully on \2%s\2.", mc->name);
}
开发者ID:Canternet,项目名称:atheme-contrib-modules,代码行数:86,代码来源:cs_updown.c
示例16: cs_cmd_topic
static void cs_cmd_topic(sourceinfo_t *si, int parc, char *parv[])
{
char *chan = parv[0];
char *topic = parv[1];
mychan_t *mc;
channel_t *c;
const char *topicsetter;
time_t prevtopicts;
if (!chan || !topic)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "TOPIC");
command_fail(si, fault_needmoreparams, _("Syntax: TOPIC <#channel> <topic>"));
return;
}
mc = mychan_find(chan);
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), chan);
return;
}
c = channel_find(chan);
if (!c)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is currently empty."), chan);
return;
}
if (metadata_find(mc, "private:close:closer"))
{
command_fail(si, fault_noprivs, _("\2%s\2 is closed."), chan);
return;
}
if (!(chanacs_source_has_flag(mc, si, CA_TOPIC) || chanacs_source_has_flag(mc, si, CA_FOUNDER)))
{
command_fail(si, fault_noprivs, _("You are not authorized to perform this operation."));
return;
}
if (!validtopic(topic))
{
command_fail(si, fault_badparams, _("The new topic is invalid or too long."));
return;
}
if (si->su != NULL)
topicsetter = si->su->nick;
else if (si->smu != NULL)
topicsetter = entity(si->smu)->name;
else
topicsetter = "unknown";
prevtopicts = c->topicts;
handle_topic(c, topicsetter, CURRTIME, topic);
topic_sts(c, si->service->me, topicsetter, CURRTIME, prevtopicts, topic);
logcommand(si, CMDLOG_DO, "TOPIC: \2%s\2", mc->name);
if (si->su == NULL || !chanuser_find(c, si->su))
command_success_nodata(si, _("Topic set to \2%s\2 on \2%s\2."), topic, chan);
}
开发者ID:ChatLounge,项目名称:ChatServices,代码行数:62,代码来源:topic.c
示例17: cs_cmd_unban
static void cs_cmd_unban(sourceinfo_t *si, int parc, char *parv[])
{
const char *channel = parv[0];
const char *target = parv[1];
channel_t *c = channel_find(channel);
mychan_t *mc = mychan_find(channel);
user_t *tu;
chanban_t *cb;
if (!channel)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "UNBAN");
command_fail(si, fault_needmoreparams, _("Syntax: UNBAN <#channel> <nickname|hostmask>"));
return;
}
if (!target)
{
if (si->su == NULL)
{
command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "UNBAN");
command_fail(si, fault_needmoreparams, _("Syntax: UNBAN <#channel> <nickname|hostmask>"));
return;
}
target = si->su->nick;
}
if (!mc)
{
command_fail(si, fault_nosuch_target, _("Channel \2%s\2 is not registered."), channel);
return;
}
if (!c)
{
command_fail(si, fault_nosuch_target, _("\2%s\2 is currently empty."), channel);
return;
}
if (!chanacs_source_has_flag(mc, si, CA_REMOVE) &&
(si->su == NULL ||
!chanacs_source_has_flag(mc, si, CA_EXEMPT) ||
irccasecmp(target, si->su->nick)))
{
command_fail(si, fault_noprivs, STR_NOT_AUTHORIZED);
return;
}
if ((tu = user_find_named(target)))
{
mowgli_node_t *n, *tn;
char hostbuf2[BUFSIZE];
int count = 0;
snprintf(hostbuf2, BUFSIZE, "%s!%[email protected]%s", tu->nick, tu->user, tu->vhost);
for (n = next_matching_ban(c, tu, 'b', c->bans.head); n != NULL; n = next_matching_ban(c, tu, 'b', tn))
{
tn = n->next;
cb = n->data;
logcommand(si, CMDLOG_DO, "UNBAN: \2%s\2 on \2%s\2 (for user \2%s\2)", cb->mask, mc->name, hostbuf2);
modestack_mode_param(chansvs.nick, c, MTYPE_DEL, cb->type, cb->mask);
chanban_delete(cb);
count++;
}
if (count > 0)
command_success_nodata(si, _("Unbanned \2%s\2 on \2%s\2 (%d ban%s removed)."),
target, channel, count, (count != 1 ? "s" : ""));
else
command_success_nodata(si, _("No bans found matching \2%s\2 on \2%s\2."), target, channel);
return;
}
else if ((cb = chanban_find(c, target, 'b')) != NULL || validhostmask(target))
{
if (cb)
{
modestack_mode_param(chansvs.nick, c, MTYPE_DEL, 'b', target);
chanban_delete(cb);
logcommand(si, CMDLOG_DO, "UNBAN: \2%s\2 on \2%s\2", target, mc->name);
if (si->su == NULL || !chanuser_find(mc->chan, si->su))
command_success_nodata(si, _("Unbanned \2%s\2 on \2%s\2."), target, channel);
}
else
command_fail(si, fault_nosuch_key, _("No such ban \2%s\2 on \2%s\2."), target, channel);
return;
}
else
{
command_fail(si, fault_badparams, _("Invalid nickname/hostmask provided: \2%s\2"), target);
command_fail(si, fault_badparams, _("Syntax: UNBAN <#channel> [nickname|hostmask]"));
return;
}
}
开发者ID:Cloudxtreme,项目名称:shalture,代码行数:94,代码来源:ban.c
示例18: channel_mode
//.........这里部分代码省略.........
}
else
{
chan->modes &= ~CMODE_LIMIT;
chan->limit = 0;
}
continue;
}
if (*pos == 'k')
{
if (whatt == MTYPE_ADD)
{
chan->modes |= CMODE_KEY;
chan->key = sstrdup(parv[++parpos]);
}
else
{
chan->modes &= ~CMODE_KEY;
free(chan->key);
chan->key = NULL;
/* ratbox typically sends either the key or a `*' on -k, so you
* should eat a parameter
*/
parpos++;
}
continue;
}
for (i = 0; status_mode_list[i].mode != '\0'; i++)
{
if (*pos == status_mode_list[i].mode)
{
cu = chanuser_find(chan, user_find(parv[++parpos]));
if (cu == NULL)
{
slog(LG_ERROR, "channel_mode(): MODE %s %c%c %s", chan->name,
(whatt == MTYPE_ADD) ? '+' : '-', status_mode_list[i].value,
parv[parpos]);
matched = TRUE;
}
if (matched == TRUE)
break;
matched = TRUE;
if (whatt == MTYPE_ADD)
{
cu->modes |= status_mode_list[i].value;
/* see if they did something we have to undo */
if ((mc = mychan_find(cu->chan->name)))
{
myuser_t *mu = cu->user->myuser;
if ((MC_SECURE & mc->flags) && (status_mode_list[i].mode == 'o'))
{
char hostbuf[BUFSIZE];
snprintf(hostbuf, BUFSIZE, "%s!%[email protected]%s",
cu->user->nick, cu->user->user, cu->user->host);
if ((!is_founder(mc, mu)) && (cu->user != svs.svs) &&
开发者ID:andrew12,项目名称:shrike,代码行数:67,代码来源:cmode.c
示例19: cs_cmd_halfop
static void cs_cmd_halfop(char *origin)
{
char *chan = strtok(NULL, " ");
char *nick = strtok(NULL, " ");
mychan_t *mc;
user_t *u, *tu;
chanuser_t *cu;
if (!ircd->uses_halfops)
{
notice(chansvs.nick, origin, "Your IRC server does not support halfops.");
return;
}
if (!chan)
{
notice(chansvs.nick, origin, STR_INSUFFICIENT_PARAMS, "HALFOP");
notice(chansvs.nick, origin, "Syntax: HALFOP <#channel> [nickname]");
return;
}
mc = mychan_find(chan);
if (!mc)
{
notice(chansvs.nick, origin, "\2%s\2 is not registered.", chan);
return;
}
u = user_find_named(origin);
if (!chanacs_user_has_flag(mc, u, CA_HALFOP))
{
notice(chansvs.nick, origin, "You are not authorized to perform this operation.");
return;
}
if (metadata_find(mc, METADATA_CHANNEL, "private:close:closer"))
{
notice(chansvs.nick, origin, "\2%s\2 is closed.", chan);
return;
}
/* figure out who we're going to halfop */
if (!nick)
tu = u;
else
{
if (!(tu = user_find_named(nick)))
{
notice(chansvs.nick, origin, "\2%s\2 is not online.", nick);
return;
}
}
if (is_internal_client(tu))
return;
/* SECURE check; we can skip this if sender == target, because we already verified */
if ((u != tu) && (mc->flags & MC_SECURE) && !chanacs_user_has_flag(mc, tu, CA_HALFOP) && !chanacs_user_has_flag(mc, tu, CA_AUTOHALFOP))
{
notice(chansvs.nick, origin, "You are not authorized to perform this operation.", mc->name);
notice(chansvs.nick, origin, "\2%s\2 has the SECURE option enabled, and \2%s\2 does not have appropriate access.", mc->name, tu->nick);
return;
}
cu = chanuser_find(mc->chan, tu);
if (!cu)
{
notice(chansvs.nick, origin, "\2%s\2 is not on \2%s\2.", tu->nick, mc->name);
return;
}
modestack_mode_param(chansvs.nick, chan, MTYPE_ADD, 'h', CLIENT_NAME(tu));
cu->modes |= ircd->halfops_mode;
/* TODO: Add which username had access to perform the command */
if (tu != u)
notice(chansvs.nick, tu->nick, "You have been halfopped on %s by %s", mc->name, origin);
logcommand(chansvs.me, u, CMDLOG_SET, "%s HALFOP %s!%[email protected]%s", mc->name, tu->nick, tu->user, tu->vhost);
if (!chanuser_find(mc->chan, u))
notice(chansvs.nick, origin, "\2%s\2 has been halfopped on \2%s\2.", tu->nick, mc->name);
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:82,代码来源:halfop.c
示例20: cs_fcmd_dehalfop
static void cs_fcmd_dehalfop(char *origin, char *chan)
{
char *nick;
mychan_t *mc;
user_t *u, *tu;
chanuser_t *cu;
if (!ircd->uses_halfops)
{
notice(chansvs.nick, origin, "Your IRC server does not support halfops.");
return;
}
mc = mychan_find(chan);
if (!mc)
{
notice(chansvs.nick, origin, "\2%s\2 is not registered.", chan);
return;
}
u = user_find_named(origin);
if (!chanacs_user_has_flag(mc, u, CA_HALFOP))
{
notice(chansvs.nick, origin, "You are not authorized to perform this operation.");
return;
}
if (metadata_find(mc, METADATA_CHANNEL, "private:close:closer"))
{
notice(chansvs.nick, origin, "\2%s\2 is closed.", chan);
return;
}
/* figure out who we're going to dehalfop */
nick = strtok(NULL, " ");
do
{
if (!nick)
tu = u;
else
{
i
|
请发表评论