diff options
-rw-r--r-- | include/s_serv.h | 2 | ||||
-rw-r--r-- | src/s_serv.c | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/include/s_serv.h b/include/s_serv.h index 60c6feb..f761dff 100644 --- a/include/s_serv.h +++ b/include/s_serv.h @@ -92,7 +92,7 @@ extern void send_capabilities(struct Client *, int); extern void write_links_file(void *); extern void read_links_file(void); extern void server_estab(struct Client *); -extern const char *show_capabilities(struct Client *); +extern const char *show_capabilities(const struct Client *); extern void try_connections(void *); extern void burst_channel(struct Client *client_p, struct Channel *); extern void sendnick_TS(struct Client *, struct Client *); diff --git a/src/s_serv.c b/src/s_serv.c index 8594bd2..5f09a09 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -638,23 +638,22 @@ sendnick_TS(struct Client *client_p, struct Client *target_p) * side effects - build up string representing capabilities of server listed */ const char * -show_capabilities(struct Client *target_p) +show_capabilities(const struct Client *target_p) { - static char msgbuf[IRCD_BUFSIZE]; - char *t = msgbuf; - dlink_node *ptr; - - t += sprintf(msgbuf, "TS "); + static char msgbuf[IRCD_BUFSIZE] = "TS"; + const dlink_node *ptr = NULL; DLINK_FOREACH(ptr, cap_list.head) { const struct Capability *cap = ptr->data; - if (IsCapable(target_p, cap->cap)) - t += sprintf(t, "%s ", cap->name); + if (!IsCapable(target_p, cap->cap)) + continue; + + strlcat(msgbuf, " ", sizeof(msgbuf)); + strlcat(msgbuf, cap->name, sizeof(msgbuf)); } - *(t - 1) = '\0'; return msgbuf; } |