| 167 |
|
return; |
| 168 |
|
} |
| 169 |
|
|
| 170 |
– |
if (ServerInfo.hub && IsCapable(to, CAP_LL)) |
| 171 |
– |
{ |
| 172 |
– |
if (((from->lazyLinkClientExists & |
| 173 |
– |
to->localClient->serverMask) == 0)) |
| 174 |
– |
client_burst_if_needed(to, from); |
| 175 |
– |
} |
| 176 |
– |
|
| 170 |
|
/* Optimize by checking if (from && to) before everything */ |
| 171 |
|
/* we set to->from up there.. */ |
| 172 |
|
|
| 186 |
|
from->name, from->username, from->host, |
| 187 |
|
to->from->name); |
| 188 |
|
|
| 189 |
< |
sendto_server(NULL, to, NULL, CAP_TS6, NOCAPS, NOFLAGS, |
| 189 |
> |
sendto_server(NULL, NULL, CAP_TS6, NOCAPS, |
| 190 |
|
":%s KILL %s :%s (%s[%s@%s] Ghosted %s)", |
| 191 |
|
me.id, to->name, me.name, to->name, |
| 192 |
|
to->username, to->host, to->from->name); |
| 193 |
< |
sendto_server(NULL, to, NULL, NOCAPS, CAP_TS6, NOFLAGS, |
| 193 |
> |
sendto_server(NULL, NULL, NOCAPS, CAP_TS6, |
| 194 |
|
":%s KILL %s :%s (%s[%s@%s] Ghosted %s)", |
| 195 |
|
me.name, to->name, me.name, to->name, |
| 196 |
|
to->username, to->host, to->from->name); |
| 538 |
|
* - pointer to channel required by LL (if any) |
| 539 |
|
* - caps or'd together which must ALL be present |
| 540 |
|
* - caps or'd together which must ALL NOT be present |
| 548 |
– |
* - LL flags: LL_ICLIENT | LL_ICHAN |
| 541 |
|
* - printf style format string |
| 542 |
|
* - args to format string |
| 543 |
|
* output - NONE |
| 544 |
|
* side effects - Send a message to all connected servers, except the |
| 545 |
|
* client 'one' (if non-NULL), as long as the servers |
| 546 |
|
* support ALL capabs in 'caps', and NO capabs in 'nocaps'. |
| 555 |
– |
* If the server is a lazylink client, then it must know |
| 556 |
– |
* about source_p if non-NULL (unless LL_ICLIENT is specified, |
| 557 |
– |
* when source_p will be introduced where required) and |
| 558 |
– |
* chptr if non-NULL (unless LL_ICHANNEL is specified, when |
| 559 |
– |
* chptr will be introduced where required). |
| 560 |
– |
* Note: nothing will be introduced to a LazyLeaf unless |
| 561 |
– |
* the message is actually sent. |
| 547 |
|
* |
| 548 |
|
* This function was written in an attempt to merge together the other |
| 549 |
|
* billion sendto_*serv*() functions, which sprung up with capabs, |
| 551 |
|
* -davidt |
| 552 |
|
*/ |
| 553 |
|
void |
| 554 |
< |
sendto_server(struct Client *one, struct Client *source_p, |
| 554 |
> |
sendto_server(struct Client *one, |
| 555 |
|
struct Channel *chptr, unsigned long caps, |
| 556 |
< |
unsigned long nocaps, unsigned long llflags, |
| 556 |
> |
unsigned long nocaps, |
| 557 |
|
const char *format, ...) |
| 558 |
|
{ |
| 559 |
|
va_list args; |
| 560 |
< |
struct Client *client_p; |
| 576 |
< |
dlink_node *ptr; |
| 560 |
> |
dlink_node *ptr = NULL; |
| 561 |
|
char buffer[IRCD_BUFSIZE]; |
| 562 |
< |
int len; |
| 562 |
> |
int len = 0; |
| 563 |
|
|
| 564 |
< |
if (chptr != NULL) |
| 565 |
< |
{ |
| 582 |
< |
if (chptr->chname[0] != '#') |
| 583 |
< |
return; |
| 584 |
< |
} |
| 564 |
> |
if (chptr && chptr->chname[0] != '#') |
| 565 |
> |
return; |
| 566 |
|
|
| 567 |
|
va_start(args, format); |
| 568 |
|
len = send_format(buffer, IRCD_BUFSIZE, format, args); |
| 570 |
|
|
| 571 |
|
DLINK_FOREACH(ptr, serv_list.head) |
| 572 |
|
{ |
| 573 |
< |
client_p = ptr->data; |
| 573 |
> |
struct Client *client_p = ptr->data; |
| 574 |
|
|
| 575 |
|
/* If dead already skip */ |
| 576 |
|
if (IsDead(client_p)) |
| 585 |
|
if ((client_p->localClient->caps & nocaps) != 0) |
| 586 |
|
continue; |
| 587 |
|
|
| 607 |
– |
if (ServerInfo.hub && IsCapable(client_p, CAP_LL)) |
| 608 |
– |
{ |
| 609 |
– |
/* check LL channel */ |
| 610 |
– |
if (chptr != NULL && |
| 611 |
– |
((chptr->lazyLinkChannelExists & |
| 612 |
– |
client_p->localClient->serverMask) == 0)) |
| 613 |
– |
{ |
| 614 |
– |
/* Only introduce the channel if we really will send this message */ |
| 615 |
– |
if (!(llflags & LL_ICLIENT) && source_p && |
| 616 |
– |
((source_p->lazyLinkClientExists & |
| 617 |
– |
client_p->localClient->serverMask) == 0)) |
| 618 |
– |
continue; /* we can't introduce the unknown source_p, skip */ |
| 619 |
– |
|
| 620 |
– |
if (llflags & LL_ICHAN) |
| 621 |
– |
burst_channel(client_p, chptr); |
| 622 |
– |
else |
| 623 |
– |
continue; /* we can't introduce the unknown chptr, skip */ |
| 624 |
– |
} |
| 625 |
– |
/* check LL client */ |
| 626 |
– |
if (source_p && |
| 627 |
– |
((source_p->lazyLinkClientExists & |
| 628 |
– |
client_p->localClient->serverMask) == 0)) |
| 629 |
– |
{ |
| 630 |
– |
if (llflags & LL_ICLIENT) |
| 631 |
– |
client_burst_if_needed(client_p,source_p); |
| 632 |
– |
else |
| 633 |
– |
continue; /* we can't introduce the unknown source_p, skip */ |
| 634 |
– |
} |
| 635 |
– |
} |
| 588 |
|
send_message(client_p, buffer, len); |
| 589 |
|
} |
| 590 |
|
} |
| 1139 |
|
{ |
| 1140 |
|
va_list args; |
| 1141 |
|
int have_uid = 0; |
| 1142 |
< |
struct Client *client_p; |
| 1191 |
< |
dlink_node *ptr; |
| 1142 |
> |
dlink_node *ptr = NULL; |
| 1143 |
|
char buf_uid[IRCD_BUFSIZE], buf_nick[IRCD_BUFSIZE]; |
| 1144 |
< |
int len_uid = 0, len_nick; |
| 1144 |
> |
int len_uid = 0, len_nick = 0; |
| 1145 |
|
|
| 1146 |
|
if (HasID(source_p) && (me.id[0] != '\0')) |
| 1147 |
|
{ |
| 1161 |
|
|
| 1162 |
|
DLINK_FOREACH(ptr, serv_list.head) |
| 1163 |
|
{ |
| 1164 |
< |
client_p = ptr->data; |
| 1164 |
> |
struct Client *client_p = ptr->data; |
| 1165 |
|
|
| 1166 |
|
if (one != NULL && (client_p == one->from)) |
| 1167 |
|
continue; |
| 1168 |
|
if (IsDefunct(client_p)) |
| 1169 |
|
continue; |
| 1170 |
|
|
| 1171 |
< |
/* XXX perhaps IsCapable should test for localClient itself ? -db */ |
| 1172 |
< |
if (client_p->localClient == NULL || !IsCapable(client_p, CAP_LL) || |
| 1173 |
< |
!ServerInfo.hub || |
| 1174 |
< |
(source_p->lazyLinkClientExists & client_p->localClient->serverMask)) |
| 1224 |
< |
{ |
| 1225 |
< |
if (have_uid && IsCapable(client_p, CAP_TS6)) |
| 1226 |
< |
send_message(client_p, buf_uid, len_uid); |
| 1227 |
< |
else |
| 1228 |
< |
send_message(client_p, buf_nick, len_nick); |
| 1229 |
< |
} |
| 1171 |
> |
if (have_uid && IsCapable(client_p, CAP_TS6)) |
| 1172 |
> |
send_message(client_p, buf_uid, len_uid); |
| 1173 |
> |
else |
| 1174 |
> |
send_message(client_p, buf_nick, len_nick); |
| 1175 |
|
} |
| 1176 |
|
} |