本文整理汇总了C++中sendto_channel_local函数的典型用法代码示例。如果您正苦于以下问题:C++ sendto_channel_local函数的具体用法?C++ sendto_channel_local怎么用?C++ sendto_channel_local使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendto_channel_local函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: part_one_client
/* part_one_client()
*
* inputs - pointer to server
* - pointer to source client to remove
* - char pointer of name of channel to remove from
* output - none
* side effects - remove ONE client given the channel name
*/
static void
part_one_client(struct Client *client_p, struct Client *source_p,
const char *name, char *reason)
{
struct Channel *chptr = NULL;
struct Membership *ms = NULL;
if ((chptr = hash_find_channel(name)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
me.name, source_p->name, name);
return;
}
if ((ms = find_channel_link(source_p, chptr)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOTONCHANNEL),
me.name, source_p->name, name);
return;
}
if (MyConnect(source_p) && !IsOper(source_p))
check_spambot_warning(source_p, NULL);
/*
* Remove user from the old channel (if any)
* only allow /part reasons in -m chans
*/
if(msg_has_colors(reason) && (chptr->mode.mode & MODE_NOCOLOR))
reason = strip_color(reason);
if (reason[0] && (!MyConnect(source_p) ||
((can_send(chptr, source_p, ms) &&
(source_p->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
< CurrentTime))))
{
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :%s", ID(source_p), chptr->chname,
reason);
sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
":%s PART %s :%s", source_p->name, chptr->chname,
reason);
sendto_channel_local(ALL_MEMBERS, NO, chptr, ":%s!%[email protected]%s PART %s :%s",
source_p->name, source_p->username,
source_p->host, chptr->chname, reason);
}
else
{
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s", ID(source_p), chptr->chname);
sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
":%s PART %s", source_p->name, chptr->chname);
sendto_channel_local(ALL_MEMBERS, NO, chptr, ":%s!%[email protected]%s PART %s",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
remove_user_from_channel(ms);
}
示例3: m_cycle
static int
m_cycle(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *p, *name;
char *s = LOCAL_COPY(parv[1]);
struct Channel *chptr;
struct membership *msptr;
name = rb_strtok_r(s, ",", &p);
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
while(name) {
if((chptr = find_channel(name)) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
return 0;
}
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
if((is_any_op(msptr) || !MyConnect(source_p) ||
((can_send(chptr, source_p, msptr) > 0 &&
(source_p->localClient->firsttime +
ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :Cycling", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :Cycling",
source_p->name, source_p->username,
source_p->host, chptr->chname);
} else {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
remove_user_from_channel(msptr);
chptr = NULL;
msptr = NULL;
name = rb_strtok_r(NULL, ",", &p);
}
user_join(client_p, source_p, parv[1], parc > 2 ? parv[2] : NULL);
return 0;
}
示例4: part_one_client
/*
* part_one_client
*
* inputs - pointer to server
* - pointer to source client to remove
* - char pointer of name of channel to remove from
* output - none
* side effects - remove ONE client given the channel name
*/
static void
part_one_client(struct Client *client_p, struct Client *source_p, char *name, char *reason)
{
struct Channel *chptr;
struct membership *msptr;
if((chptr = find_channel(name)) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), name);
return;
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL)
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), name);
return;
}
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
/*
* Remove user from the old channel (if any)
* only allow /part reasons in -m chans
*/
if(reason[0] && (is_chanop(msptr) || !MyConnect(source_p) ||
((can_send(chptr, source_p, msptr) > 0 &&
(source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
< CurrentTime))))
{
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :%s",
use_id(source_p), chptr->chname, reason);
sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
":%s PART %s :%s",
source_p->name, chptr->chname, reason);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :%s",
source_p->name, source_p->username,
source_p->host, chptr->chname, reason);
}
else
{
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s",
use_id(source_p), chptr->chname);
sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
":%s PART %s",
source_p->name, chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
remove_user_from_channel(msptr);
}
示例5: remove_a_mode
/*
* remove_a_mode
*
* inputs -
* output - NONE
* side effects - remove ONE mode from a channel
*/
static void remove_a_mode( int hide_or_not,
struct Channel *chptr, struct Channel *top_chptr,
struct Client *source_p, dlink_list *list, char flag)
{
dlink_node *ptr;
struct Client *target_p;
char buf[BUFSIZE];
char lmodebuf[MODEBUFLEN];
char *lpara[MAXMODEPARAMS];
char *chname;
int count = 0;
mbuf = lmodebuf;
*mbuf++ = '-';
lpara[0] = lpara[1] = lpara[2] = lpara[3] = "";
chname = chptr->chname;
ircsprintf(buf,":%s MODE %s ", me.name, chname);
for (ptr = list->head; ptr && ptr->data; ptr = ptr->next)
{
target_p = ptr->data;
lpara[count++] = target_p->name;
*mbuf++ = flag;
if (count >= MAXMODEPARAMS)
{
*mbuf = '\0';
sendto_channel_local(hide_or_not, chptr,
":%s MODE %s %s %s %s %s %s",
me.name,
chname,
lmodebuf,
lpara[0], lpara[1], lpara[2], lpara[3] );
mbuf = lmodebuf;
*mbuf++ = '-';
count = 0;
lpara[0] = lpara[1] = lpara[2] = lpara[3] = "";
}
}
if(count != 0)
{
*mbuf = '\0';
sendto_channel_local(hide_or_not, chptr,
":%s MODE %s %s %s %s %s %s",
me.name,
chname,
lmodebuf,
lpara[0], lpara[1], lpara[2], lpara[3] );
}
}
示例6: part_one_client
/*
* part_one_client
*
* inputs - pointer to server
* - pointer to source client to remove
* - char pointer of name of channel to remove from
* output - none
* side effects - remove ONE client given the channel name
*/
static void
part_one_client(struct Client *client_p, struct Client *source_p, char *name, char *reason)
{
struct Channel *chptr;
struct membership *msptr;
char reason2[BUFSIZE];
if((chptr = find_channel(name)) == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return;
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL) {
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
return;
}
if(MyConnect(source_p) && !IsOper(source_p) && !IsExemptSpambot(source_p))
check_spambot_warning(source_p, NULL);
/*
* Remove user from the old channel (if any)
* only allow /part reasons in -m chans
*/
if(reason[0] && (is_any_op(msptr) || !MyConnect(source_p) ||
((can_send(chptr, source_p, msptr) > 0 && ConfigFileEntry.use_part_messages &&
(source_p->localClient->firsttime +
ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) {
if(chptr->mode.mode & MODE_NOCOLOR && (!ConfigChannel.exempt_cmode_c || !is_any_op(msptr))) {
rb_strlcpy(reason2, reason, BUFSIZE);
strip_colour(reason2);
reason = reason2;
}
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s :%s", use_id(source_p), chptr->chname, reason);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :\"%s\"",
source_p->name, source_p->username,
source_p->host, chptr->chname, reason);
} else {
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s PART %s", use_id(source_p), chptr->chname);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s",
source_p->name, source_p->username,
source_p->host, chptr->chname);
}
remove_user_from_channel(msptr);
}
示例7: kick_list
void kick_list(struct Client *client_p, struct Client *source_p, struct Channel *chptr,
dlink_list *list,char *chname)
{
struct Client *who;
dlink_node *m;
dlink_node *next_m;
for (m = list->head; m; m = next_m)
{
next_m = m->next;
who = m->data;
sendto_channel_local(ALL_MEMBERS, chptr,
":%s KICK %s %s :CLEARCHAN",
source_p->name, chname, who->name);
sendto_server(NULL, source_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT,
":%s KICK %s %s :CLEARCHAN", source_p->name,
chname, who->name);
remove_user_from_channel(chptr, who);
}
/* Join the user themselves to the channel down here, so they dont see a nicklist
* or people being kicked */
sendto_one(source_p, ":%s!%[email protected]%s JOIN %s",
source_p->name,
source_p->username,
source_p->host,
chname);
channel_member_names(source_p, chptr, chname, 1);
}
示例8: set_topic
/*
* set_topic
*
* inputs - source_p pointer
* - channel pointer
* - topicts to set
* - who to set as who doing the topic
* - topic
* output - none
* Side effects - simply propagates topic as needed
* little helper function, could be removed
*/
static void
set_topic(struct Client *source_p, struct Channel *chptr, time_t topicts,
const char *topicwho, const char *topic)
{
int new_topic = strcmp(chptr->topic ? chptr->topic : "", topic);
set_channel_topic(chptr, topic, topicwho, topicts);
/* Only send TOPIC to channel if it's different */
if (new_topic)
sendto_channel_local(ALL_MEMBERS, NO, chptr, ":%s TOPIC %s :%s",
ConfigServerHide.hide_servers ? me.name : source_p->name,
chptr->chname, chptr->topic == NULL ? "" : chptr->topic);
sendto_server(source_p, chptr, CAP_TBURST, NOCAPS,
":%s TBURST %lu %s %lu %s :%s",
me.name, (unsigned long)chptr->channelts, chptr->chname,
(unsigned long)chptr->topic_time,
chptr->topic_info == NULL ? "" : chptr->topic_info,
chptr->topic == NULL ? "" : chptr->topic);
sendto_server(source_p, chptr, CAP_TB, CAP_TBURST,
":%s TB %s %lu %s :%s",
me.name, chptr->chname,
(unsigned long)chptr->topic_time,
chptr->topic_info == NULL ? "" : chptr->topic_info,
chptr->topic == NULL ? "" : chptr->topic);
}
示例9: do_join_0
static void do_join_0(struct Client *client_p, struct Client *source_p)
{
struct Channel *chptr=NULL;
dlink_node *lp;
/* Finish the flood grace period... */
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
sendto_server(client_p, NULL, NOCAPS, NOCAPS,
":%s JOIN 0", source_p->name);
if (source_p->user->channel.head &&
MyConnect(source_p) && !IsOper(source_p))
check_spambot_warning(source_p, NULL);
while ((lp = source_p->user->channel.head))
{
chptr = lp->data;
sendto_channel_local(ALL_MEMBERS,chptr, ":%s!%[email protected]%s PART %s",
source_p->name,
source_p->username,
source_p->host,
chptr->chname);
remove_user_from_channel(chptr, source_p);
}
}
示例10: ms_tb
/* m_tb()
*
* parv[1] - channel
* parv[2] - topic ts
* parv[3] - optional topicwho/topic
* parv[4] - topic
*/
static int
ms_tb(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
const char *newtopic;
const char *newtopicwho;
time_t newtopicts;
chptr = find_channel(parv[1]);
if(chptr == NULL)
return 0;
newtopicts = atol(parv[2]);
if(parc == 5)
{
newtopic = parv[4];
newtopicwho = parv[3];
}
else
{
newtopic = parv[3];
newtopicwho = source_p->name;
}
if(EmptyString(newtopic))
return 0;
if(chptr->topic == NULL || (chptr->topic != NULL && chptr->topic->topic_time > newtopicts))
{
/* its possible the topicts is a few seconds out on some
* servers, due to lag when propagating it, so if theyre the
* same topic just drop the message --fl
*/
if(chptr->topic != NULL && strcmp(chptr->topic->topic, newtopic) == 0)
return 0;
set_channel_topic(chptr, newtopic, newtopicwho, newtopicts);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
source_p->name, chptr->chname, newtopic);
sendto_server(client_p, chptr, CAP_TB | CAP_TS6, NOCAPS,
":%s TB %s %ld %s%s:%s",
use_id(source_p), chptr->chname, (long)chptr->topic->topic_time,
ConfigChannel.burst_topicwho ? chptr->topic->topic_info : "",
ConfigChannel.burst_topicwho ? " " : "", chptr->topic->topic);
sendto_server(client_p, chptr, CAP_TB, CAP_TS6,
":%s TB %s %ld %s%s:%s",
source_p->name, chptr->chname, (long)chptr->topic->topic_time,
ConfigChannel.burst_topicwho ? chptr->topic->topic_info : "",
ConfigChannel.burst_topicwho ? " " : "", chptr->topic->topic);
}
return 0;
}
示例11: ms_topic
/*! \brief TOPIC 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] = channel name
* - parv[2] = topic text
*/
static int
ms_topic(struct Client *source_p, int parc, char *parv[])
{
struct Channel *chptr = NULL;
char topic_info[USERHOST_REPLYLEN];
if (EmptyString(parv[1]))
{
sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "TOPIC");
return 0;
}
if ((chptr = hash_find_channel(parv[1])) == NULL)
{
sendto_one_numeric(source_p, &me, ERR_NOSUCHCHANNEL, parv[1]);
return 0;
}
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);
channel_set_topic(chptr, parv[2], topic_info, CurrentTime, 0);
sendto_server(source_p, 0, 0, ":%s TOPIC %s :%s",
source_p->id, chptr->name,
chptr->topic);
if (!IsClient(source_p))
sendto_channel_local(0, chptr, ":%s TOPIC %s :%s",
(IsHidden(source_p) || ConfigServerHide.hide_servers) ? me.name : source_p->name,
chptr->name, chptr->topic);
else
sendto_channel_local(0, chptr, ":%s!%[email protected]%s TOPIC %s :%s",
source_p->name,
source_p->username,
source_p->host,
chptr->name, chptr->topic);
return 0;
}
示例12: ms_topic
/*
* ms_topic
* parv[0] = sender prefix
* parv[1] = channel name
* parv[2] = topic_info
* parv[3] = topic_info time
* parv[4] = new channel topic
*
* Let servers always set a topic
*/
static void ms_topic(struct Client *client_p,
struct Client *source_p,
int parc,
char *parv[])
{
struct Channel *chptr = NULL;
if (!IsServer(source_p))
{
m_topic(client_p, source_p, parc, parv);
return;
}
if( parc < 5 )
return;
if (parv[1] && IsChannelName(parv[1]))
{
if ((chptr = hash_find_channel(parv[1])) == NULL)
return;
set_channel_topic(chptr, parv[4], parv[2], atoi(parv[3]));
if(ConfigServerHide.hide_servers)
{
sendto_channel_local(ALL_MEMBERS,
chptr, ":%s TOPIC %s :%s",
me.name,
parv[1],
chptr->topic == NULL ? "" : chptr->topic);
}
else
{
sendto_channel_local(ALL_MEMBERS,
chptr, ":%s TOPIC %s :%s",
source_p->name,
parv[1], chptr->topic == NULL ? "" : chptr->topic);
}
}
}
示例13: mo_forcepart
static int
mo_forcepart(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
struct Channel *chptr;
struct membership *msptr;
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "forcepart");
return 0;
}
if((hunt_server(client_p, source_p, ":%s FORCEPART %s %s", 1, parc, parv)) != HUNTED_ISME)
return 0;
/* if target_p == NULL then let the oper know */
if((target_p = find_client(parv[1])) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, parv[1]);
return 0;
}
if(!IsClient(target_p))
return 0;
if((chptr = find_channel(parv[2])) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
if((msptr = find_channel_membership(chptr, target_p)) == NULL)
{
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
me.name, source_p->name, parv[1], parv[2]);
return 0;
}
sendto_server(target_p, chptr, NOCAPS, NOCAPS,
":%s PART %s :%s", target_p->name, chptr->chname, target_p->name);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected]%s PART %s :%s",
target_p->name, target_p->username,
target_p->host, chptr->chname, target_p->name);
remove_user_from_channel(msptr);
return 0;
}
示例14: me_roleplay
static int
me_roleplay(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
/* Don't segfault if we get ROLEPLAY with an invalid channel.
* This shouldn't happen but it's best to be on the safe side. */
if((chptr = find_channel(parv[1])) == NULL)
return 0;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%[email protected] PRIVMSG %s :%s (%s)", parv[2], source_p->name, parv[1], parv[3], source_p->name);
return 0;
}
示例15: ms_topic
/*
* ms_topic
* parv[1] = channel name
* parv[2] = topic_info
* parv[3] = topic_info time
* parv[4] = new channel topic
*
* Let servers always set a topic
*/
static int
ms_topic(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr = NULL;
if((chptr = find_channel(parv[1])) == NULL)
return 0;
set_channel_topic(chptr, parv[4], parv[2], atoi(parv[3]));
sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s",
source_p->name, parv[1],
chptr->topic == NULL ? "" : chptr->topic);
return 0;
}