summaryrefslogtreecommitdiffstats
path: root/ksirc/messageReceiver.h
blob: c29a87738819cf5a8f3945a8d1bf393b38f408e4 (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 <tqstring.h>
#include <tqptrlist.h>

class KSircProcess;
class TQTextCodec;

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

typedef TQPtrList<filterRule> filterRuleList;

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

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

    virtual void control_message(int, TQString) = 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(TQCString str, bool broadcast = false);
    virtual void sirc_receive(TQString str, bool broadcast = false) = 0;

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

    TQTextCodec *encoder() const;

private:
    TQString m_encoding;
    TQTextCodec *m_encoder;
};

#endif