1 /***************************************************************************
2 * Copyright (C) 2005-2020 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 ***************************************************************************/
23 #include "common-export.h"
31 class COMMON_EXPORT CtcpEvent : public IrcEvent
40 explicit CtcpEvent(EventManager::EventType type,
42 QHash<IrcTagKey, QString> tags,
48 const QDateTime& timestamp = QDateTime(),
49 const QUuid& uuid = QUuid())
50 : IrcEvent(type, network, std::move(tags), std::move(prefix))
52 , _ctcpCmd(std::move(ctcpCmd))
53 , _target(std::move(target))
54 , _param(std::move(param))
57 setTimestamp(timestamp);
60 inline CtcpType ctcpType() const { return _ctcpType; }
61 inline void setCtcpType(CtcpType type) { _ctcpType = type; }
63 inline QString ctcpCmd() const { return _ctcpCmd; }
64 inline void setCtcpCmd(const QString& ctcpCmd) { _ctcpCmd = ctcpCmd; }
66 inline QString target() const { return _target; }
67 inline void setTarget(const QString& target) { _target = target; }
69 inline QString param() const { return _param; }
70 inline void setParam(const QString& param) { _param = param; }
72 inline QString reply() const { return _reply; }
73 inline void setReply(const QString& reply) { _reply = reply; }
75 inline QUuid uuid() const { return _uuid; }
76 inline void setUuid(const QUuid& uuid) { _uuid = uuid; }
78 static Event* create(EventManager::EventType type, QVariantMap& map, Network* network);
81 explicit CtcpEvent(EventManager::EventType type, QVariantMap& map, Network* network);
82 void toVariantMap(QVariantMap& map) const override;
84 inline QString className() const override { return "CtcpEvent"; }
85 inline void debugInfo(QDebug& dbg) const override
87 NetworkEvent::debugInfo(dbg);
88 dbg << ", prefix = " << qPrintable(prefix())
89 << ", target = " << qPrintable(target())
90 << ", ctcptype = " << (ctcpType() == Query ? "query" : "reply")
91 << ", cmd = " << qPrintable(ctcpCmd())
92 << ", param = " << qPrintable(param())
93 << ", reply = " << qPrintable(reply());
99 QString _target, _param, _reply;