X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcorebasichandler.h;h=b55052e564d6c4b0362597e0ac7dffc97b5f2892;hp=53f0de48a97b5add82644cda572cef799d40d6dd;hb=c1cf157116de7fc3da96203aa6f03c38c7ebb650;hpb=76db8cdfbeffaaba359c8e80cf2146da9e9e7f8a diff --git a/src/core/corebasichandler.h b/src/core/corebasichandler.h index 53f0de48..b55052e5 100644 --- a/src/core/corebasichandler.h +++ b/src/core/corebasichandler.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2013 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -25,9 +25,8 @@ #include #include "basichandler.h" -#include "message.h" - #include "corenetwork.h" +#include "message.h" class CoreSession; @@ -36,39 +35,76 @@ class CoreBasicHandler : public BasicHandler Q_OBJECT public: - CoreBasicHandler(CoreNetwork *parent = 0); - - QString serverDecode(const QByteArray &string); - QStringList serverDecode(const QList &stringlist); - QString channelDecode(const QString &bufferName, const QByteArray &string); - QStringList channelDecode(const QString &bufferName, const QList &stringlist); - QString userDecode(const QString &userNick, const QByteArray &string); - QStringList userDecode(const QString &userNick, const QList &stringlist); - - QByteArray serverEncode(const QString &string); - QList serverEncode(const QStringList &stringlist); - QByteArray channelEncode(const QString &bufferName, const QString &string); - QList channelEncode(const QString &bufferName, const QStringList &stringlist); - QByteArray userEncode(const QString &userNick, const QString &string); - QList userEncode(const QString &userNick, const QStringList &stringlist); + CoreBasicHandler(CoreNetwork* parent = nullptr); + + QString serverDecode(const QByteArray& string); + QStringList serverDecode(const QList& stringlist); + QString channelDecode(const QString& bufferName, const QByteArray& string); + QStringList channelDecode(const QString& bufferName, const QList& stringlist); + QString userDecode(const QString& userNick, const QByteArray& string); + QStringList userDecode(const QString& userNick, const QList& stringlist); + + QByteArray serverEncode(const QString& string); + QList serverEncode(const QStringList& stringlist); + QByteArray channelEncode(const QString& bufferName, const QString& string); + QList channelEncode(const QString& bufferName, const QStringList& stringlist); + QByteArray userEncode(const QString& userNick, const QString& string); + QList userEncode(const QString& userNick, const QStringList& stringlist); signals: - void displayMsg(Message::Type, BufferInfo::Type, const QString &target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None); - void putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix = QByteArray()); - void putRawLine(const QByteArray &msg); + void displayMsg(Message::Type, + BufferInfo::Type, + const QString& target, + const QString& text, + const QString& sender = "", + Message::Flags flags = Message::None); + + /** + * Sends the raw (encoded) line, adding to the queue if needed, optionally with higher priority. + * + * @see CoreNetwork::putRawLine() + */ + void putRawLine(const QByteArray& msg, const bool prepend = false); + + /** + * Sends the command with encoded parameters, with optional prefix or high priority. + * + * @see CoreNetwork::putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix = QByteArray(), const bool + * prepend = false) + */ + void putCmd(const QString& cmd, const QList& params, const QByteArray& prefix = {}, bool prepend = false); + + /** + * Sends the command for each set of encoded parameters, with optional prefix or high priority. + * + * @see CoreNetwork::putCmd(const QString &cmd, const QList> ¶ms, const QByteArray &prefix = QByteArray(), const + * bool prepend = false) + */ + void putCmd(const QString& cmd, const QList>& params, const QByteArray& prefix = {}, bool prepend = false); protected: - void displayMsg(Message::Type, QString target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None); - void putCmd(const QString &cmd, const QByteArray ¶m, const QByteArray &prefix = QByteArray()); - - inline CoreNetwork *network() const { return _network; } - inline CoreSession *coreSession() const { return _network->coreSession(); } - - BufferInfo::Type typeByTarget(const QString &target) const; + /** + * Sends the command with one parameter, with optional prefix or high priority. + * + * @param[in] cmd Command to send, ignoring capitalization + * @param[in] param Parameter for the command, encoded within a QByteArray + * @param[in] prefix Optional command prefix + * @param[in] prepend + * @parmblock + * If true, the command is prepended into the start of the queue, otherwise, it's appended to + * the end. This should be used sparingly, for if either the core or the IRC server cannot + * maintain PING/PONG replies, the other side will close the connection. + * @endparmblock + */ + void putCmd(const QString& cmd, const QByteArray& param, const QByteArray& prefix = QByteArray(), const bool prepend = false); + + inline CoreNetwork* network() const { return _network; } + inline CoreSession* coreSession() const { return _network->coreSession(); } + + BufferInfo::Type typeByTarget(const QString& target) const; private: - CoreNetwork *_network; + CoreNetwork* _network; }; - #endif