KVIrc 5.2.6
Developer APIs
KviNotifyList.h
Go to the documentation of this file.
1#ifndef _KVI_NOTIFYLIST_H_
2#define _KVI_NOTIFYLIST_H_
3//=============================================================================
4//
5// File : KviNotifyList.h
6// Creation date : Fri Oct 27 2000 23:39:09 CEST by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2000-2010 Szymon Stefanek (pragma at kvirc dot net)
10//
11// This program is FREE software. You can redistribute it and/or
12// modify it under the terms of the GNU General Public License
13// as published by the Free Software Foundation; either version 2
14// of the License, or (at your option) any later version.
15//
16// This program is distributed in the HOPE that it will be USEFUL,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19// See the GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program. If not, write to the Free Software Foundation,
23// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24//
25//=============================================================================
26
27#include "kvi_settings.h"
28#include "KviQString.h"
29
30#include <QObject>
31#include <QTimer>
32
33#include <map>
34#include <memory>
35#include <vector>
36
39class KviIrcMask;
40class KviIrcMessage;
41
42class KVIRC_API KviNotifyListManager : public QObject
43{
44 friend class KviConsoleWindow;
45 friend class KviConnectionInfo;
46 friend class KviIrcServerParser;
47 friend class KviIrcConnection;
48 Q_OBJECT
49protected:
52
53protected:
56
57protected:
58 virtual void start();
59 virtual void stop();
60 virtual bool handleUserhost(KviIrcMessage * msg);
61 virtual bool handleIsOn(KviIrcMessage * msg);
62 virtual bool handleWatchReply(KviIrcMessage * msg);
63 void notifyOnLine(const QString & nick, const QString & user = QString(), const QString & host = QString(), const QString & szReason = QString(), bool bJoin = true);
64 void notifyOffLine(const QString & nick, const QString & user = QString(), const QString & host = QString(), const QString & szReason = QString());
65
66public:
67 KviConsoleWindow * console() const { return m_pConsole; }
68};
69
71{
72 friend class KviConsoleWindow;
73 friend class KviIrcServerParser;
74 friend class KviIrcConnection;
75 Q_OBJECT
76protected:
79
80private:
81 std::map<QString, QString> m_pRegUserDict; // dict notifystring->reguser name
82 std::vector<QString> m_NotifyList; // list of notifystring (total)
83 std::vector<QString> m_IsOnList; // list of notifystring (one session)
84 QString m_szIsOnString; // m_pIsOnList in form of a string
85 std::vector<QString> m_OnlineList;
86 std::vector<QString> m_UserhostList;
93 bool m_bRunning = false;
94
95protected:
96 void start() override;
97 void stop() override;
98 bool handleUserhost(KviIrcMessage * msg) override;
99 bool handleIsOn(KviIrcMessage * msg) override;
100
101private:
102 void delayedNotifySession();
103 void delayedIsOnSession();
104 void delayedUserhostSession();
105private slots:
106 void newNotifySession();
107 void newIsOnSession();
108 void newUserhostSession();
109
110 void buildRegUserDict();
111 void buildIsOnList();
112 void buildUserhostList();
113 void buildNotifyList();
114 void sendIsOn();
115 void sendUserhost();
116 bool doMatchUser(const QString & notifyString, const KviIrcMask & mask);
117};
118
120{
121 friend class KviConsoleWindow;
122 friend class KviIrcServerParser;
123 friend class KviIrcConnection;
124 Q_OBJECT
125protected:
128
129protected:
130 std::vector<QString> m_pNickList;
134
135protected:
136 void start() override;
137 void stop() override;
138 bool handleIsOn(KviIrcMessage * msg) override;
139
140protected:
141 void timerEvent(QTimerEvent * e) override;
142
143private:
144 void buildNickList();
145 void sendIsOn();
146};
147
149{
150 friend class KviConsoleWindow;
151 friend class KviIrcServerParser;
152 friend class KviIrcConnection;
153 Q_OBJECT
154public:
156
157protected:
158 std::map<QString, QString> m_pRegUserDict; // dict notifystring->reguser name
159protected:
160 void buildRegUserDict();
161 void start() override;
162 void stop() override;
163 bool handleWatchReply(KviIrcMessage * msg) override;
164 bool doMatchUser(KviIrcMessage * msg, const QString & notifyString, const KviIrcMask & mask);
165};
166
167#endif //_KVI_NOTIFYLIST_H_
Helper functions for the QString class.
Definition KviConsoleWindow.h:74
An abstraction of a connection to an IRC server.
Definition KviIrcConnection.h:97
Irc user mask handling.
Definition KviIrcMask.h:48
Definition KviIrcMessage.h:50
Definition KviIrcServerParser.h:114
Definition KviNotifyList.h:71
std::vector< QString > m_OnlineList
Definition KviNotifyList.h:85
QTimer m_pDelayedIsOnTimer
Definition KviNotifyList.h:88
std::vector< QString > m_NotifyList
Definition KviNotifyList.h:82
QString m_szIsOnString
Definition KviNotifyList.h:84
std::vector< QString > m_IsOnList
Definition KviNotifyList.h:83
bool m_bExpectingUserhost
Definition KviNotifyList.h:92
std::vector< QString > m_UserhostList
Definition KviNotifyList.h:86
QTimer m_pDelayedUserhostTimer
Definition KviNotifyList.h:90
QString m_szUserhostString
Definition KviNotifyList.h:87
bool m_bExpectingIsOn
Definition KviNotifyList.h:91
std::map< QString, QString > m_pRegUserDict
Definition KviNotifyList.h:81
QTimer m_pDelayedNotifyTimer
Definition KviNotifyList.h:89
Definition KviNotifyList.h:43
KviConsoleWindow * m_pConsole
Definition KviNotifyList.h:54
KviConsoleWindow * console() const
Definition KviNotifyList.h:67
KviIrcConnection * m_pConnection
Definition KviNotifyList.h:55
Definition KviNotifyList.h:120
std::vector< QString > m_pNickList
Definition KviNotifyList.h:130
int m_iRestartTimer
Definition KviNotifyList.h:133
std::size_t m_iNextNickToCheck
Definition KviNotifyList.h:132
QString m_szLastIsOnMsg
Definition KviNotifyList.h:131
Definition KviNotifyList.h:149
std::map< QString, QString > m_pRegUserDict
Definition KviNotifyList.h:158
#define e
Definition detector.cpp:70
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127