ircrequestparser.h
1 //------------------------------------------------------------------------------
2 // ircrequestparser.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
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 Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #ifndef __IRCREQUESTPARSER_H__
24 #define __IRCREQUESTPARSER_H__
25 
26 #include "dptr.h"
27 
28 #include <QObject>
29 #include <QString>
30 
31 class IRCAdapterBase;
32 class IRCNetworkAdapter;
33 
53 class IRCRequestParser : public QObject
54 {
55  Q_OBJECT
56 
57  public:
58  enum IRCRequestParseResult
59  {
60  Ok,
61  ErrorMessageTooLong,
62  ErrorMessageEmpty,
63  ErrorInputNotPrependedWithSlash,
64  ErrorInputInsufficientParameters,
65  ErrorChatWindowOnly,
66  QuitCommand
67  };
68 
71 
72  const QString &output() const;
73 
100  IRCRequestParseResult parse(IRCAdapterBase* pAdapter, QString input);
101 
102  signals:
112  void echoPrivmsg(const QString& recipient, const QString& content);
113 
123  void query(const QString& who);
124 
125  private:
127 
128  IRCRequestParseResult buildOutput();
129  IRCNetworkAdapter *network();
133  bool isOutputTooLong() const;
134 };
135 
136 #endif
Interprets communication between the client and the IRC server.
Parses request and interprets them in a way that emulates mIRC (or any even slightly sane IRC client ...
Provides an unified communication interface between a client and IRC network entities.
void query(const QString &who)
Emitted when "/query" alias is used.
IRCRequestParseResult parse(IRCAdapterBase *pAdapter, QString input)
Parses input string and returns it through output string. Additional information is passed through re...
void echoPrivmsg(const QString &recipient, const QString &content)
Echoes back all PRIVMSG commands.