1 /***************************************************************************
2 * Copyright (C) 2005-2014 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(putRawLine(const QByteArray &)),
37 network(), SLOT(putRawLine(const QByteArray &)));
41 QString CoreBasicHandler::serverDecode(const QByteArray &string)
43 return network()->serverDecode(string);
47 QStringList CoreBasicHandler::serverDecode(const QList<QByteArray> &stringlist)
50 foreach(QByteArray s, stringlist) list << network()->serverDecode(s);
55 QString CoreBasicHandler::channelDecode(const QString &bufferName, const QByteArray &string)
57 return network()->channelDecode(bufferName, string);
61 QStringList CoreBasicHandler::channelDecode(const QString &bufferName, const QList<QByteArray> &stringlist)
64 foreach(QByteArray s, stringlist) list << network()->channelDecode(bufferName, s);
69 QString CoreBasicHandler::userDecode(const QString &userNick, const QByteArray &string)
71 return network()->userDecode(userNick, string);
75 QStringList CoreBasicHandler::userDecode(const QString &userNick, const QList<QByteArray> &stringlist)
78 foreach(QByteArray s, stringlist) list << network()->userDecode(userNick, s);
85 QByteArray CoreBasicHandler::serverEncode(const QString &string)
87 return network()->serverEncode(string);
91 QList<QByteArray> CoreBasicHandler::serverEncode(const QStringList &stringlist)
93 QList<QByteArray> list;
94 foreach(QString s, stringlist) list << network()->serverEncode(s);
99 QByteArray CoreBasicHandler::channelEncode(const QString &bufferName, const QString &string)
101 return network()->channelEncode(bufferName, string);
105 QList<QByteArray> CoreBasicHandler::channelEncode(const QString &bufferName, const QStringList &stringlist)
107 QList<QByteArray> list;
108 foreach(QString s, stringlist) list << network()->channelEncode(bufferName, s);
113 QByteArray CoreBasicHandler::userEncode(const QString &userNick, const QString &string)
115 return network()->userEncode(userNick, string);
119 QList<QByteArray> CoreBasicHandler::userEncode(const QString &userNick, const QStringList &stringlist)
121 QList<QByteArray> list;
122 foreach(QString s, stringlist) list << network()->userEncode(userNick, s);
127 // ====================
129 // ====================
130 BufferInfo::Type CoreBasicHandler::typeByTarget(const QString &target) const
132 if (target.isEmpty())
133 return BufferInfo::StatusBuffer;
135 if (network()->isChannelName(target))
136 return BufferInfo::ChannelBuffer;
138 return BufferInfo::QueryBuffer;
142 void CoreBasicHandler::putCmd(const QString &cmd, const QByteArray ¶m, const QByteArray &prefix)
144 QList<QByteArray> list;
146 emit putCmd(cmd, list, prefix);