1 /***************************************************************************
2 * Copyright (C) 2005-2016 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
25 #include <QStringList>
27 // Why a namespace instead of a class? Seems to be a better fit for C++ than a 'static' class, as
28 // compared to C# or Java. However, feel free to change if needed.
29 // See https://stackoverflow.com/questions/482745/namespaces-for-enum-types-best-practices
31 * IRCv3 capability names and values
35 // NOTE: If you add or modify the constants below, update the knownCaps list.
38 * Account change notification.
40 * http://ircv3.net/specs/extensions/account-notify-3.1.html
42 const QString ACCOUNT_NOTIFY = "account-notify";
45 * Away change notification.
47 * http://ircv3.net/specs/extensions/away-notify-3.1.html
49 const QString AWAY_NOTIFY = "away-notify";
52 * Capability added/removed notification.
54 * This is implicitly enabled via CAP LS 302, and is here for servers that only partially
57 * http://ircv3.net/specs/extensions/cap-notify-3.2.html
59 const QString CAP_NOTIFY = "cap-notify";
62 * Extended join information.
64 * http://ircv3.net/specs/extensions/extended-join-3.1.html
66 const QString EXTENDED_JOIN = "extended-join";
69 * Multiple mode prefixes in MODE and WHO replies.
71 * http://ircv3.net/specs/extensions/multi-prefix-3.1.html
73 const QString MULTI_PREFIX = "multi-prefix";
76 * SASL authentication.
78 * http://ircv3.net/specs/extensions/sasl-3.2.html
80 const QString SASL = "sasl";
83 * Userhost in names replies.
85 * http://ircv3.net/specs/extensions/userhost-in-names-3.2.html
87 const QString USERHOST_IN_NAMES = "userhost-in-names";
90 * List of capabilities currently implemented and requested during capability negotiation.
92 const QStringList knownCaps = QStringList {
101 // NOTE: If you modify the knownCaps list, update the constants above as needed.
104 * SASL authentication mechanisms
106 * http://ircv3.net/specs/extensions/sasl-3.1.html
111 * Check if the given authentication mechanism is likely to be supported.
113 * @param[in] saslCapValue QString of SASL capability value, e.g. capValue(IrcCap::SASL)
114 * @param[in] saslMechanism Desired SASL mechanism
115 * @return True if mechanism supported or unknown, otherwise false
117 inline bool maybeSupported(const QString &saslCapValue, const QString &saslMechanism) { return
118 ((saslCapValue.length() == 0) || (saslCapValue.contains(saslMechanism, Qt::CaseInsensitive))); }
119 // SASL mechanisms are only specified in capability values as part of SASL 3.2. In
120 // SASL 3.1, it's handled differently. If we don't know via capability value, assume it's
121 // supported to reduce the risk of breaking existing setups.
122 // See: http://ircv3.net/specs/extensions/sasl-3.1.html
123 // And: http://ircv3.net/specs/extensions/sasl-3.2.html
126 * PLAIN authentication, e.g. hashed password
128 const QString PLAIN = "PLAIN";
131 * EXTERNAL authentication, e.g. SSL certificate and keys
133 const QString EXTERNAL = "EXTERNAL";