X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fctcpevent.h;h=54e26ecdb1061e23525418a46028f051feda4f38;hp=08eac202ccf7615328668c52075045d7835bae1b;hb=4a5065255e652dd0c301bac0db41b7afb777ef49;hpb=283fdb2c49e5efa1d497d8c3e6f624f86d008ff8 diff --git a/src/common/ctcpevent.h b/src/common/ctcpevent.h index 08eac202..54e26ecd 100644 --- a/src/common/ctcpevent.h +++ b/src/common/ctcpevent.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2010 by the Quassel Project * + * Copyright (C) 2005-2013 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef CTCPEVENT_H @@ -25,62 +25,71 @@ #include -class CtcpEvent : public IrcEvent { - +class CtcpEvent : public IrcEvent +{ public: - enum CtcpType { - Query, - Reply - }; - - explicit CtcpEvent(EventManager::EventType type, Network *network, const QString &prefix, const QString &target, - CtcpType ctcpType, const QString &ctcpCmd, const QString ¶m, - const QDateTime ×tamp = QDateTime(), const QUuid &uuid = QUuid()) - : IrcEvent(type, network, prefix), - _ctcpType(ctcpType), - _ctcpCmd(ctcpCmd), - _target(target), - _param(param), - _uuid(uuid) - { - setTimestamp(timestamp); - } - - inline CtcpType ctcpType() const { return _ctcpType; } - inline void setCtcpType(CtcpType type) { _ctcpType = type; } - - inline QString ctcpCmd() const { return _ctcpCmd; } - inline void setCtcpCmd(const QString &ctcpCmd) { _ctcpCmd = ctcpCmd; } - - inline QString target() const { return _target; } - inline void setTarget(const QString &target) { _target = target; } - - inline QString param() const { return _param; } - inline void setParam(const QString ¶m) { _param = param; } - - inline QString reply() const { return _reply; } - inline void setReply(const QString &reply) { _reply = reply; } - - inline QUuid uuid() const { return _uuid; } - inline void setUuid(const QUuid &uuid) { _uuid = uuid; } + enum CtcpType { + Query, + Reply + }; + + explicit CtcpEvent(EventManager::EventType type, Network *network, const QString &prefix, const QString &target, + CtcpType ctcpType, const QString &ctcpCmd, const QString ¶m, + const QDateTime ×tamp = QDateTime(), const QUuid &uuid = QUuid()) + : IrcEvent(type, network, prefix), + _ctcpType(ctcpType), + _ctcpCmd(ctcpCmd), + _target(target), + _param(param), + _uuid(uuid) + { + setTimestamp(timestamp); + } + + + inline CtcpType ctcpType() const { return _ctcpType; } + inline void setCtcpType(CtcpType type) { _ctcpType = type; } + + inline QString ctcpCmd() const { return _ctcpCmd; } + inline void setCtcpCmd(const QString &ctcpCmd) { _ctcpCmd = ctcpCmd; } + + inline QString target() const { return _target; } + inline void setTarget(const QString &target) { _target = target; } + + inline QString param() const { return _param; } + inline void setParam(const QString ¶m) { _param = param; } + + inline QString reply() const { return _reply; } + inline void setReply(const QString &reply) { _reply = reply; } + + inline QUuid uuid() const { return _uuid; } + inline void setUuid(const QUuid &uuid) { _uuid = uuid; } + + static Event *create(EventManager::EventType type, QVariantMap &map, Network *network); protected: - virtual inline QString className() const { return "CtcpEvent"; } - virtual inline void debugInfo(QDebug &dbg) const { - NetworkEvent::debugInfo(dbg); - dbg << ", prefix = " << qPrintable(prefix()) - << ", target = " << qPrintable(target()) - << ", ctcptype = " << (ctcpType() == Query? "query" : "reply") - << ", cmd = " << qPrintable(ctcpCmd()) - << ", param = " << qPrintable(param()) - << ", reply = " << qPrintable(reply()); - } + explicit CtcpEvent(EventManager::EventType type, QVariantMap &map, Network *network); + void toVariantMap(QVariantMap &map) const; + + virtual inline QString className() const { return "CtcpEvent"; } + virtual inline void debugInfo(QDebug &dbg) const + { + NetworkEvent::debugInfo(dbg); + dbg << ", prefix = " << qPrintable(prefix()) + << ", target = " << qPrintable(target()) + << ", ctcptype = " << (ctcpType() == Query ? "query" : "reply") + << ", cmd = " << qPrintable(ctcpCmd()) + << ", param = " << qPrintable(param()) + << ", reply = " << qPrintable(reply()); + } + private: - CtcpType _ctcpType; - QString _ctcpCmd; - QString _target, _param, _reply; - QUuid _uuid; + CtcpType _ctcpType; + QString _ctcpCmd; + QString _target, _param, _reply; + QUuid _uuid; }; + #endif