X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fbasichandler.cpp;h=0bb1438bf31de24ea919eb0ccda2546b5cc0e451;hp=d93a84416bf631ccced4468c1e171e70ee30872d;hb=d36b7f8ed6ec4474492c60e3c16b3d6755630e3c;hpb=f62cdd391a5e30ef2d2ffbcaa0718904b1652d4e diff --git a/src/core/basichandler.cpp b/src/core/basichandler.cpp index d93a8441..0bb1438b 100644 --- a/src/core/basichandler.cpp +++ b/src/core/basichandler.cpp @@ -22,7 +22,7 @@ #include #include "util.h" -#include "networkconnection.h" +#include "logger.h" BasicHandler::BasicHandler(NetworkConnection *parent) : QObject(parent), @@ -30,11 +30,11 @@ BasicHandler::BasicHandler(NetworkConnection *parent) _networkConnection(parent), initDone(false) { - connect(this, SIGNAL(displayMsg(Message::Type, BufferInfo::Type, QString, QString, QString, quint8)), - networkConnection(), SIGNAL(displayMsg(Message::Type, BufferInfo::Type, QString, QString, QString, quint8))); + connect(this, SIGNAL(displayMsg(Message::Type, BufferInfo::Type, QString, QString, QString, Message::Flags)), + networkConnection(), SIGNAL(displayMsg(Message::Type, BufferInfo::Type, QString, QString, QString, Message::Flags))); - connect(this, SIGNAL(putCmd(QString, const QVariantList &, const QByteArray &)), - networkConnection(), SLOT(putCmd(QString, const QVariantList &, const QByteArray &))); + connect(this, SIGNAL(putCmd(QString, const QList &, const QByteArray &)), + networkConnection(), SLOT(putCmd(QString, const QList &, const QByteArray &))); connect(this, SIGNAL(putRawLine(const QByteArray &)), networkConnection(), SLOT(putRawLine(const QByteArray &))); @@ -158,15 +158,6 @@ QList BasicHandler::userEncode(const QString &userNick, const QStrin // ==================== // protected: // ==================== - -Network *BasicHandler::network() const { - return networkConnection()->network(); -} - -NetworkConnection *BasicHandler::networkConnection() const { - return _networkConnection; -} - BufferInfo::Type BasicHandler::typeByTarget(const QString &target) const { if(target.isEmpty()) return BufferInfo::StatusBuffer; @@ -178,19 +169,18 @@ BufferInfo::Type BasicHandler::typeByTarget(const QString &target) const { } void BasicHandler::putCmd(const QString &cmd, const QByteArray ¶m, const QByteArray &prefix) { - QVariantList list; + QList list; list << param; emit putCmd(cmd, list, prefix); } -void BasicHandler::putCmd(const QString &cmd, const QList ¶ms, const QByteArray &prefix) { - QVariantList list; - foreach(QByteArray param, params) list << param; - emit putCmd(cmd, list, prefix); -} +void BasicHandler::displayMsg(Message::Type msgType, QString target, QString text, QString sender, Message::Flags flags) { + if(!target.isEmpty() && network()->prefixes().contains(target[0])) + target = target.mid(1); -void BasicHandler::displayMsg(Message::Type msgType, QString target, QString text, QString sender, quint8 flags) { - if(target.startsWith('$') || target.startsWith('#')) + IrcChannel *channel = network()->ircChannel(target); + if(!channel && (target.startsWith('$') || target.startsWith('#'))) target = nickFromMask(sender); + emit displayMsg(msgType, typeByTarget(target), target, text, sender, flags); }