2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2017 Peter Powell <petpow@saberuk.com>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 /** Whether message was a PRIVMSG or a NOTICE. */
25 /** The message is a PRIVMSG. */
28 /** The message is a NOTICE. */
32 class CoreExport MessageDetails
35 /** Whether to echo the message at all. */
38 /* Whether to send the original message back to clients with echo-message support. */
41 /** The users who are exempted from receiving this message. */
44 /* The original message as sent by the user. */
45 const std::string original_text;
47 /** IRCv3 message tags sent to the server by the user. */
48 const ClientProtocol::TagMap tags_in;
50 /** IRCv3 message tags sent out to users who get this message. */
51 ClientProtocol::TagMap tags_out;
53 /** The message which will be sent to clients. */
56 /** The type of message. */
57 const MessageType type;
59 /** Determines whether the specified message is a CTCP. If the specified message
60 * is a CTCP then the CTCP name and CTCP body are extracted and stored in the
61 * name and body references.
62 * @param name The location to store the parsed CTCP name.
63 * @param body The location to store the parsed CTCP body.
65 virtual bool IsCTCP(std::string& name, std::string& body) const = 0;
67 /** Determines whether the specified message is a CTCP. If the specified message
68 * is a CTCP then the CTCP name is extracted and stored in the name reference.
69 * @param name The location to store the parsed CTCP name.
71 virtual bool IsCTCP(std::string& name) const = 0;
73 /** Determines whether the specified message is a CTCP. */
74 virtual bool IsCTCP() const = 0;
77 MessageDetails(MessageType mt, const std::string& msg, const ClientProtocol::TagMap& tags)
79 , echo_original(false)
88 /** Represents the target of a message (NOTICE, PRIVMSG, etc). */
89 class CoreExport MessageTarget
92 /** An enumeration of possible message target types. */
95 /** The target of the message is a user. */
98 /** The target of the message is a channel. */
101 /** The target of the message is a server. */
106 /** The target of the message. */
110 /** If type is TYPE_CHANNEL and the user specified a status rank. */
113 /** The type of the target of the message. If this is TYPE_CHANNEL then dest
114 * is a Channel*, TYPE_USER then dest is a User*, and TYPE_SERVER then dest is
115 * a std::string* containing a server glob.
117 MessageTarget::TargetType type;
119 /** Initialises a new channel message target.
120 * @param channel The channel which is the target of the message.
121 * @param statuschar The lowest status rank that the message is being sent to.
123 MessageTarget(Channel* channel, char statuschar)
130 /** Initialises a new user message target.
131 * @param user The user which is the target of the message.
133 MessageTarget(User* user)
140 /** Initialises a new server message target.
141 * @param server The server glob which is the target of the message.
143 MessageTarget(std::string* server)
150 /** Retrieves the target of this message. */
154 return static_cast<T*>(dest);