cmake: avoid de-duplication of user's CXXFLAGS
[quassel.git] / src / common / irccap.h
1 /***************************************************************************
2  *   Copyright (C) 2005-2022 by the Quassel Project                        *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
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.                                           *
9  *                                                                         *
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.                          *
14  *                                                                         *
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  ***************************************************************************/
20
21 #pragma once
22
23 #include <QString>
24 #include <QStringList>
25
26 // Why a namespace instead of a class?  Seems to be a better fit for C++ than a 'static' class, as
27 // compared to C# or Java.  However, feel free to change if needed.
28 // See https://stackoverflow.com/questions/482745/namespaces-for-enum-types-best-practices
29 /**
30  * IRCv3 capability names and values
31  */
32 namespace IrcCap {
33
34     // NOTE: If you add or modify the constants below, update the knownCaps list.
35
36     /**
37      * Account change notification.
38      *
39      * http://ircv3.net/specs/extensions/account-notify-3.1.html
40      */
41     const QString ACCOUNT_NOTIFY = "account-notify";
42
43     /**
44      * Magic number for WHOX, used to ignore user-requested WHOX replies from servers
45      *
46      * If a user initiates a WHOX, there's no easy way to tell what fields were requested.  It's
47      * simpler to not attempt to parse data from user-requested WHOX replies.
48      */
49     const uint ACCOUNT_NOTIFY_WHOX_NUM = 369;
50
51     /**
52      * Send account information as a tag with all commands sent by a user.
53      *
54      * http://ircv3.net/specs/extensions/account-notify-3.1.html
55      */
56     const QString ACCOUNT_TAG = "account-tag";
57
58     /**
59      * Away change notification.
60      *
61      * http://ircv3.net/specs/extensions/away-notify-3.1.html
62      */
63     const QString AWAY_NOTIFY = "away-notify";
64
65     /**
66      * Capability added/removed notification.
67      *
68      * This is implicitly enabled via CAP LS 302, and is here for servers that only partially
69      * support IRCv3.2.
70      *
71      * http://ircv3.net/specs/extensions/cap-notify-3.2.html
72      */
73     const QString CAP_NOTIFY = "cap-notify";
74
75     /**
76      * Hostname/user changed notification.
77      *
78      * http://ircv3.net/specs/extensions/chghost-3.2.html
79      */
80     const QString CHGHOST = "chghost";
81
82     /**
83      * Server sending own messages back.
84      *
85      * https://ircv3.net/specs/extensions/echo-message-3.2.html
86      */
87     const QString ECHO_MESSAGE = "echo-message";
88
89     /**
90      * Extended join information.
91      *
92      * http://ircv3.net/specs/extensions/extended-join-3.1.html
93      */
94     const QString EXTENDED_JOIN = "extended-join";
95
96     /**
97      * Standardized invite notifications.
98      *
99      * https://ircv3.net/specs/extensions/invite-notify-3.2
100      */
101     const QString INVITE_NOTIFY = "invite-notify";
102
103     /**
104      * Additional metadata on a per-message basis
105      *
106      * https://ircv3.net/specs/extensions/message-tags
107      */
108     const QString MESSAGE_TAGS = "message-tags";
109
110     /**
111      * Multiple mode prefixes in MODE and WHO replies.
112      *
113      * http://ircv3.net/specs/extensions/multi-prefix-3.1.html
114      */
115     const QString MULTI_PREFIX = "multi-prefix";
116
117     /**
118      * SASL authentication.
119      *
120      * http://ircv3.net/specs/extensions/sasl-3.2.html
121      */
122     const QString SASL = "sasl";
123
124     /**
125      * Allows updating realname without reconnecting
126      *
127      * https://ircv3.net/specs/extensions/setname
128      */
129     const QString SETNAME = "setname";
130
131     /**
132      * Userhost in names replies.
133      *
134      * http://ircv3.net/specs/extensions/userhost-in-names-3.2.html
135      */
136     const QString USERHOST_IN_NAMES = "userhost-in-names";
137
138     /**
139      * Server time for messages.
140      *
141      * https://ircv3.net/specs/extensions/server-time-3.2.html
142      */
143     const QString SERVER_TIME = "server-time";
144
145     /**
146      * Vendor-specific capabilities
147      */
148     namespace Vendor {
149
150         /**
151          * Twitch.tv membership message support
152          *
153          * User list in a channel can be quite large and often non required for bot users and is then optional.
154          *
155          * From Twitch.tv documentation:
156          * "Adds membership state event data. By default, we do not send this data to clients without this capability."
157          *
158          * https://dev.twitch.tv/docs/v5/guides/irc/#twitch-irc-capability-membership
159          */
160         const QString TWITCH_MEMBERSHIP = "twitch.tv/membership";
161
162         /**
163          * Self message support, as recognized by ZNC.
164          *
165          * Some servers (e.g. Bitlbee) assume self-message support; ZNC requires a capability
166          * instead.  As self-message is already implemented, there's little reason to not do this.
167          *
168          * More information in the IRCv3 commit that removed the 'self-message' capability.
169          *
170          * https://github.com/ircv3/ircv3-specifications/commit/1bfba47843c2526707c902034b3395af934713c8
171          */
172         const QString ZNC_SELF_MESSAGE = "znc.in/self-message";
173     }
174
175     /**
176      * List of capabilities currently implemented and requested during capability negotiation.
177      */
178     const QStringList knownCaps = QStringList{ACCOUNT_NOTIFY,
179                                               ACCOUNT_TAG,
180                                               AWAY_NOTIFY,
181                                               CAP_NOTIFY,
182                                               CHGHOST,
183                                               //ECHO_MESSAGE, // Postponed for message pending UI with batch + labeled-response
184                                               EXTENDED_JOIN,
185                                               INVITE_NOTIFY,
186                                               MESSAGE_TAGS,
187                                               MULTI_PREFIX,
188                                               SASL,
189                                               SETNAME,
190                                               USERHOST_IN_NAMES,
191                                               SERVER_TIME,
192                                               Vendor::TWITCH_MEMBERSHIP,
193                                               Vendor::ZNC_SELF_MESSAGE};
194     // NOTE: If you modify the knownCaps list, update the constants above as needed.
195
196     /**
197      * SASL authentication mechanisms
198      *
199      * http://ircv3.net/specs/extensions/sasl-3.1.html
200      */
201     namespace SaslMech {
202         /**
203          * PLAIN authentication, e.g. hashed password
204          */
205         const QString PLAIN = "PLAIN";
206
207         /**
208          * EXTERNAL authentication, e.g. SSL certificate and keys
209          */
210         const QString EXTERNAL = "EXTERNAL";
211     }
212 }