Add some const correctness to Network
[quassel.git] / src / common / ctcpevent.h
1 /***************************************************************************
2  *   Copyright (C) 2005-2010 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  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #ifndef CTCPEVENT_H
22 #define CTCPEVENT_H
23
24 #include "ircevent.h"
25
26 #include <QUuid>
27
28 class CtcpEvent : public IrcEvent {
29
30 public:
31   enum CtcpType {
32     Query,
33     Reply
34   };
35
36   explicit CtcpEvent(EventManager::EventType type, Network *network, const QString &prefix, const QString &target,
37                      CtcpType ctcpType, const QString &ctcpCmd, const QString &param,
38                      const QDateTime &timestamp = QDateTime(), const QUuid &uuid = QUuid())
39     : IrcEvent(type, network, prefix),
40     _ctcpType(ctcpType),
41     _ctcpCmd(ctcpCmd),
42     _target(target),
43     _param(param),
44     _uuid(uuid)
45   {
46     setTimestamp(timestamp);
47   }
48
49   inline CtcpType ctcpType() const { return _ctcpType; }
50   inline void setCtcpType(CtcpType type) { _ctcpType = type; }
51
52   inline QString ctcpCmd() const { return _ctcpCmd; }
53   inline void setCtcpCmd(const QString &ctcpCmd) { _ctcpCmd = ctcpCmd; }
54
55   inline QString target() const { return _target; }
56   inline void setTarget(const QString &target) { _target = target; }
57
58   inline QString param() const { return _param; }
59   inline void setParam(const QString &param) { _param = param; }
60
61   inline QString reply() const { return _reply; }
62   inline void setReply(const QString &reply) { _reply = reply; }
63
64   inline QUuid uuid() const { return _uuid; }
65   inline void setUuid(const QUuid &uuid) { _uuid = uuid; }
66
67 protected:
68   virtual inline QString className() const { return "CtcpEvent"; }
69   virtual inline void debugInfo(QDebug &dbg) const {
70     NetworkEvent::debugInfo(dbg);
71     dbg << ", prefix = " << qPrintable(prefix())
72         << ", target = " << qPrintable(target())
73         << ", ctcptype = " << (ctcpType() == Query? "query" : "reply")
74         << ", cmd = " << qPrintable(ctcpCmd())
75         << ", param = " << qPrintable(param())
76         << ", reply = " << qPrintable(reply());
77   }
78
79 private:
80   CtcpType _ctcpType;
81   QString _ctcpCmd;
82   QString _target, _param, _reply;
83   QUuid _uuid;
84 };
85
86 #endif