diff options
-rw-r--r-- | src/channel_mode.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/channel_mode.c b/src/channel_mode.c index 3aa6343..1df04a0 100644 --- a/src/channel_mode.c +++ b/src/channel_mode.c @@ -301,24 +301,24 @@ const struct mode_letter chan_modes[] = * chptr onto buffer mbuf with the parameters in pbuf. */ void -channel_modes(struct Channel *chptr, struct Client *client_p, char *mbuf, char *pbuf) +channel_modes(struct Channel *chptr, struct Client *client_p, + char *mbuf, char *pbuf) { - int previous_mode = 0; + const struct mode_letter *tab = chan_modes; *mbuf++ = '+'; *pbuf = '\0'; - for (const struct mode_letter *tab = chan_modes; tab->mode; ++tab) + for (; tab->mode; ++tab) if (chptr->mode.mode & tab->mode) *mbuf++ = tab->letter; if (chptr->mode.limit) { - previous_mode = 1; *mbuf++ = 'l'; if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr)) - sprintf(pbuf, "%u", chptr->mode.limit); + pbuf += sprintf(pbuf, "%d ", chptr->mode.limit); } if (chptr->mode.key[0]) @@ -326,11 +326,7 @@ channel_modes(struct Channel *chptr, struct Client *client_p, char *mbuf, char * *mbuf++ = 'k'; if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr)) - { - if (previous_mode) - strcat(pbuf, " "); - strcat(pbuf, chptr->mode.key); - } + sprintf(pbuf, "%s ", chptr->mode.key); } *mbuf = '\0'; |