91 |
|
} |
92 |
|
|
93 |
|
/* |
94 |
+ |
* iosend_default - append a packet to the client's sendq. |
95 |
+ |
*/ |
96 |
+ |
void * |
97 |
+ |
iosend_default(va_list args) |
98 |
+ |
{ |
99 |
+ |
struct Client *to = va_arg(args, struct Client *); |
100 |
+ |
int length = va_arg(args, int); |
101 |
+ |
char *buf = va_arg(args, char *); |
102 |
+ |
|
103 |
+ |
dbuf_put(&to->localClient->buf_sendq, buf, length); |
104 |
+ |
return NULL; |
105 |
+ |
} |
106 |
+ |
|
107 |
+ |
/* |
108 |
|
** send_message |
109 |
|
** Internal utility which appends given buffer to the sockets |
110 |
|
** sendq. |
112 |
|
static void |
113 |
|
send_message(struct Client *to, char *buf, int len) |
114 |
|
{ |
115 |
< |
#ifdef INVARIANTS |
116 |
< |
if (IsMe(to)) |
103 |
< |
{ |
104 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, |
105 |
< |
"Trying to send message to myself!"); |
106 |
< |
return; |
107 |
< |
} |
108 |
< |
#endif |
115 |
> |
assert(!IsMe(to)) |
116 |
> |
assert(to != &me); |
117 |
|
|
118 |
|
if (dbuf_length(&to->localClient->buf_sendq) + len > get_sendq(to)) |
119 |
|
{ |
129 |
|
return; |
130 |
|
} |
131 |
|
|
132 |
< |
dbuf_put(&to->localClient->buf_sendq, buf, len); |
132 |
> |
execute_callback(iosend_cb, to, len, buf); |
133 |
|
|
134 |
|
/* |
135 |
|
** Update statistics. The following is slightly incorrect |
289 |
|
errno = EWOULDBLOCK; |
290 |
|
case SSL_ERROR_SYSCALL: |
291 |
|
break; |
292 |
< |
|
292 |
> |
case SSL_ERROR_SSL: |
293 |
> |
if (errno == EAGAIN) |
294 |
> |
break; |
295 |
|
default: |
296 |
|
retlen = errno = 0; /* either an SSL-specific error or EOF */ |
297 |
|
} |
308 |
|
break; |
309 |
|
} |
310 |
|
|
301 |
– |
execute_callback(iosend_cb, to, retlen, first->data); |
311 |
|
dbuf_delete(&to->localClient->buf_sendq, retlen); |
312 |
|
|
313 |
|
/* We have some data written .. update counters */ |
469 |
|
struct Channel *chptr, const char *command, |
470 |
|
const char *pattern, ...) |
471 |
|
{ |
472 |
< |
va_list args; |
472 |
> |
va_list alocal, aremote, auid; |
473 |
|
char local_buf[IRCD_BUFSIZE]; |
474 |
|
char remote_buf[IRCD_BUFSIZE]; |
475 |
|
char uid_buf[IRCD_BUFSIZE]; |
490 |
|
uid_len = ircsprintf(uid_buf, ":%s %s %s ", |
491 |
|
ID(from), command, chptr->chname); |
492 |
|
|
493 |
< |
va_start(args, pattern); |
493 |
> |
va_start(alocal, pattern); |
494 |
> |
va_start(aremote, pattern); |
495 |
> |
va_start(auid, pattern); |
496 |
|
local_len += send_format(&local_buf[local_len], IRCD_BUFSIZE - local_len, |
497 |
< |
pattern, args); |
497 |
> |
pattern, alocal); |
498 |
|
remote_len += send_format(&remote_buf[remote_len], IRCD_BUFSIZE - remote_len, |
499 |
< |
pattern, args); |
499 |
> |
pattern, aremote); |
500 |
|
uid_len += send_format(&uid_buf[uid_len], IRCD_BUFSIZE - uid_len, pattern, |
501 |
< |
args); |
502 |
< |
va_end(args); |
501 |
> |
auid); |
502 |
> |
va_end(auid); |
503 |
> |
va_end(aremote); |
504 |
> |
va_end(alocal); |
505 |
|
|
506 |
|
++current_serial; |
507 |
|
|
798 |
|
len = send_format(buffer, IRCD_BUFSIZE, pattern, args); |
799 |
|
va_end(args); |
800 |
|
|
801 |
+ |
++current_serial; |
802 |
+ |
|
803 |
|
DLINK_FOREACH(ptr, chptr->members.head) |
804 |
|
{ |
805 |
|
ms = ptr->data; |
816 |
|
((target_p->from->localClient->caps & caps) != caps) || |
817 |
|
((target_p->from->localClient->caps & nocaps) != 0)) |
818 |
|
continue; |
819 |
< |
|
820 |
< |
send_message(target_p, buffer, len); |
819 |
> |
if (target_p->from->serial != current_serial) |
820 |
> |
{ |
821 |
> |
send_message(target_p, buffer, len); |
822 |
> |
target_p->from->serial = current_serial; |
823 |
> |
} |
824 |
|
} |
825 |
|
} |
826 |
|
|
861 |
|
sendto_match_butone(struct Client *one, struct Client *from, char *mask, |
862 |
|
int what, const char *pattern, ...) |
863 |
|
{ |
864 |
< |
va_list args; |
864 |
> |
va_list alocal, aremote; |
865 |
|
struct Client *client_p; |
866 |
|
dlink_node *ptr, *ptr_next; |
867 |
|
char local_buf[IRCD_BUFSIZE], remote_buf[IRCD_BUFSIZE]; |
869 |
|
from->username, from->host); |
870 |
|
int remote_len = ircsprintf(remote_buf, ":%s ", from->name); |
871 |
|
|
872 |
< |
va_start(args, pattern); |
872 |
> |
va_start(alocal, pattern); |
873 |
> |
va_start(aremote, pattern); |
874 |
|
local_len += send_format(&local_buf[local_len], IRCD_BUFSIZE - local_len, |
875 |
< |
pattern, args); |
875 |
> |
pattern, alocal); |
876 |
|
remote_len += send_format(&remote_buf[remote_len], IRCD_BUFSIZE - remote_len, |
877 |
< |
pattern, args); |
878 |
< |
va_end(args); |
877 |
> |
pattern, aremote); |
878 |
> |
va_end(aremote); |
879 |
> |
va_end(alocal); |
880 |
|
|
881 |
|
/* scan the local clients */ |
882 |
|
DLINK_FOREACH(ptr, local_client_list.head) |
1190 |
|
char buf_uid[IRCD_BUFSIZE], buf_nick[IRCD_BUFSIZE]; |
1191 |
|
int len_uid = 0, len_nick; |
1192 |
|
|
1173 |
– |
va_start(args, pattern); |
1193 |
|
if (HasID(source_p) && (me.id[0] != '\0')) |
1194 |
|
{ |
1195 |
|
have_uid = 1; |
1196 |
+ |
va_start(args, pattern); |
1197 |
|
len_uid = ircsprintf(buf_uid, ":%s KILL %s :", me.id, ID(source_p)); |
1198 |
|
len_uid += send_format(&buf_uid[len_uid], IRCD_BUFSIZE - len_uid, pattern, |
1199 |
|
args); |
1200 |
+ |
va_end(args); |
1201 |
|
} |
1202 |
+ |
|
1203 |
+ |
va_start(args, pattern); |
1204 |
|
len_nick = ircsprintf(buf_nick, ":%s KILL %s :", me.name, source_p->name); |
1205 |
|
len_nick += send_format(&buf_nick[len_nick], IRCD_BUFSIZE - len_nick, pattern, |
1206 |
|
args); |