1 /***************************************************************************
2 * Copyright (C) 2005-2018 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"
30 class COMMON_EXPORT CtcpEvent : public IrcEvent
38 explicit CtcpEvent(EventManager::EventType type, Network *network, const QString &prefix, QString target,
39 CtcpType ctcpType, QString ctcpCmd, QString param,
40 const QDateTime ×tamp = QDateTime(), const QUuid &uuid = QUuid())
41 : IrcEvent(type, network, prefix),
43 _ctcpCmd(std::move(ctcpCmd)),
44 _target(std::move(target)),
45 _param(std::move(param)),
48 setTimestamp(timestamp);
52 inline CtcpType ctcpType() const { return _ctcpType; }
53 inline void setCtcpType(CtcpType type) { _ctcpType = type; }
55 inline QString ctcpCmd() const { return _ctcpCmd; }
56 inline void setCtcpCmd(const QString &ctcpCmd) { _ctcpCmd = ctcpCmd; }
58 inline QString target() const { return _target; }
59 inline void setTarget(const QString &target) { _target = target; }
61 inline QString param() const { return _param; }
62 inline void setParam(const QString ¶m) { _param = param; }
64 inline QString reply() const { return _reply; }
65 inline void setReply(const QString &reply) { _reply = reply; }
67 inline QUuid uuid() const { return _uuid; }
68 inline void setUuid(const QUuid &uuid) { _uuid = uuid; }
70 static Event *create(EventManager::EventType type, QVariantMap &map, Network *network);
73 explicit CtcpEvent(EventManager::EventType type, QVariantMap &map, Network *network);
74 void toVariantMap(QVariantMap &map) const override;
76 inline QString className() const override { return "CtcpEvent"; }
77 inline void debugInfo(QDebug &dbg) const override
79 NetworkEvent::debugInfo(dbg);
80 dbg << ", prefix = " << qPrintable(prefix())
81 << ", target = " << qPrintable(target())
82 << ", ctcptype = " << (ctcpType() == Query ? "query" : "reply")
83 << ", cmd = " << qPrintable(ctcpCmd())
84 << ", param = " << qPrintable(param())
85 << ", reply = " << qPrintable(reply());
92 QString _target, _param, _reply;