mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
send: obviously we can't just reuse a va_list, duh
This commit is contained in:
parent
667fb62eec
commit
c8c3ac2440
1 changed files with 6 additions and 5 deletions
11
ircd/send.c
11
ircd/send.c
|
@ -497,6 +497,7 @@ void
|
|||
sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
||||
struct Channel *chptr, const char *pattern, ...)
|
||||
{
|
||||
char buf[IRCD_BUFSIZE];
|
||||
va_list args;
|
||||
buf_head_t rb_linebuf_local;
|
||||
buf_head_t rb_linebuf_id;
|
||||
|
@ -515,9 +516,11 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
|||
build_msgbuf_from(&msgbuf, source_p, NULL);
|
||||
|
||||
va_start(args, pattern);
|
||||
vsnprintf(buf, sizeof buf, pattern, args);
|
||||
va_end(args);
|
||||
|
||||
linebuf_put_msgvbuf(&msgbuf, &rb_linebuf_local, NOCAPS, pattern, &args);
|
||||
rb_linebuf_putmsg(&rb_linebuf_id, pattern, &args, ":%s ", use_id(source_p));
|
||||
linebuf_put_msgbuf(&msgbuf, &rb_linebuf_local, NOCAPS, "%s", buf);
|
||||
rb_linebuf_putmsg(&rb_linebuf_id, NULL, NULL, ":%s %s", use_id(source_p), buf);
|
||||
|
||||
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head)
|
||||
{
|
||||
|
@ -556,7 +559,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
|||
rb_linebuf_newbuf(&rb_linebuf_local);
|
||||
|
||||
/* render the new linebuf and attach it */
|
||||
linebuf_put_msgvbuf(&msgbuf, &rb_linebuf_local, target_p->localClient->caps, pattern, &args);
|
||||
linebuf_put_msgbuf(&msgbuf, &rb_linebuf_local, target_p->localClient->caps, "%s", buf);
|
||||
current_capmask = target_p->localClient->caps;
|
||||
}
|
||||
|
||||
|
@ -564,8 +567,6 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
|||
}
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
rb_linebuf_donebuf(&rb_linebuf_local);
|
||||
rb_linebuf_donebuf(&rb_linebuf_id);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue