~ubuntu-branches/ubuntu/saucy/quassel/saucy-proposed

« back to all changes in this revision

Viewing changes to src/core/basichandler.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-02-17 12:49:50 UTC
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: james.westby@ubuntu.com-20100217124950-v9hajw5d2xa6fszn
Tags: upstream-0.6~beta1
ImportĀ upstreamĀ versionĀ 0.6~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2005-09 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
 
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 
 ***************************************************************************/
20
 
 
21
 
#ifndef BASICHANDLER_H_
22
 
#define BASICHANDLER_H_
23
 
 
24
 
#include <QObject>
25
 
#include <QString>
26
 
#include <QStringList>
27
 
#include <QHash>
28
 
#include <QGenericArgument>
29
 
 
30
 
#include "message.h"
31
 
 
32
 
#include "corenetwork.h"
33
 
 
34
 
class CoreSession;
35
 
 
36
 
class BasicHandler : public QObject {
37
 
  Q_OBJECT
38
 
 
39
 
public:
40
 
  BasicHandler(CoreNetwork *parent = 0);
41
 
 
42
 
  QStringList providesHandlers();
43
 
 
44
 
  QString serverDecode(const QByteArray &string);
45
 
  QStringList serverDecode(const QList<QByteArray> &stringlist);
46
 
  QString channelDecode(const QString &bufferName, const QByteArray &string);
47
 
  QStringList channelDecode(const QString &bufferName, const QList<QByteArray> &stringlist);
48
 
  QString userDecode(const QString &userNick, const QByteArray &string);
49
 
  QStringList userDecode(const QString &userNick, const QList<QByteArray> &stringlist);
50
 
 
51
 
  QByteArray serverEncode(const QString &string);
52
 
  QList<QByteArray> serverEncode(const QStringList &stringlist);
53
 
  QByteArray channelEncode(const QString &bufferName, const QString &string);
54
 
  QList<QByteArray> channelEncode(const QString &bufferName, const QStringList &stringlist);
55
 
  QByteArray userEncode(const QString &userNick, const QString &string);
56
 
  QList<QByteArray> userEncode(const QString &userNick, const QStringList &stringlist);
57
 
 
58
 
signals:
59
 
  void displayMsg(Message::Type, BufferInfo::Type, const QString &target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None);
60
 
  void putCmd(const QString &cmd, const QList<QByteArray> &params, const QByteArray &prefix = QByteArray());
61
 
  void putRawLine(const QByteArray &msg);
62
 
 
63
 
protected:
64
 
  void displayMsg(Message::Type, QString target, const QString &text, const QString &sender = "", Message::Flags flags = Message::None);
65
 
  void putCmd(const QString &cmd, const QByteArray &param, const QByteArray &prefix = QByteArray());
66
 
 
67
 
  virtual void handle(const QString &member, QGenericArgument val0 = QGenericArgument(0),
68
 
                      QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(),
69
 
                      QGenericArgument val3 = QGenericArgument(), QGenericArgument val4 = QGenericArgument(),
70
 
                      QGenericArgument val5 = QGenericArgument(), QGenericArgument val6 = QGenericArgument(),
71
 
                      QGenericArgument val7 = QGenericArgument(), QGenericArgument val8 = QGenericArgument());
72
 
 
73
 
 
74
 
  inline CoreNetwork *network() const { return _network; }
75
 
  inline CoreSession *coreSession() const { return _network->coreSession(); }
76
 
 
77
 
  BufferInfo::Type typeByTarget(const QString &target) const;
78
 
 
79
 
private:
80
 
  const QHash<QString, int> &handlerHash();
81
 
  QHash<QString, int> _handlerHash;
82
 
  int defaultHandler;
83
 
  CoreNetwork *_network;
84
 
  bool initDone;
85
 
};
86
 
#endif