1 /***************************************************************************
2 * Copyright (C) 2005-2015 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #include "corebasichandler.h"
26 CoreBasicHandler::CoreBasicHandler(CoreNetwork *parent)
27 : BasicHandler(parent),
30 connect(this, SIGNAL(displayMsg(Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)),
31 network(), SLOT(displayMsg(Message::Type, BufferInfo::Type, const QString &, const QString &, const QString &, Message::Flags)));
33 connect(this, SIGNAL(putCmd(QString, const QList<QByteArray> &, const QByteArray &)),
34 network(), SLOT(putCmd(QString, const QList<QByteArray> &, const QByteArray &)));
36 connect(this, SIGNAL(putCmd(QString, const QList<QList<QByteArray>> &, const QByteArray &)),
37 network(), SLOT(putCmd(QString, const QList<QList<QByteArray>> &, const QByteArray &)));
39 connect(this, SIGNAL(putRawLine(const QByteArray &)),
40 network(), SLOT(putRawLine(const QByteArray &)));
44 QString CoreBasicHandler::serverDecode(const QByteArray &string)
46 return network()->serverDecode(string);
50 QStringList CoreBasicHandler::serverDecode(const QList<QByteArray> &stringlist)
53 foreach(QByteArray s, stringlist) list << network()->serverDecode(s);
58 QString CoreBasicHandler::channelDecode(const QString &bufferName, const QByteArray &string)
60 return network()->channelDecode(bufferName, string);
64 QStringList CoreBasicHandler::channelDecode(const QString &bufferName, const QList<QByteArray> &stringlist)
67 foreach(QByteArray s, stringlist) list << network()->channelDecode(bufferName, s);
72 QString CoreBasicHandler::userDecode(const QString &userNick, const QByteArray &string)
74 return network()->userDecode(userNick, string);
78 QStringList CoreBasicHandler::userDecode(const QString &userNick, const QList<QByteArray> &stringlist)
81 foreach(QByteArray s, stringlist) list << network()->userDecode(userNick, s);
88 QByteArray CoreBasicHandler::serverEncode(const QString &string)
90 return network()->serverEncode(string);
94 QList<QByteArray> CoreBasicHandler::serverEncode(const QStringList &stringlist)
96 QList<QByteArray> list;
97 foreach(QString s, stringlist) list << network()->serverEncode(s);
102 QByteArray CoreBasicHandler::channelEncode(const QString &bufferName, const QString &string)
104 return network()->channelEncode(bufferName, string);
108 QList<QByteArray> CoreBasicHandler::channelEncode(const QString &bufferName, const QStringList &stringlist)
110 QList<QByteArray> list;
111 foreach(QString s, stringlist) list << network()->channelEncode(bufferName, s);
116 QByteArray CoreBasicHandler::userEncode(const QString &userNick, const QString &string)
118 return network()->userEncode(userNick, string);
122 QList<QByteArray> CoreBasicHandler::userEncode(const QString &userNick, const QStringList &stringlist)
124 QList<QByteArray> list;
125 foreach(QString s, stringlist) list << network()->userEncode(userNick, s);
130 // ====================
132 // ====================
133 BufferInfo::Type CoreBasicHandler::typeByTarget(const QString &target) const
135 if (target.isEmpty())
136 return BufferInfo::StatusBuffer;
138 if (network()->isChannelName(target))
139 return BufferInfo::ChannelBuffer;
141 return BufferInfo::QueryBuffer;
145 void CoreBasicHandler::putCmd(const QString &cmd, const QByteArray ¶m, const QByteArray &prefix)
147 QList<QByteArray> list;
149 emit putCmd(cmd, list, prefix);