1 /***************************************************************************
2 * Copyright (C) 2005-2010 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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 #include "networkevent.h"
27 class IrcEvent : public NetworkEvent {
29 explicit IrcEvent(EventManager::EventType type, Network *network, const QString &prefix, const QStringList ¶ms = QStringList())
30 : NetworkEvent(type, network),
35 inline QString prefix() const { return _prefix; }
36 inline void setPrefix(const QString &prefix) { _prefix = prefix; }
38 inline QString nick() const { return nickFromMask(prefix()); }
40 inline QStringList params() const { return _params; }
41 inline void setParams(const QStringList ¶ms) { _params = params; }
44 virtual inline QString className() const { return "IrcEvent"; }
45 virtual inline void debugInfo(QDebug &dbg) const {
46 NetworkEvent::debugInfo(dbg);
47 dbg << ", prefix = " << qPrintable(prefix())
48 << ", params = " << params();
57 class IrcEventNumeric : public IrcEvent {
59 explicit IrcEventNumeric(uint number, Network *network, const QString &prefix, const QString &target, const QStringList ¶ms = QStringList())
60 : IrcEvent(EventManager::IrcEventNumeric, network, prefix, params),
65 inline uint number() const { return _number; }
67 inline QString target() const { return _target; }
68 inline void setTarget(const QString &target) { _target = target; }
71 virtual inline QString className() const { return "IrcEventNumeric"; }
72 virtual inline void debugInfo(QDebug &dbg) const {
73 dbg << ", num = " << number();
74 NetworkEvent::debugInfo(dbg);
75 dbg << ", target = " << qPrintable(target())
76 << ", prefix = " << qPrintable(prefix())
77 << ", params = " << params();
86 class IrcEventRawMessage : public IrcEvent {
88 explicit inline IrcEventRawMessage(EventManager::EventType type, Network *network,
89 const QByteArray &rawMessage, const QString &prefix, const QString &target,
90 const QDateTime ×tamp = QDateTime())
91 : IrcEvent(type, network, prefix, QStringList() << target),
92 _rawMessage(rawMessage)
94 setTimestamp(timestamp);
97 inline QString target() const { return params().at(0); }
98 inline void setTarget(const QString &target) { setParams(QStringList() << target); }
100 inline QByteArray rawMessage() const { return _rawMessage; }
101 inline void setRawMessage(const QByteArray &rawMessage) { _rawMessage = rawMessage; }
104 virtual inline QString className() const { return "IrcEventRawMessage"; }
105 virtual inline void debugInfo(QDebug &dbg) const {
106 NetworkEvent::debugInfo(dbg);
107 dbg << ", target = " << qPrintable(target())
108 << ", prefix = " << qPrintable(prefix())
109 << ", msg = " << rawMessage();
114 QByteArray _rawMessage;