本文整理汇总了C++中sendcmdto_one函数的典型用法代码示例。如果您正苦于以下问题:C++ sendcmdto_one函数的具体用法?C++ sendcmdto_one怎么用?C++ sendcmdto_one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendcmdto_one函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: uping_end
/** Clean up a UPing structure, reporting results to the requester.
* @param[in,out] pptr UPing results.
*/
void uping_end(struct UPing* pptr)
{
Debug((DEBUG_DEBUG, "uping_end: %p", pptr));
if (pptr->client) {
if (pptr->lastsent) {
if (0 < pptr->received) {
sendcmdto_one(&me, CMD_NOTICE, pptr->client, "%C :UPING %s%s",
pptr->client, pptr->name, pptr->buf);
sendcmdto_one(&me, CMD_NOTICE, pptr->client, "%C :UPING Stats: "
"sent %d recvd %d ; min/avg/max = %u/%u/%u ms",
pptr->client, pptr->sent, pptr->received, pptr->ms_min,
(2 * pptr->ms_ave) / (2 * pptr->received), pptr->ms_max);
} else
sendcmdto_one(&me, CMD_NOTICE, pptr->client, "%C :UPING: no response "
"from %s within %d seconds", pptr->client, pptr->name,
UPINGTIMEOUT);
} else
sendcmdto_one(&me, CMD_NOTICE, pptr->client, "%C :UPING: Could not "
"start ping to %s", pptr->client, pptr->name);
}
close(pptr->fd);
pptr->fd = -1;
uping_erase(pptr);
if (pptr->client)
ClearUPing(pptr->client);
if (pptr->freeable & UPING_PENDING_SOCKET)
socket_del(&pptr->socket);
if (pptr->freeable & UPING_PENDING_SENDER)
timer_del(&pptr->sender);
if (pptr->freeable & UPING_PENDING_KILLER)
timer_del(&pptr->killer);
}
开发者ID:Compy,项目名称:Undernet-IRCU,代码行数:37,代码来源:uping.c
示例2: uping_server
/** Start sending upings to a server.
* @param[in] sptr Client requesting the upings.
* @param[in] aconf ConfItem containing the address to ping.
* @param[in] port Port number to ping.
* @param[in] count Number of times to ping (should be at least 20).
* @return Zero.
*/
int uping_server(struct Client* sptr, struct ConfItem* aconf, int port, int count)
{
int fd;
struct UPing* pptr;
assert(0 != sptr);
assert(0 != aconf);
if (INADDR_NONE == aconf->ipnum.s_addr) {
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :UPING: Host lookup failed for "
"%s", sptr, aconf->name);
return 0;
}
if (IsUPing(sptr))
uping_cancel(sptr, sptr); /* Cancel previous ping request */
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :UPING: Unable to create udp "
"ping socket", sptr);
return 0;
}
if (!os_set_nonblocking(fd)) {
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :UPING: Can't set fd non-"
"blocking", sptr);
close(fd);
return 0;
}
pptr = (struct UPing*) MyMalloc(sizeof(struct UPing));
assert(0 != pptr);
memset(pptr, 0, sizeof(struct UPing));
if (!socket_add(&pptr->socket, uping_read_callback, (void*) pptr,
SS_DATAGRAM, SOCK_EVENT_READABLE, fd)) {
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :UPING: Can't queue fd for "
"reading", sptr);
close(fd);
MyFree(pptr);
return 0;
}
pptr->fd = fd;
pptr->sin.sin_port = htons(port);
pptr->sin.sin_addr.s_addr = aconf->ipnum.s_addr;
pptr->sin.sin_family = AF_INET;
pptr->count = IRCD_MIN(20, count);
pptr->client = sptr;
pptr->index = -1;
pptr->freeable = UPING_PENDING_SOCKET;
strcpy(pptr->name, aconf->name);
pptr->next = pingList;
pingList = pptr;
SetUPing(sptr);
uping_start(pptr);
return 0;
}
开发者ID:evilnet,项目名称:nefarious,代码行数:66,代码来源:uping.c
示例3: uping_server
/** Start sending upings to a server.
* @param[in] sptr Client requesting the upings.
* @param[in] aconf ConfItem containing the address to ping.
* @param[in] port Port number to ping.
* @param[in] count Number of times to ping (should be at least 20).
* @return Zero.
*/
int uping_server(struct Client* sptr, struct ConfItem* aconf, int port, int count)
{
int fd;
int family = 0;
struct UPing* pptr;
struct irc_sockaddr *local;
assert(0 != sptr);
assert(0 != aconf);
if (!irc_in_addr_valid(&aconf->address.addr)) {
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :UPING: Host lookup failed for "
"%s", sptr, aconf->name);
return 0;
}
if (IsUPing(sptr))
uping_cancel(sptr, sptr); /* Cancel previous ping request */
if (irc_in_addr_is_ipv4(&aconf->address.addr)) {
local = &VirtualHost_v4;
family = AF_INET;
} else {
local = &VirtualHost_v6;
}
fd = os_socket(local, SOCK_DGRAM, "Outbound uping socket", family);
if (fd < 0)
return 0;
pptr = (struct UPing*) MyMalloc(sizeof(struct UPing));
assert(0 != pptr);
memset(pptr, 0, sizeof(struct UPing));
if (!socket_add(&pptr->socket, uping_read_callback, (void*) pptr,
SS_DATAGRAM, SOCK_EVENT_READABLE, fd)) {
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :UPING: Can't queue fd for "
"reading", sptr);
close(fd);
MyFree(pptr);
return 0;
}
pptr->fd = fd;
memcpy(&pptr->addr.addr, &aconf->address.addr, sizeof(pptr->addr.addr));
pptr->addr.port = port;
pptr->count = IRCD_MIN(20, count);
pptr->client = sptr;
pptr->freeable = UPING_PENDING_SOCKET;
strcpy(pptr->name, aconf->name);
pptr->next = pingList;
pingList = pptr;
SetUPing(sptr);
uping_start(pptr);
return 0;
}
开发者ID:Compy,项目名称:Undernet-IRCU,代码行数:64,代码来源:uping.c
示例4: ms_rping
/*
* ms_rping - server message handler
* -- by Run
*
* parv[0] = sender (sptr->name thus)
* if sender is a person: (traveling towards start server)
* parv[1] = pinged server[mask]
* parv[2] = start server (current target)
* parv[3] = optional remark
* if sender is a server: (traveling towards pinged server)
* parv[1] = pinged server (current target)
* parv[2] = original sender (person)
* parv[3] = start time in s
* parv[4] = start time in us
* parv[5] = the optional remark
*/
int ms_rping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
struct Client* destination = 0;
assert(0 != cptr);
assert(0 != sptr);
assert(IsServer(cptr));
/*
* shouldn't happen
*/
if (!IsPrivileged(sptr))
return 0;
if (IsServer(sptr)) {
if (parc < 6) {
/*
* PROTOCOL ERROR
*/
return need_more_params(sptr, "RPING");
}
if ((destination = FindNServer(parv[1]))) {
/*
* if it's not for me, pass it on
*/
if (IsMe(destination))
sendcmdto_one(&me, CMD_RPONG, sptr, "%s %s %s %s :%s", cli_name(sptr),
parv[2], parv[3], parv[4], parv[5]);
else
sendcmdto_one(sptr, CMD_RPING, destination, "%C %s %s %s :%s",
destination, parv[2], parv[3], parv[4], parv[5]);
}
}
else {
if (parc < 3) {
return need_more_params(sptr, "RPING");
}
/*
* Haven't made it to the start server yet, if I'm not the start server
* pass it on.
*/
if (hunt_server_cmd(sptr, CMD_RPING, cptr, 1, "%s %C :%s", 2, parc, parv)
!= HUNTED_ISME)
return 0;
/*
* otherwise ping the destination from here
*/
if ((destination = find_match_server(parv[1]))) {
assert(IsServer(destination) || IsMe(destination));
sendcmdto_one(&me, CMD_RPING, destination, "%C %C %s :%s", destination,
sptr, militime(0, 0), parv[3]);
}
else
send_reply(sptr, ERR_NOSUCHSERVER, parv[1]);
}
return 0;
}
开发者ID:Niichan,项目名称:snircd,代码行数:72,代码来源:m_rping.c
示例5: calc_load
/** Statistics callback to display userload.
* @param[in] sptr Client requesting statistics.
* @param[in] sd Stats descriptor for request (ignored).
* @param[in] param Extra parameter from user (ignored).
*/
void
calc_load(struct Client *sptr, const struct StatDesc *sd, char *param)
{
/* *INDENT-OFF* */
static const char *header =
/* ----.- ----.- ---- ---- ---- ------------ */
"Minute Hour Day Yest. YYest. Userload for:";
/* *INDENT-ON* */
static const char *what[3] = {
"local clients",
"total clients",
"total connections"
};
int i, j, times[5][3]; /* [min,hour,day,Yest,YYest]
[local,client,conn] */
int last_m_index = m_index, last_h_index = h_index;
update_load(); /* We want stats accurate as of *now* */
if (--last_m_index < 0)
last_m_index = 59;
times[0][0] = (cspm[last_m_index].local_count + 3) / 6;
times[0][1] = (cspm[last_m_index].client_count + 3) / 6;
times[0][2] = (cspm[last_m_index].conn_count + 3) / 6;
times[1][0] = (csph_sum.local_count + 180) / 360;
times[1][1] = (csph_sum.client_count + 180) / 360;
times[1][2] = (csph_sum.conn_count + 180) / 360;
for (i = 2; i < 5; ++i)
{
times[i][0] = 43200;
times[i][1] = 43200;
times[i][2] = 43200;
for (j = 0; j < 24; ++j)
{
if (--last_h_index < 0)
last_h_index = 71;
times[i][0] += csph[last_h_index].local_count;
times[i][1] += csph[last_h_index].client_count;
times[i][2] += csph[last_h_index].conn_count;
}
times[i][0] /= 86400;
times[i][1] /= 86400;
times[i][2] /= 86400;
}
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s", sptr, header);
for (i = 0; i < 3; ++i)
sendcmdto_one(&me, CMD_NOTICE, sptr,
"%C :%4d.%1d %4d.%1d %4d %4d %4d %s", sptr,
times[0][i] / 10, times[0][i] % 10,
times[1][i] / 10, times[1][i] % 10,
times[2][i], times[3][i], times[4][i], what[i]);
}
开发者ID:DamnIO,项目名称:DamnIRCd,代码行数:60,代码来源:userload.c
示例6: ms_kill
/*
* ms_kill - server message handler
*
* NOTE: IsServer(cptr) == true;
*
* parv[0] = sender prefix
* parv[1] = kill victim
* parv[parc-1] = kill path
*/
int ms_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
struct Client* victim;
char* path;
char* msg;
assert(0 != cptr);
assert(0 != sptr);
assert(IsServer(cptr));
/*
* XXX - a server sending less than 3 params could really desync
* things
*/
if (parc < 3) {
protocol_violation(sptr,"Too few arguments for KILL");
return need_more_params(sptr, "KILL");
}
path = parv[parc - 1]; /* Either defined or NULL (parc >= 3) */
if (!(msg = strchr(path, ' '))) /* Extract out the message */
msg = "(No reason supplied)";
else
*(msg++) = '\0'; /* Remove first character (space) and terminate path */
if (!(victim = findNUser(parv[1]))) {
if (IsUser(sptr))
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :KILL target disconnected "
"before I got him :(", sptr);
return 0;
}
/*
* We *can* have crossed a NICK with this numeric... --Run
*
* Note the following situation:
* KILL SAA --> X
* <-- S NICK ... SAA | <-- SAA QUIT <-- S NICK ... SAA <-- SQUIT S
* Where the KILL reaches point X before the QUIT does.
* This would then *still* cause an orphan because the KILL doesn't reach S
* (because of the SQUIT), the QUIT is ignored (because of the KILL)
* and the second NICK ... SAA causes an orphan on the server at the
* right (which then isn't removed when the SQUIT arrives).
* Therefore we still need to detect numeric nick collisions too.
*
* Bounce the kill back to the originator, if the client can't be found
* by the next hop (short lag) the bounce won't propagate further.
*/
if (MyConnect(victim)) {
sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s (Ghost 5 Numeric Collided)",
victim, path);
}
return do_kill(cptr, sptr, victim, cli_name(cptr), path, msg);
}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.11.07,代码行数:64,代码来源:m_kill.c
示例7: mo_kill
/*
* mo_kill - oper message handler
*
* NOTE: IsPrivileged(sptr), IsAnOper(sptr) == true
* IsServer(cptr), IsServer(sptr) == false
*
* parv[0] = sender prefix
* parv[1] = kill victim
* parv[parc-1] = kill path
*/
int mo_kill(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
struct Client* victim;
char* user;
char msg[TOPICLEN + 3]; /* (, ), and \0 */
assert(0 != cptr);
assert(0 != sptr);
/*
* oper connection to this server, cptr is always sptr
*/
assert(cptr == sptr);
assert(IsAnOper(sptr));
if (parc < 3 || EmptyString(parv[parc - 1]))
return need_more_params(sptr, "KILL");
user = parv[1];
ircd_snprintf(0, msg, sizeof(msg), "(%.*s)", TOPICLEN, parv[parc - 1]);
if (!(victim = FindClient(user))) {
/*
* If the user has recently changed nick, we automaticly
* rewrite the KILL for this new nickname--this keeps
* servers in synch when nick change and kill collide
*/
if (!(victim = get_history(user, (long)15)))
return send_reply(sptr, ERR_NOSUCHNICK, user);
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Changed KILL %s into %s", sptr,
user, cli_name(victim));
}
if (!HasPriv(sptr, MyConnect(victim) ? PRIV_LOCAL_KILL : PRIV_KILL))
return send_reply(sptr, ERR_NOPRIVILEGES);
if (IsServer(victim) || IsMe(victim)) {
return send_reply(sptr, ERR_CANTKILLSERVER);
}
/*
* if the user is +k, prevent a kill from local user
*/
if (IsChannelService(victim))
return send_reply(sptr, ERR_ISCHANSERVICE, "KILL", cli_name(victim));
if (!MyConnect(victim) && !HasPriv(sptr, PRIV_KILL)) {
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Nick %s isnt on your server",
sptr, cli_name(victim));
return 0;
}
return do_kill(cptr, sptr, victim, cli_user(sptr)->host, cli_name(sptr),
msg);
}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.11.07,代码行数:63,代码来源:m_kill.c
示例8: ms_ping
/*
* ms_ping - server message handler
*/
int ms_ping(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
struct Client* acptr;
char* origin;
char* destination;
assert(0 != cptr);
assert(0 != sptr);
assert(IsServer(cptr));
if (parc < 2 || EmptyString(parv[1])) {
/*
* don't bother sending the error back
*/
return 0;
}
origin = parv[1];
destination = parv[2]; /* Will get NULL or pointer (parc >= 2!!) */
if (parc > 3)
{
/* AsLL ping, send reply back */
int diff = atoi(militime_float(parv[3]));
sendcmdto_one(&me, CMD_PONG, sptr, "%C %s %s %i %s", &me, origin,
parv[3], diff, militime_float(NULL));
return 0;
}
if (!EmptyString(destination) && 0 != ircd_strcmp(destination, cli_name(&me))) {
if ((acptr = FindServer(destination))) {
/*
* Servers can just forward the origin
*/
sendcmdto_one(sptr, CMD_PING, acptr, "%s :%s", origin, destination);
}
else {
/*
* this can happen if server split before the ping got here
*/
send_reply(sptr, ERR_NOSUCHSERVER, destination);
}
}
else {
/*
* send pong back
* NOTE: sptr is never local so if pong handles numerics everywhere we
* could send a numeric here.
*/
sendcmdto_one(&me, CMD_PONG, sptr, "%C :%s", &me, origin);
}
return 0;
}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.12.13,代码行数:54,代码来源:m_ping.c
示例9: server_relay_private_notice
void server_relay_private_notice(struct Client* sptr, const char* name, const char* text)
{
struct Client* acptr;
assert(0 != sptr);
assert(0 != name);
assert(0 != text);
/*
* nickname addressed?
*/
if (0 == (acptr = findNUser(name)) || !IsUser(acptr))
return;
if (!IsChannelService(sptr) && is_silenced(sptr, acptr))
{
send_reply(sptr, ERR_SILENCED, cli_name(acptr));
return;
}
if (IsOnlyreg(acptr) && !IsRegnick(sptr)) {
send_reply(sptr, RPL_MSGONLYREG, cli_name(acptr));
return;
}
if (MyUser(acptr))
add_target(acptr, sptr);
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%C :%s", acptr, text);
}
开发者ID:ryden,项目名称:ircuRH,代码行数:28,代码来源:ircd_relay.c
示例10: server_relay_private_message
void server_relay_private_message(struct Client* sptr, const char* name, const char* text)
{
struct Client* acptr;
assert(0 != sptr);
assert(0 != name);
assert(0 != text);
/*
* nickname addressed?
*/
if (0 == (acptr = findNUser(name)) || !IsUser(acptr)) {
send_reply(sptr, SND_EXPLICIT | ERR_NOSUCHNICK, "* :Target left %s. "
"Failed to deliver: [%.20s]", feature_str(FEAT_NETWORK), text);
return;
}
if (!IsChannelService(sptr) && is_silenced(sptr, acptr))
{
send_reply(sptr, ERR_SILENCED, cli_name(acptr));
return;
}
if (IsOnlyreg(acptr) && !IsRegnick(sptr)) {
send_reply(sptr, RPL_MSGONLYREG, cli_name(acptr));
return;
}
if (MyUser(acptr))
add_target(acptr, sptr);
sendcmdto_one(sptr, CMD_PRIVATE, acptr, "%C :%s", acptr, text);
}
开发者ID:ryden,项目名称:ircuRH,代码行数:31,代码来源:ircd_relay.c
示例11: relay_private_notice
void relay_private_notice(struct Client* sptr, const char* name, const char* text)
{
struct Client* acptr;
assert(0 != sptr);
assert(0 != name);
assert(0 != text);
if (0 == (acptr = FindUser(name)))
return;
if (IsOnlyreg(acptr) && !IsRegnick(sptr)) {
send_reply(sptr, RPL_MSGONLYREG, cli_name(acptr));
return;
}
if (!IsChannelService(acptr))
{
if (check_target_limit(sptr, acptr, cli_name(acptr), 0))
{
return;
}
if (is_silenced(sptr, acptr))
{
send_reply(sptr, ERR_SILENCED, cli_name(acptr));
return;
}
}
/*
* deliver the message
*/
if (MyUser(acptr))
add_target(acptr, sptr);
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%C :%s", acptr, text);
}
开发者ID:ryden,项目名称:ircuRH,代码行数:35,代码来源:ircd_relay.c
示例12: ms_end_of_burst
/*
* ms_end_of_burst - server message handler
* - Added Xorath 6-14-96, rewritten by Run 24-7-96
* - and fixed by record and Kev 8/1/96
* - and really fixed by Run 15/8/96 :p
* This the last message in a net.burst.
* It clears a flag for the server sending the burst.
*
* As of 10.11, to fix a bug in the way BURST is processed, it also
* makes sure empty channels are deleted
*
* parv[0] - sender prefix
*/
int ms_end_of_burst(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
struct Channel *chan, *next_chan;
assert(0 != cptr);
assert(0 != sptr);
sendto_opmask_butone(0, SNO_NETWORK, "Completed net.burst from %C.",
sptr);
sendcmdto_serv_butone(sptr, CMD_END_OF_BURST, cptr, "");
ClearBurst(sptr);
SetBurstAck(sptr);
if (MyConnect(sptr))
sendcmdto_one(&me, CMD_END_OF_BURST_ACK, sptr, "");
/* Count through channels... */
for (chan = GlobalChannelList; chan; chan = next_chan) {
next_chan = chan->next;
if (!chan->members && (chan->mode.mode & MODE_BURSTADDED)) {
/* Newly empty channel, schedule it for removal. */
chan->mode.mode &= ~MODE_BURSTADDED;
sub1_from_channel(chan);
} else
chan->mode.mode &= ~MODE_BURSTADDED;
}
return 0;
}
开发者ID:DamnIO,项目名称:DamnIRCd,代码行数:41,代码来源:m_endburst.c
示例13: do_settopic
/** Set a channel topic or report an error.
* @param[in] sptr Original topic setter.
* @param[in] cptr Neighbor that sent the topic message.
* @param[in] chptr Channel to set topic on.
* @param[in] topic New topic.
* @param[in] ts Timestamp that topic was set (0 for current time).
*/
static void do_settopic(struct Client *sptr, struct Client *cptr,
struct Channel *chptr, char *topic, time_t ts)
{
struct Client *from;
int newtopic;
if (feature_bool(FEAT_HIS_BANWHO) && IsServer(sptr))
from = &his;
else
from = sptr;
/* Note if this is just a refresh of an old topic, and don't
* send it to all the clients to save bandwidth. We still send
* it to other servers as they may have split and lost the topic.
*/
newtopic=ircd_strncmp(chptr->topic,topic,TOPICLEN)!=0;
/* setting a topic */
ircd_strncpy(chptr->topic, topic, TOPICLEN);
ircd_strncpy(chptr->topic_nick, cli_name(from), NICKLEN);
chptr->topic_time = ts ? ts : TStime();
/* Fixed in 2.10.11: Don't propagate local topics */
if (!IsLocalChannel(chptr->chname))
sendcmdto_serv(sptr, CMD_TOPIC, cptr, "%H %Tu %Tu :%s", chptr,
chptr->creationtime, chptr->topic_time, chptr->topic);
if (newtopic)
sendcmdto_channel(from, CMD_TOPIC, chptr, NULL, SKIP_SERVERS,
"%H :%s", chptr, chptr->topic);
/* if this is the same topic as before we send it to the person that
* set it (so they knew it went through ok), but don't bother sending
* it to everyone else on the channel to save bandwidth
*/
else if (MyUser(sptr))
sendcmdto_one(sptr, CMD_TOPIC, sptr, "%H :%s", chptr, chptr->topic);
}
开发者ID:jast,项目名称:ircu-now,代码行数:40,代码来源:m_topic.c
示例14: uping_send
/** Send a uping to another server.
* @param[in] pptr Descriptor for uping.
*/
void uping_send(struct UPing* pptr)
{
struct timeval tv;
char buf[BUFSIZE + 1];
assert(0 != pptr);
if (pptr->sent == pptr->count)
return;
memset(buf, 0, sizeof(buf));
gettimeofday(&tv, NULL);
sprintf(buf, " %10lu%c%6lu", (unsigned long)tv.tv_sec, '\0', (unsigned long)tv.tv_usec);
Debug((DEBUG_SEND, "send_ping: sending [%s %s] to %s.%d on %d",
buf, &buf[12],
ircd_ntoa(&pptr->addr.addr), pptr->addr.port,
pptr->fd));
if (os_sendto_nonb(pptr->fd, buf, BUFSIZE, NULL, 0, &pptr->addr) != IO_SUCCESS)
{
const char* msg = strerror(errno);
if (!msg)
msg = "Unknown error";
if (pptr->client)
sendcmdto_one(&me, CMD_NOTICE, pptr->client, "%C :UPING: send failed: "
"%s", pptr->client, msg);
Debug((DEBUG_DEBUG, "UPING: send_ping: sendto failed on %d: %s", pptr->fd, msg));
uping_end(pptr);
return;
}
++pptr->sent;
}
开发者ID:Compy,项目名称:Undernet-IRCU,代码行数:35,代码来源:uping.c
示例15: mo_asll
/*
* mo_asll - oper message handler
*/
int mo_asll(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
char *mask;
struct Client *acptr;
int hits;
int i;
if (parc < 2)
return need_more_params(sptr, "ASLL");
if (parc == 2 && MyUser(sptr))
parv[parc++] = cli_name(&me);
if (hunt_server_prio_cmd(sptr, CMD_ASLL, cptr, 1, "%s %C", 2, parc, parv) != HUNTED_ISME)
return 0;
mask = parv[1];
for (i = hits = 0; i <= HighestFd; i++) {
acptr = LocalClientArray[i];
if (!acptr || !IsServer(acptr) || !MyConnect(acptr) || match(mask, cli_name(acptr)))
continue;
send_asll_reply(&me, sptr, cli_name(acptr), cli_serv(acptr)->asll_rtt,
cli_serv(acptr)->asll_to, cli_serv(acptr)->asll_from);
hits++;
}
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :AsLL for %s: %d local servers matched", sptr, mask, hits);
return 0;
}
开发者ID:Niichan,项目名称:snircd,代码行数:31,代码来源:m_asll.c
示例16: uping_send
/** Send a uping to another server.
* @param[in] pptr Descriptor for uping.
*/
void uping_send(struct UPing* pptr)
{
struct timeval tv;
char buf[BUFSIZE + 1];
assert(0 != pptr);
if (pptr->sent == pptr->count)
return;
memset(buf, 0, sizeof(buf));
gettimeofday(&tv, NULL);
sprintf(buf, " %10lu%c%6lu", (long unsigned int)tv.tv_sec, '\0', tv.tv_usec);
Debug((DEBUG_SEND, "send_ping: sending [%s %s] to %s.%d on %d",
buf, &buf[12],
ircd_ntoa((const char*) &pptr->sin.sin_addr), ntohs(pptr->sin.sin_port),
pptr->fd));
if (sendto(pptr->fd, buf, BUFSIZE, 0, (struct sockaddr*) &pptr->sin,
sizeof(struct sockaddr_in)) != BUFSIZE)
{
const char* msg = strerror(errno);
if (!msg)
msg = "Unknown error";
if (pptr->client)
sendcmdto_one(&me, CMD_NOTICE, pptr->client, "%C :UPING: send failed: "
"%s", pptr->client, msg);
Debug((DEBUG_DEBUG, "UPING: send_ping: sendto failed on %d: %s", pptr->fd, msg));
uping_end(pptr);
return;
}
++pptr->sent;
}
开发者ID:evilnet,项目名称:nefarious,代码行数:36,代码来源:uping.c
示例17: ms_oper
/*
* ms_oper - server message handler
*/
int ms_oper(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
struct Client *acptr;
struct ConfItem *aconf;
assert(0 != cptr);
assert(IsServer(cptr));
/*
* if message arrived from server, trust it, and set to oper
*/
if (!IsServer(sptr) && !IsOper(sptr)) {
if (parc < 4)
return send_reply(sptr, ERR_NOOPERHOST);
if (!(acptr = FindNServer(parv[1])))
return send_reply(sptr, ERR_NOOPERHOST);
else if (!IsMe(acptr)) {
sendcmdto_one(sptr, CMD_OPER, acptr, "%C %s %s", acptr, parv[2],
parv[3]);
return 0;
}
if (can_oper(cptr, sptr, parv[2], parv[3], &aconf))
do_oper(cptr, sptr, aconf);
} else if (!IsServer(sptr))
send_reply(sptr, RPL_YOUREOPER);
return 0;
}
开发者ID:WildClaudio,项目名称:nefarious2,代码行数:33,代码来源:m_oper.c
示例18: relay_directed_notice
void relay_directed_notice(struct Client* sptr, char* name, char* server, const char* text)
{
struct Client* acptr;
char* host;
assert(0 != sptr);
assert(0 != name);
assert(0 != text);
assert(0 != server);
if (0 == (acptr = FindServer(server + 1)))
return;
/*
* NICK[%host]@server addressed? See if <server> is me first
*/
if (!IsMe(acptr)) {
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text);
return;
}
/*
* Look for an user whose NICK is equal to <name> and then
* check if it's hostname matches <host> and if it's a local
* user.
*/
*server = '\0';
if ((host = strchr(name, '%')))
*host++ = '\0';
if (!(acptr = FindUser(name)) || !MyUser(acptr) ||
(!EmptyString(host) && 0 != match(host, cli_user(acptr)->realhost)))
return;
*server = '@';
if (host)
*--host = '%';
if (!IsChannelService(sptr) && is_silenced(sptr, acptr))
{
send_reply(sptr, ERR_SILENCED, cli_name(acptr));
return;
}
if (IsOnlyreg(acptr) && !IsRegnick(sptr))
send_reply(sptr, RPL_MSGONLYREG, cli_name(acptr));
else
sendcmdto_one(sptr, CMD_NOTICE, acptr, "%s :%s", name, text);
}
开发者ID:ryden,项目名称:ircuRH,代码行数:47,代码来源:ircd_relay.c
示例19: proto_send_supported
int proto_send_supported(struct Client* cptr)
{
/*
* send_reply(cptr, RPL_PROTOLIST, "stuff");
*/
sendcmdto_one(&me,CMD_PROTO,cptr,"%s unet1 1 1",PROTO_SUP);
return 0;
}
开发者ID:ryden,项目名称:ircuRH,代码行数:8,代码来源:m_proto.c
示例20: m_hash
int m_hash(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{
int max_chain = 0;
int buckets = 0;
int count = 0;
struct Client* cl;
struct Channel* ch;
int i;
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Hash Table Statistics", sptr);
for (i = 0; i < HASHSIZE; ++i) {
if ((cl = clientTable[i])) {
int len = 0;
++buckets;
for ( ; cl; cl = cli_hnext(cl))
++len;
if (len > max_chain)
max_chain = len;
count += len;
}
}
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Client: entries: %d buckets: %d "
"max chain: %d", sptr, count, buckets, max_chain);
buckets = 0;
count = 0;
max_chain = 0;
for (i = 0; i < HASHSIZE; ++i) {
if ((ch = channelTable[i])) {
int len = 0;
++buckets;
for ( ; ch; ch = ch->hnext)
++len;
if (len > max_chain)
max_chain = len;
count += len;
}
}
sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :Channel: entries: %d buckets: %d "
"max chain: %d", sptr, count, buckets, max_chain);
return 0;
}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.11.07,代码行数:46,代码来源:hash.c
注:本文中的sendcmdto_one函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论