summaryrefslogtreecommitdiffstats
path: root/ksirc/messageReceiver.h
blob: a86817b02ee2b78f7e4edc66b4d7590dbc8eb953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

#ifndef KMESSAGERECEIVER_H
#define KMESSAGERECEIVER_H

#include <qstring.h>
#include <qptrlist.h>

class KSircProcess;
class QTextCodec;

struct filterRule {
    const char *desc;
    const char *search;
    const char *from;
    const char *to;
};

typedef QPtrList<filterRule> filterRuleList;

class KSircMessageReceiver
{
public:
  KSircMessageReceiver(KSircProcess *_proc);
  virtual ~KSircMessageReceiver();

    virtual void sirc_receive(QCString str, bool broadcast = false) = 0;

    virtual void control_message(int, QString) = 0;

  bool getBroadcast();
  void setBroadcast(bool bd);

  virtual filterRuleList *defaultRules();

  KSircProcess *ksircProcess() const { return proc; }

private:
  KSircProcess *proc;
  bool broadcast;

};

class UnicodeMessageReceiver : public KSircMessageReceiver
{
public:
    UnicodeMessageReceiver( KSircProcess *process );

    virtual void sirc_receive(QCString str, bool broadcast = false);
    virtual void sirc_receive(QString str, bool broadcast = false) = 0;

protected:
    void setEncoding( const QString &encoding );
    QString encoding() const;

    QTextCodec *encoder() const;

private:
    QString m_encoding;
    QTextCodec *m_encoder;
};

#endif