| 44 |
|
#include "irc_getnameinfo.h" |
| 45 |
|
#include "packet.h" |
| 46 |
|
|
| 47 |
– |
#define LOG_BUFSIZE 2048 |
| 47 |
|
|
| 48 |
|
struct Callback *iosend_cb = NULL; |
| 49 |
|
struct Callback *iosendctrl_cb = NULL; |
| 51 |
– |
|
| 52 |
– |
static void send_message(struct Client *, char *, int); |
| 53 |
– |
static void send_message_remote(struct Client *, struct Client *, char *, int); |
| 54 |
– |
|
| 50 |
|
static unsigned int current_serial = 0; |
| 51 |
|
|
| 52 |
+ |
|
| 53 |
|
/* send_format() |
| 54 |
|
* |
| 55 |
|
* inputs - buffer to format into |
| 82 |
|
|
| 83 |
|
lsendbuf[len++] = '\r'; |
| 84 |
|
lsendbuf[len++] = '\n'; |
| 85 |
< |
return (len); |
| 85 |
> |
return len; |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
/* |
| 457 |
|
char remote_buf[IRCD_BUFSIZE]; |
| 458 |
|
char uid_buf[IRCD_BUFSIZE]; |
| 459 |
|
int local_len, remote_len, uid_len; |
| 460 |
< |
dlink_node *ptr; |
| 465 |
< |
dlink_node *ptr_next; |
| 466 |
< |
struct Client *target_p; |
| 460 |
> |
dlink_node *ptr = NULL, *ptr_next = NULL; |
| 461 |
|
|
| 462 |
|
if (IsServer(from)) |
| 463 |
|
local_len = ircsprintf(local_buf, ":%s %s %s ", |
| 488 |
|
|
| 489 |
|
DLINK_FOREACH_SAFE(ptr, ptr_next, chptr->members.head) |
| 490 |
|
{ |
| 491 |
< |
target_p = ((struct Membership *)ptr->data)->client_p; |
| 492 |
< |
assert(target_p != NULL); |
| 491 |
> |
struct Client *target_p = ((struct Membership *)ptr->data)->client_p; |
| 492 |
> |
|
| 493 |
> |
assert(IsClient(target_p)); |
| 494 |
|
|
| 495 |
|
if (IsDefunct(target_p) || IsDeaf(target_p) || target_p->from == one) |
| 496 |
|
continue; |
| 497 |
|
|
| 498 |
< |
if (MyClient(target_p)) |
| 498 |
> |
if (MyConnect(target_p)) |
| 499 |
|
{ |
| 500 |
< |
if (target_p->serial != current_serial) |
| 500 |
> |
if (target_p->localClient->serial != current_serial) |
| 501 |
|
{ |
| 502 |
|
send_message(target_p, local_buf, local_len); |
| 503 |
< |
target_p->serial = current_serial; |
| 503 |
> |
target_p->localClient->serial = current_serial; |
| 504 |
|
} |
| 505 |
|
} |
| 506 |
|
else |
| 508 |
|
/* Now check whether a message has been sent to this |
| 509 |
|
* remote link already |
| 510 |
|
*/ |
| 511 |
< |
if (target_p->from->serial != current_serial) |
| 511 |
> |
if (target_p->from->localClient->serial != current_serial) |
| 512 |
|
{ |
| 513 |
|
if (IsCapable(target_p->from, CAP_TS6)) |
| 514 |
|
send_message_remote(target_p->from, from, uid_buf, uid_len); |
| 515 |
|
else |
| 516 |
|
send_message_remote(target_p->from, from, remote_buf, remote_len); |
| 517 |
< |
target_p->from->serial = current_serial; |
| 517 |
> |
target_p->from->localClient->serial = current_serial; |
| 518 |
|
} |
| 519 |
|
} |
| 520 |
|
} |
| 617 |
|
assert(target_p != NULL); |
| 618 |
|
|
| 619 |
|
if (!MyConnect(target_p) || target_p == user || IsDefunct(target_p) || |
| 620 |
< |
target_p->serial == current_serial) |
| 620 |
> |
target_p->localClient->serial == current_serial) |
| 621 |
|
continue; |
| 622 |
|
|
| 623 |
< |
target_p->serial = current_serial; |
| 623 |
> |
target_p->localClient->serial = current_serial; |
| 624 |
|
send_message(target_p, buffer, len); |
| 625 |
|
} |
| 626 |
|
} |
| 627 |
|
|
| 628 |
|
if (touser && MyConnect(user) && !IsDead(user) && |
| 629 |
< |
user->serial != current_serial) |
| 629 |
> |
user->localClient->serial != current_serial) |
| 630 |
|
send_message(user, buffer, len); |
| 631 |
|
} |
| 632 |
|
|
| 759 |
|
((target_p->from->localClient->caps & caps) != caps) || |
| 760 |
|
((target_p->from->localClient->caps & nocaps) != 0)) |
| 761 |
|
continue; |
| 762 |
< |
if (target_p->from->serial != current_serial) |
| 762 |
> |
if (target_p->from->localClient->serial != current_serial) |
| 763 |
|
{ |
| 764 |
|
send_message(target_p, buffer, len); |
| 765 |
< |
target_p->from->serial = current_serial; |
| 765 |
> |
target_p->from->localClient->serial = current_serial; |
| 766 |
|
} |
| 767 |
|
} |
| 768 |
|
} |
| 788 |
|
match_it(const struct Client *one, const char *mask, int what) |
| 789 |
|
{ |
| 790 |
|
if (what == MATCH_HOST) |
| 791 |
< |
return(match(mask, one->host)); |
| 791 |
> |
return match(mask, one->host); |
| 792 |
|
|
| 793 |
< |
return(match(mask, one->servptr->name)); |
| 793 |
> |
return match(mask, one->servptr->name); |
| 794 |
|
} |
| 795 |
|
|
| 796 |
|
/* sendto_match_butone() |
| 898 |
|
if (IsMe(target_p) || target_p->from == source_p->from) |
| 899 |
|
continue; |
| 900 |
|
|
| 901 |
< |
if (target_p->from->serial == current_serial) |
| 901 |
> |
if (target_p->from->localClient->serial == current_serial) |
| 902 |
|
continue; |
| 903 |
|
|
| 904 |
|
if (match(mask, target_p->name)) |
| 907 |
|
* if we set the serial here, then we'll never do a |
| 908 |
|
* match() again, if !IsCapable() |
| 909 |
|
*/ |
| 910 |
< |
target_p->from->serial = current_serial; |
| 910 |
> |
target_p->from->localClient->serial = current_serial; |
| 911 |
|
found++; |
| 912 |
|
|
| 913 |
|
if (!IsCapable(target_p->from, cap)) |
| 975 |
|
void |
| 976 |
|
sendto_realops_flags(unsigned int flags, int level, const char *pattern, ...) |
| 977 |
|
{ |
| 978 |
< |
struct Client *client_p; |
| 978 |
> |
dlink_node *ptr = NULL; |
| 979 |
|
char nbuf[IRCD_BUFSIZE]; |
| 985 |
– |
dlink_node *ptr; |
| 980 |
|
va_list args; |
| 981 |
|
|
| 982 |
|
va_start(args, pattern); |
| 985 |
|
|
| 986 |
|
DLINK_FOREACH(ptr, oper_list.head) |
| 987 |
|
{ |
| 988 |
< |
client_p = ptr->data; |
| 988 |
> |
struct Client *client_p = ptr->data; |
| 989 |
|
assert(client_p->umodes & UMODE_OPER); |
| 990 |
|
|
| 991 |
|
/* If we're sending it to opers and theyre an admin, skip. |
| 1013 |
|
sendto_wallops_flags(unsigned int flags, struct Client *source_p, |
| 1014 |
|
const char *pattern, ...) |
| 1015 |
|
{ |
| 1016 |
< |
struct Client *client_p; |
| 1023 |
< |
dlink_node *ptr; |
| 1016 |
> |
dlink_node *ptr = NULL; |
| 1017 |
|
va_list args; |
| 1018 |
|
char buffer[IRCD_BUFSIZE]; |
| 1019 |
|
int len; |
| 1030 |
|
|
| 1031 |
|
DLINK_FOREACH(ptr, oper_list.head) |
| 1032 |
|
{ |
| 1033 |
< |
client_p = ptr->data; |
| 1033 |
> |
struct Client *client_p = ptr->data; |
| 1034 |
|
assert(client_p->umodes & UMODE_OPER); |
| 1035 |
|
|
| 1036 |
|
if ((client_p->umodes & flags) && !IsDefunct(client_p)) |
| 1049 |
|
ts_warn(const char *pattern, ...) |
| 1050 |
|
{ |
| 1051 |
|
va_list args; |
| 1052 |
< |
char buffer[LOG_BUFSIZE]; |
| 1052 |
> |
char buffer[IRCD_BUFSIZE]; |
| 1053 |
|
static time_t last = 0; |
| 1054 |
|
static int warnings = 0; |
| 1055 |
|
|