本文整理汇总了C++中sendto_channel_local函数的典型用法代码示例。如果您正苦于以下问题:C++ sendto_channel_local函数的具体用法?C++ sendto_channel_local怎么用?C++ sendto_channel_local使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendto_channel_local函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:jmaurice,项目名称:ircd-hybrid,代码行数:59,代码来源:m_topic.c
示例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);
}
开发者ID:KSoute,项目名称:oftc-hybrid,代码行数:67,代码来源:m_part.c
示例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;
}
开发者ID:Cloudxtreme,项目名称:elemental-ircd,代码行数:58,代码来源:m_cycle.c
示例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);
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:66,代码来源:m_part.c
示例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] );
}
}
开发者ID:Cloudxtreme,项目名称:ircd-3,代码行数:63,代码来源:m_clearchan.c
示例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);
}
开发者ID:Cloudxtreme,项目名称:elemental-ircd,代码行数:57,代码来源:m_part.c
示例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);
}
开发者ID:Cloudxtreme,项目名称:ircd-3,代码行数:31,代码来源:m_clearchan.c
示例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);
}
开发者ID:KSoute,项目名称:oftc-hybrid,代码行数:39,代码来源:m_tburst.c
示例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);
}
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:28,代码来源:m_join.c
示例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;
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:62,代码来源:m_tb.c
示例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;
}
开发者ID:Cloudxtreme,项目名称:ircd-hybrid,代码行数:54,代码来源:m_topic.c
示例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);
}
}
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:51,代码来源:m_topic.c
示例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;
}
开发者ID:Cloudxtreme,项目名称:ircd-ratbox,代码行数:53,代码来源:m_force.c
示例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;
}
开发者ID:CustomIRCd,项目名称:elemental-ircd,代码行数:13,代码来源:m_roleplay.c
示例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;
}
开发者ID:ntchambers,项目名称:charybdis,代码行数:25,代码来源:m_topic.c
示例16: set_topic
static void
set_topic(struct Client *source_p, struct Channel *chptr,
time_t newtopicts, char *topicwho, char *topic)
{
set_channel_topic(chptr, topic, topicwho, newtopicts);
sendto_channel_local(ALL_MEMBERS, chptr, ":%s TOPIC %s :%s", source_p->name,
chptr->chname, chptr->topic == NULL ? "" : chptr->topic);
#ifdef TBURST_PROPAGATE
sendto_server(source_p, NULL, chptr, CAP_TBURST, NOCAPS, NOFLAGS,
":%s TBURST %ld %s %ld %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);
#endif
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:18,代码来源:m_tburst.c
示例17: show_privmsg
int
show_privmsg(struct hook_privmsg_data *data)
{
struct Channel *acptr;
struct Client *from_p;
from_p = find_client(data->from);
acptr = get_or_create_channel(from_p, TARGET_CHANNEL, NULL);
sendto_realops_flags(UMODE_ALL, L_ALL, "debug: intercepted pm %s %s %s %s",
data->type, data->from, data->to, data->text);
sendto_channel_local(ALL_MEMBERS, acptr, MSGFORMAT, me.name, TARGET_CHANNEL,
data->type, data->from,
data->to, data->text);
return 0;
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:19,代码来源:m_intercept.c
示例18: 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;
}
开发者ID:adamh1989,项目名称:sIRCd,代码行数:39,代码来源:m_forcepart.c
示例19: mo_omode
/*
* mo_omode - MODE command handler
* parv[1] - channel
*/
static int
mo_omode(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr = NULL;
struct membership *msptr;
char params[512];
int i;
int wasonchannel;
/* admins only */
if (!IsOperAdmin(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
}
/* Now, try to find the channel in question */
if (!IsChanPrefix(parv[1][0]) || !check_channel_name(parv[1])) {
sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), parv[1]);
return 0;
}
chptr = find_channel(parv[1]);
if (chptr == NULL) {
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
/* Now know the channel exists */
msptr = find_channel_membership(chptr, source_p);
wasonchannel = msptr != NULL;
if (is_any_op(msptr)) {
sendto_one_notice(source_p, ":Use a normal MODE you idiot");
return 0;
}
params[0] = '\0';
for (i = 2; i < parc; i++) {
if (i != 2)
rb_strlcat(params, " ", sizeof params);
rb_strlcat(params, parv[i], sizeof params);
}
sendto_wallops_flags(UMODE_WALLOP, &me,
"OMODE called for [%s] [%s] by %s!%[email protected]%s",
parv[1], params, source_p->name, source_p->username, source_p->host);
ilog(L_MAIN, "OMODE called for [%s] [%s] by %s",
parv[1], params, get_oper_name(source_p));
if (*chptr->chname != '&')
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
":%s WALLOPS :OMODE called for [%s] [%s] by %s!%[email protected]%s",
me.name, parv[1], params, source_p->name, source_p->username,
source_p->host);
#if 0
set_channel_mode(client_p, source_p->servptr, chptr, msptr,
parc - 2, parv + 2);
#else
if (parc == 4 && !strcmp(parv[2], "+y") && !irccmp(parv[3], source_p->name)) {
/* Ownering themselves */
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +y %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +y %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_OWNER;
} else if (parc == 4 && !strcmp(parv[2], "+a") && !irccmp(parv[3], source_p->name)) {
/* Admining themselves */
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +a %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +a %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_ADMIN;
} else if (parc == 4 && !strcmp(parv[2], "+o") && !irccmp(parv[3], source_p->name)) {
/* Opping themselves */
if (!wasonchannel) {
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, parv[1], source_p->name);
sendto_server(NULL, chptr, CAP_TS6, NOCAPS,
":%s TMODE %ld %s +o %s",
me.id, (long) chptr->channelts, parv[1],
source_p->id);
msptr->flags |= CHFL_CHANOP;
} else if (parc == 4 && !strcmp(parv[2], "+h") && !irccmp(parv[3], source_p->name)) {
/* Halfopping themselves */
//.........这里部分代码省略.........
开发者ID:Codyle,项目名称:elemental-ircd,代码行数:101,代码来源:m_omode.c
示例20: m_topic
/*
* m_topic
* parv[0] = sender prefix
* parv[1] = channel name
* parv[2] = new topic, if setting topic
*/
static int
m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr = NULL;
struct membership *msptr;
char *p = NULL;
if((p = strchr(parv[1], ',')))
*p = '\0';
if(MyClient(source_p) && !IsFloodDone(source_p))
flood_endgrace(source_p);
if(!IsChannelName(parv[1]))
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
chptr = find_channel(parv[1]);
if(chptr == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
}
/* setting topic */
if(parc > 2)
{
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL)
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
}
if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr) || !MyClient(source_p))
{
char topic_info[USERHOST_REPLYLEN];
ircsprintf(topic_info, "%s!%[email protected]%s",
source_p->name, source_p->username, source_p->host);
set_channel_topic(chptr, parv[2], topic_info, CurrentTime);
sendto_server(client_p, chptr, CAP_TS6, NOCAPS,
":%s TOPIC %s :%s",
use_id(source_p), chptr->chname,
chptr->topic == NULL ? "" : chptr->topic);
sendto_server(client_p, chptr, NOCAPS, CAP_TS6,
":%s TOPIC %s :%s",
source_p->name, chptr->chname,
chptr->topic == NULL ? "" : chptr->topic);
sendto_channel_local(ALL_MEMBERS,
chptr, ":%s!%[email protected]%s TOPIC %s :%s",
source_p->name, source_p->username,
source_p->host, chptr->chname,
chptr->topic == NULL ? "" : chptr->topic);
}
else
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]);
}
else if(MyClient(source_p))
{
if(!IsMember(source_p, chptr) && SecretChannel(chptr))
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
}
if(chptr->topic == NULL)
sendto_one(source_p, form_str(RPL_NOTOPIC),
me.name, source_p->name, parv[1]);
else
{
sendto_one(source_p, form_str(RPL_TOPIC),
me.name, source_p->name, chptr->chname, chptr->topic);
sendto_one(source_p, form_str(RPL_TOPICWHOTIME),
me.name, source_p->name, chptr->chname,
chptr->topic_info, chptr->topic_time);
}
}
return 0;
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:96,代码来源:m_topic.c
注:本文中的sendto_channel_local函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论