X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fcommon%2Firccap.h;h=3d1e793d122c96dc6080b3f2ad187a6021b0a14c;hb=HEAD;hp=61dac32cfd4f3e00eb5c65e5e6cb88d493d4dbe7;hpb=bd3c5592e03480b17087abe44ae96048e0ab2e74;p=quassel.git diff --git a/src/common/irccap.h b/src/common/irccap.h index 61dac32c..22aa1e64 100644 --- a/src/common/irccap.h +++ b/src/common/irccap.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2022 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef IRCCAP_H -#define IRCCAP_H +#pragma once #include #include @@ -41,6 +40,21 @@ namespace IrcCap { */ const QString ACCOUNT_NOTIFY = "account-notify"; + /** + * Magic number for WHOX, used to ignore user-requested WHOX replies from servers + * + * If a user initiates a WHOX, there's no easy way to tell what fields were requested. It's + * simpler to not attempt to parse data from user-requested WHOX replies. + */ + const uint ACCOUNT_NOTIFY_WHOX_NUM = 369; + + /** + * Send account information as a tag with all commands sent by a user. + * + * http://ircv3.net/specs/extensions/account-notify-3.1.html + */ + const QString ACCOUNT_TAG = "account-tag"; + /** * Away change notification. * @@ -65,6 +79,13 @@ namespace IrcCap { */ const QString CHGHOST = "chghost"; + /** + * Server sending own messages back. + * + * https://ircv3.net/specs/extensions/echo-message-3.2.html + */ + const QString ECHO_MESSAGE = "echo-message"; + /** * Extended join information. * @@ -72,6 +93,20 @@ namespace IrcCap { */ const QString EXTENDED_JOIN = "extended-join"; + /** + * Standardized invite notifications. + * + * https://ircv3.net/specs/extensions/invite-notify-3.2 + */ + const QString INVITE_NOTIFY = "invite-notify"; + + /** + * Additional metadata on a per-message basis + * + * https://ircv3.net/specs/extensions/message-tags + */ + const QString MESSAGE_TAGS = "message-tags"; + /** * Multiple mode prefixes in MODE and WHO replies. * @@ -86,6 +121,13 @@ namespace IrcCap { */ const QString SASL = "sasl"; + /** + * Allows updating realname without reconnecting + * + * https://ircv3.net/specs/extensions/setname + */ + const QString SETNAME = "setname"; + /** * Userhost in names replies. * @@ -93,19 +135,62 @@ namespace IrcCap { */ const QString USERHOST_IN_NAMES = "userhost-in-names"; + /** + * Server time for messages. + * + * https://ircv3.net/specs/extensions/server-time-3.2.html + */ + const QString SERVER_TIME = "server-time"; + + /** + * Vendor-specific capabilities + */ + namespace Vendor { + + /** + * Twitch.tv membership message support + * + * User list in a channel can be quite large and often non required for bot users and is then optional. + * + * From Twitch.tv documentation: + * "Adds membership state event data. By default, we do not send this data to clients without this capability." + * + * https://dev.twitch.tv/docs/v5/guides/irc/#twitch-irc-capability-membership + */ + const QString TWITCH_MEMBERSHIP = "twitch.tv/membership"; + + /** + * Self message support, as recognized by ZNC. + * + * Some servers (e.g. Bitlbee) assume self-message support; ZNC requires a capability + * instead. As self-message is already implemented, there's little reason to not do this. + * + * More information in the IRCv3 commit that removed the 'self-message' capability. + * + * https://github.com/ircv3/ircv3-specifications/commit/1bfba47843c2526707c902034b3395af934713c8 + */ + const QString ZNC_SELF_MESSAGE = "znc.in/self-message"; + } + /** * List of capabilities currently implemented and requested during capability negotiation. */ - const QStringList knownCaps = QStringList { - ACCOUNT_NOTIFY, - AWAY_NOTIFY, - CAP_NOTIFY, - CHGHOST, - EXTENDED_JOIN, - MULTI_PREFIX, - SASL, - USERHOST_IN_NAMES - }; + const QStringList knownCaps = QStringList{ACCOUNT_NOTIFY, + ACCOUNT_TAG, + AWAY_NOTIFY, + CAP_NOTIFY, + CHGHOST, + //ECHO_MESSAGE, // Postponed for message pending UI with batch + labeled-response + EXTENDED_JOIN, + INVITE_NOTIFY, + MESSAGE_TAGS, + MULTI_PREFIX, + SASL, + SETNAME, + USERHOST_IN_NAMES, + SERVER_TIME, + Vendor::TWITCH_MEMBERSHIP, + Vendor::ZNC_SELF_MESSAGE}; // NOTE: If you modify the knownCaps list, update the constants above as needed. /** @@ -114,22 +199,6 @@ namespace IrcCap { * http://ircv3.net/specs/extensions/sasl-3.1.html */ namespace SaslMech { - - /** - * Check if the given authentication mechanism is likely to be supported. - * - * @param[in] saslCapValue QString of SASL capability value, e.g. capValue(IrcCap::SASL) - * @param[in] saslMechanism Desired SASL mechanism - * @return True if mechanism supported or unknown, otherwise false - */ - inline bool maybeSupported(const QString &saslCapValue, const QString &saslMechanism) { return - ((saslCapValue.length() == 0) || (saslCapValue.contains(saslMechanism, Qt::CaseInsensitive))); } - // SASL mechanisms are only specified in capability values as part of SASL 3.2. In - // SASL 3.1, it's handled differently. If we don't know via capability value, assume it's - // supported to reduce the risk of breaking existing setups. - // See: http://ircv3.net/specs/extensions/sasl-3.1.html - // And: http://ircv3.net/specs/extensions/sasl-3.2.html - /** * PLAIN authentication, e.g. hashed password */ @@ -141,5 +210,3 @@ namespace IrcCap { const QString EXTERNAL = "EXTERNAL"; } } - -#endif // IRCCAP_H