KVIrc 5.2.6
Developer APIs
KviRegisteredUserDataBase.h
Go to the documentation of this file.
1#ifndef _KVI_REGUSERSDB_H_
2#define _KVI_REGUSERSDB_H_
3//=============================================================================
4//
5// File : KviRegisteredUserDataBase.h
6// Creation date : Sat Sep 09 2000 15:30:56 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//
28// REGISTERED USERS
29//
30// Here we manage users resigered by mask and their (generic!) properties
31//
32
33#include "kvi_settings.h"
34#include "kvi_debug.h"
35
36#include "KviPointerHashTable.h"
39#include "KviRegisteredUser.h"
40
41#include <QObject>
42
43class KviIrcMask;
44class QString;
45
46//
47// KviRegisteredUserDataBase
48//
49// Manages a set of KviRegisteredUser instances stored in the m_pUserDict dictionary
50// The users are identified by masks stored in m_pMaskDict and m_pWildMaskList
51// m_pMaskDict contains lists of non wild-nick KviRegisteredUserMask that point to users
52// m_pWildMaskList is a list of wild-nick KviRegisteredUserMask that point to users
53//
54
56{
57 Q_OBJECT
58public:
61
62private:
63 KviPointerHashTable<QString, KviRegisteredUser> * m_pUserDict; // unique namespace, owns the objects, does not copy keys
67
68public:
70 KviRegisteredUser * addUser(const QString & name); // returns 0 if already there
71 KviRegisteredUser * getUser(const QString & name); // returns existing or adds
72 bool removeUser(const QString & name);
73 bool removeGroup(const QString & name);
74 KviRegisteredUser * findUserByName(const QString & name) { return m_pUserDict->find(name); };
75 // mask must be allocated on the heap and the ownership is transferred!
76 // returns non zero if there is already a user with this mask (returns the pointer to it!)
78 bool removeMaskByPointer(KviIrcMask * mask);
79 bool removeMask(const KviIrcMask & mask);
80 KviRegisteredUser * findMatchingUser(const QString & nick, const QString & user, const QString & host);
81 KviRegisteredUser * findUserWithMask(const KviIrcMask & mask);
82 KviRegisteredUserMask * findExactMask(const KviIrcMask & mask);
83 KviRegisteredUserMask * findMatchingMask(const QString & nick, const QString & user, const QString & host);
84 //Only used in few places (actually one) of the code, but lot of times;perfect for inlining...
85 //bool isIgnoredUser(const char * nick,const char * user,const char * host);
86 void load(const QString & filename);
87 void save(const QString & filename);
88
91
92 KviRegisteredUserGroup * addGroup(const QString & name);
93signals:
94 void userRemoved(const QString &);
95 void userChanged(const QString &);
96 void userAdded(const QString &);
98};
99
100#ifndef _KVI_REGUSERDB_CPP_
102#endif // _KVI_REGUSERDB_CPP_
103
104#endif //_KVI_REGUSERSDB_H_
Pointer Hash Table.
KVILIB_API KviRegisteredUserDataBase * g_pRegisteredUserDataBase
Definition KviRegisteredUserDataBase.cpp:119
KviPointerList< KviRegisteredUserMask > KviRegisteredUserMaskList
Definition KviRegisteredUserMask.h:52
Irc user mask handling.
Definition KviIrcMask.h:48
A fast pointer hash table implementation.
Definition KviPointerHashTable.h:450
Definition KviRegisteredUserDataBase.h:56
void userRemoved(const QString &)
KviRegisteredUser * getUser(const QString &name)
Definition KviRegisteredUserDataBase.cpp:172
KviRegisteredUser * findUserByName(const QString &name)
Definition KviRegisteredUserDataBase.h:74
KviRegisteredUserMaskList * m_pWildMaskList
Definition KviRegisteredUserDataBase.h:65
KviPointerHashTable< QString, KviRegisteredUserMaskList > * m_pMaskDict
Definition KviRegisteredUserDataBase.h:64
bool removeGroup(const QString &name)
Definition KviRegisteredUserDataBase.cpp:332
void userChanged(const QString &)
KviPointerHashTable< QString, KviRegisteredUserGroup > * m_pGroupDict
Definition KviRegisteredUserDataBase.h:66
bool removeUser(const QString &name)
Definition KviRegisteredUserDataBase.cpp:315
KviPointerHashTable< QString, KviRegisteredUser > * m_pUserDict
Definition KviRegisteredUserDataBase.h:63
KviRegisteredUser * addUser(const QString &name)
Definition KviRegisteredUserDataBase.cpp:149
void userAdded(const QString &)
void copyFrom(KviRegisteredUserDataBase *db)
Definition KviRegisteredUserDataBase.cpp:270
KviRegisteredUserDataBase()
Definition KviRegisteredUserDataBase.cpp:125
KviPointerHashTable< QString, KviRegisteredUser > * userDict()
Definition KviRegisteredUserDataBase.h:89
KviPointerHashTable< QString, KviRegisteredUserGroup > * groupDict()
Definition KviRegisteredUserDataBase.h:90
Definition KviRegisteredUserGroup.h:35
Definition KviRegisteredUserMask.h:36
Definition KviRegisteredUser.h:40
#define u
Definition detector.cpp:86
This file contains the definition of the debug macros;.
This file contains compile time settings.
#define KVILIB_API
Definition kvi_settings.h:124