diff options
author | Mantas Mikulėnas <grawity@gmail.com> | 2013-04-23 01:09:58 -0400 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-04-23 01:09:58 -0400 |
commit | 5318c953ed446c5844903f6a3de5efad18c6509e (patch) | |
tree | b353b3ff274eacf3e3b23808c7f220ec71f2bb6f | |
parent | 2550a94f05e51808f22a5803c095fd134d4d81a2 (diff) |
reduce abuse of ternary operator
The ?: operator should not be used as a generic shorthand for if/else. (Which isn't needed here either...)
-rw-r--r-- | src/common/proto-irc.c | 15 |
1 files changed, 8 insertions, 7 deletions
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; } |