send: implement tags support for sendto_channel_flags() too
This commit is contained in:
parent
adaa9ba989
commit
667fb62eec
1 changed files with 21 additions and 13 deletions
34
ircd/send.c
34
ircd/send.c
|
@ -497,7 +497,6 @@ void
|
||||||
sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
||||||
struct Channel *chptr, const char *pattern, ...)
|
struct Channel *chptr, const char *pattern, ...)
|
||||||
{
|
{
|
||||||
static char buf[BUFSIZE];
|
|
||||||
va_list args;
|
va_list args;
|
||||||
buf_head_t rb_linebuf_local;
|
buf_head_t rb_linebuf_local;
|
||||||
buf_head_t rb_linebuf_id;
|
buf_head_t rb_linebuf_id;
|
||||||
|
@ -505,26 +504,20 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
||||||
struct membership *msptr;
|
struct membership *msptr;
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
rb_dlink_node *next_ptr;
|
rb_dlink_node *next_ptr;
|
||||||
|
unsigned int current_capmask = 0;
|
||||||
|
struct MsgBuf msgbuf;
|
||||||
|
|
||||||
rb_linebuf_newbuf(&rb_linebuf_local);
|
rb_linebuf_newbuf(&rb_linebuf_local);
|
||||||
rb_linebuf_newbuf(&rb_linebuf_id);
|
rb_linebuf_newbuf(&rb_linebuf_id);
|
||||||
|
|
||||||
current_serial++;
|
current_serial++;
|
||||||
|
|
||||||
|
build_msgbuf_from(&msgbuf, source_p, NULL);
|
||||||
|
|
||||||
va_start(args, pattern);
|
va_start(args, pattern);
|
||||||
vsnprintf(buf, sizeof(buf), pattern, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
if(IsServer(source_p))
|
linebuf_put_msgvbuf(&msgbuf, &rb_linebuf_local, NOCAPS, pattern, &args);
|
||||||
rb_linebuf_putmsg(&rb_linebuf_local, NULL, NULL,
|
rb_linebuf_putmsg(&rb_linebuf_id, pattern, &args, ":%s ", use_id(source_p));
|
||||||
":%s %s", source_p->name, buf);
|
|
||||||
else
|
|
||||||
rb_linebuf_putmsg(&rb_linebuf_local, NULL, NULL,
|
|
||||||
":%s!%s@%s %s",
|
|
||||||
source_p->name, source_p->username,
|
|
||||||
source_p->host, 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)
|
RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->members.head)
|
||||||
{
|
{
|
||||||
|
@ -555,9 +548,24 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (target_p->localClient->caps != current_capmask)
|
||||||
|
{
|
||||||
|
/* reset the linebuf */
|
||||||
|
rb_linebuf_donebuf(&rb_linebuf_local);
|
||||||
|
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);
|
||||||
|
current_capmask = target_p->localClient->caps;
|
||||||
|
}
|
||||||
|
|
||||||
_send_linebuf(target_p, &rb_linebuf_local);
|
_send_linebuf(target_p, &rb_linebuf_local);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
rb_linebuf_donebuf(&rb_linebuf_local);
|
rb_linebuf_donebuf(&rb_linebuf_local);
|
||||||
rb_linebuf_donebuf(&rb_linebuf_id);
|
rb_linebuf_donebuf(&rb_linebuf_id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue