summaryrefslogtreecommitdiffstats
path: root/konversation/src/inputfilter.h
blob: 364130e4d6c8055695bb1f4e2fca7bb6973de868 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
*/

/*
  Copyright (C) 2002 Dario Abatianni <eisfuchs@tigress.com>
  Copyright (C) 2004 Peter Simonsson <psn@linux.se>
  Copyright (C) 2006-2008 Eike Hein <hein@kde.org>
*/

#ifndef INPUTFILTER_H
#define INPUTFILTER_H

#include "ignore.h"

#include <tqobject.h>
#include <tqstringlist.h>


class Server;
class TQWidget;
class Query;
class TQDateTime;

class InputFilter : public TQObject
{
    TQ_OBJECT
  

    public:
        InputFilter();
        ~InputFilter();

        void setServer(Server* newServer);
        void parseLine(const TQString &line);

        void reset();                             // reset AutomaticRequest, WhoRequestList

        // use this when the client does automatics, like userhost for finding hostmasks
        void setAutomaticRequest(const TQString& command, const TQString& name, bool yes);
        int getAutomaticRequest(const TQString& command, const TQString& name);
        void addWhoRequest(const TQString& name);  // called from Server::send()
                                                  // to avoid duplicate requests
        bool isWhoRequestUnderProcess(const TQString& name);
        void setLagMeasuring(bool yes);
        bool getLagMeasuring();

    signals:
        void welcome(const TQString& ownHost);
        void notifyResponse(const TQString &nicksOnline);
                                                  // will be connected to Server::startReverseDccSendTransfer()
        void startReverseDccSendTransfer(const TQString &sourceNick, const TQStringList &dccArgument);
                                                  // will be connected to Server::addDccGet()
        void addDccGet(const TQString &sourceNick, const TQStringList &dccArgument);
                                                  // will be connected to Server::resumeDccGetTransfer()
        void resumeDccGetTransfer(const TQString &sourceNick, const TQStringList &dccArgument);
                                                  // will be connected to Server::resumeDccSendTransfer()
        void resumeDccSendTransfer(const TQString &sourceNick, const TQStringList &dccArgument);
                                                  // will be connected to Server::userhost()
        void userhost(const TQString& nick,const TQString& hostmask,bool away,bool ircOp);
                                                  // will be connected to Server::setTopicAuthor()
        void topicAuthor(const TQString& channel, const TQString& author, TQDateTime t);
        void endOfWho(const TQString& target);     // for scheduling auto /WHO
        void addChannelListPanel();
        void addToChannelList(const TQString& channel,int users,const TQString& topic);
        void invitation(const TQString& nick,const TQString& channel);

        void addDccChat(const TQString& myNick,const TQString& nick,const TQStringList& arguments,bool listen);

    protected:
        void parseClientCommand(const TQString &prefix, const TQString &command, const TQStringList &parameterList, const TQString &trailing);
        void parseServerCommand(const TQString &prefix, const TQString &command, const TQStringList &parameterList, const TQString &trailing);
        void parseModes(const TQString &sourceNick, const TQStringList &parameterList);
        void parsePrivMsg(const TQString& prefix, const TQStringList& parameterList, const TQString& trailing);

        bool isAChannel(const TQString &check);
        bool isIgnore(const TQString &pattern, Ignore::Type type);

        Server* server;
                                                  // automaticRequest[command][channel or nick]=count
        TQMap< TQString, TQMap<TQString,int> > automaticRequest;
        TQStringList whoRequestList;
        int lagMeasuring;

        Query* query;

        int m_debugCount;

        /// Used when handling MOTD
        bool m_connecting;
};
#endif