Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
corebasichandler.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2015 by the Quassel Project *
3  * devel@quassel-irc.org *
4  * *
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. *
9  * *
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. *
14  * *
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  ***************************************************************************/
20 
21 #include "corebasichandler.h"
22 
23 #include "util.h"
24 #include "logger.h"
25 
27  : BasicHandler(parent),
28  _network(parent)
29 {
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)));
32 
33  connect(this, SIGNAL(putCmd(QString, const QList<QByteArray> &, const QByteArray &)),
34  network(), SLOT(putCmd(QString, const QList<QByteArray> &, const QByteArray &)));
35 
36  connect(this, SIGNAL(putCmd(QString, const QList<QList<QByteArray>> &, const QByteArray &)),
37  network(), SLOT(putCmd(QString, const QList<QList<QByteArray>> &, const QByteArray &)));
38 
39  connect(this, SIGNAL(putRawLine(const QByteArray &)),
40  network(), SLOT(putRawLine(const QByteArray &)));
41 }
42 
43 
44 QString CoreBasicHandler::serverDecode(const QByteArray &string)
45 {
46  return network()->serverDecode(string);
47 }
48 
49 
50 QStringList CoreBasicHandler::serverDecode(const QList<QByteArray> &stringlist)
51 {
52  QStringList list;
53  foreach(QByteArray s, stringlist) list << network()->serverDecode(s);
54  return list;
55 }
56 
57 
58 QString CoreBasicHandler::channelDecode(const QString &bufferName, const QByteArray &string)
59 {
60  return network()->channelDecode(bufferName, string);
61 }
62 
63 
64 QStringList CoreBasicHandler::channelDecode(const QString &bufferName, const QList<QByteArray> &stringlist)
65 {
66  QStringList list;
67  foreach(QByteArray s, stringlist) list << network()->channelDecode(bufferName, s);
68  return list;
69 }
70 
71 
72 QString CoreBasicHandler::userDecode(const QString &userNick, const QByteArray &string)
73 {
74  return network()->userDecode(userNick, string);
75 }
76 
77 
78 QStringList CoreBasicHandler::userDecode(const QString &userNick, const QList<QByteArray> &stringlist)
79 {
80  QStringList list;
81  foreach(QByteArray s, stringlist) list << network()->userDecode(userNick, s);
82  return list;
83 }
84 
85 
86 /*** ***/
87 
88 QByteArray CoreBasicHandler::serverEncode(const QString &string)
89 {
90  return network()->serverEncode(string);
91 }
92 
93 
94 QList<QByteArray> CoreBasicHandler::serverEncode(const QStringList &stringlist)
95 {
96  QList<QByteArray> list;
97  foreach(QString s, stringlist) list << network()->serverEncode(s);
98  return list;
99 }
100 
101 
102 QByteArray CoreBasicHandler::channelEncode(const QString &bufferName, const QString &string)
103 {
104  return network()->channelEncode(bufferName, string);
105 }
106 
107 
108 QList<QByteArray> CoreBasicHandler::channelEncode(const QString &bufferName, const QStringList &stringlist)
109 {
110  QList<QByteArray> list;
111  foreach(QString s, stringlist) list << network()->channelEncode(bufferName, s);
112  return list;
113 }
114 
115 
116 QByteArray CoreBasicHandler::userEncode(const QString &userNick, const QString &string)
117 {
118  return network()->userEncode(userNick, string);
119 }
120 
121 
122 QList<QByteArray> CoreBasicHandler::userEncode(const QString &userNick, const QStringList &stringlist)
123 {
124  QList<QByteArray> list;
125  foreach(QString s, stringlist) list << network()->userEncode(userNick, s);
126  return list;
127 }
128 
129 
130 // ====================
131 // protected:
132 // ====================
134 {
135  if (target.isEmpty())
137 
138  if (network()->isChannelName(target))
140 
142 }
143 
144 
145 void CoreBasicHandler::putCmd(const QString &cmd, const QByteArray &param, const QByteArray &prefix)
146 {
147  QList<QByteArray> list;
148  list << param;
149  emit putCmd(cmd, list, prefix);
150 }