From 5318c953ed446c5844903f6a3de5efad18c6509e Mon Sep 17 00:00:00 2001 From: Mantas Mikulėnas Date: Tue, 23 Apr 2013 01:09:58 -0400 Subject: reduce abuse of ternary operator The ?: operator should not be used as a generic shorthand for if/else. (Which isn't needed here either...) --- src/common/proto-irc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/common/proto-irc.c') diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index 7d9b6382..5c803a02 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -1234,36 +1234,37 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[]) want_cap = 0; want_sasl = 0; + strcpy (buffer, "CAP REQ :"); + if (strstr (word_eol[5], "identify-msg") != 0) { - strcpy (buffer, "CAP REQ :identify-msg"); + strcat (buffer, "identify-msg "); want_cap = 1; } if (strstr (word_eol[5], "multi-prefix") != 0) { - want_cap ? strcat (buffer, " multi-prefix") : strcpy (buffer, "CAP REQ :multi-prefix"); + strcat (buffer, "multi-prefix "); want_cap = 1; } if (strstr (word_eol[5], "away-notify") != 0) { - want_cap ? strcat (buffer, " away-notify") : strcpy (buffer, "CAP REQ :away-notify"); + strcat (buffer, "away-notify "); want_cap = 1; } if (strstr (word_eol[5], "account-notify") != 0) { - want_cap ? strcat (buffer, " account-notify") : strcpy (buffer, "CAP REQ :account-notify"); + strcat (buffer, "account-notify "); want_cap = 1; } - if (strstr (word_eol[5], "extended-join") != 0) { - want_cap ? strcat (buffer, " extended-join") : strcpy (buffer, "CAP REQ :extended-join"); + strcat (buffer, "extended-join "); want_cap = 1; } /* if the SASL password is set, request SASL auth */ if (strstr (word_eol[5], "sasl") != 0 && strlen (sess->server->saslpassword) != 0) { - want_cap ? strcat (buffer, " sasl") : strcpy (buffer, "CAP REQ :sasl"); + strcat (buffer, "sasl "); want_cap = 1; want_sasl = 1; } -- cgit 1.4.1