1 /***************************************************************************
2 * Copyright (C) 2005-2019 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 const QString& prefix,
47 const QDateTime& timestamp = QDateTime(),
48 const QUuid& uuid = QUuid())
49 : IrcEvent(type, network, prefix)
51 , _ctcpCmd(std::move(ctcpCmd))
52 , _target(std::move(target))
53 , _param(std::move(param))
56 setTimestamp(timestamp);
59 inline CtcpType ctcpType() const { return _ctcpType; }
60 inline void setCtcpType(CtcpType type) { _ctcpType = type; }
62 inline QString ctcpCmd() const { return _ctcpCmd; }
63 inline void setCtcpCmd(const QString& ctcpCmd) { _ctcpCmd = ctcpCmd; }
65 inline QString target() const { return _target; }
66 inline void setTarget(const QString& target) { _target = target; }
68 inline QString param() const { return _param; }
69 inline void setParam(const QString& param) { _param = param; }
71 inline QString reply() const { return _reply; }
72 inline void setReply(const QString& reply) { _reply = reply; }
74 inline QUuid uuid() const { return _uuid; }
75 inline void setUuid(const QUuid& uuid) { _uuid = uuid; }
77 static Event* create(EventManager::EventType type, QVariantMap& map, Network* network);
80 explicit CtcpEvent(EventManager::EventType type, QVariantMap& map, Network* network);
81 void toVariantMap(QVariantMap& map) const override;
83 inline QString className() const override { return "CtcpEvent"; }
84 inline void debugInfo(QDebug& dbg) const override
86 NetworkEvent::debugInfo(dbg);
87 dbg << ", prefix = " << qPrintable(prefix()) << ", target = " << qPrintable(target())
88 << ", ctcptype = " << (ctcpType() == Query ? "query" : "reply") << ", cmd = " << qPrintable(ctcpCmd())
89 << ", param = " << qPrintable(param()) << ", reply = " << qPrintable(reply());
95 QString _target, _param, _reply;