KVIrc  4.9.2
DeveloperAPIs
KviRegisteredUser.h
Go to the documentation of this file.
1 #ifndef _KviRegisteredUser_h_
2 #define _KviRegisteredUser_h_
3 //=============================================================================
4 //
5 // File : KviRegisteredUser.h
6 // Creation date : Wed Dec 29 2010 02:44:05 CEST by Elvio Basello
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com)
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 // this file was originally part of KviRegisteredUserDataBase.h
28 
29 #include "kvi_settings.h"
30 #include "KviHeapObject.h"
31 #include "KviIrcMask.h"
32 #include "KviPointerList.h"
33 #include "KviPointerHashTable.h"
34 
36 {
38 
39 public:
41  {
42  Channel = 1,
43  Query = 2,
44  Notice = 4,
45  Ctcp = 8,
46  Invite = 16,
47  Dcc = 32,
48  Highlight = 64
49  };
50 
51  KviRegisteredUser(const QString & szName);
53 
54 private:
57  QString m_szName;
58  QString m_szGroup;
61 protected:
62  // mask ownership is transferred! (always!) returns false if the mask was already there
63  bool addMask(KviIrcMask * pMask);
64  bool removeMask(KviIrcMask * pMask);
65  KviIrcMask * findMask(const KviIrcMask & mask);
66 
67 public:
68  int ignoreFlags() { return m_iIgnoreFlags; };
69  void setIgnoreFlags(int iFlags) { m_iIgnoreFlags = iFlags; };
70  bool ignoreEnabled() { return m_bIgnoreEnabled; };
71  void setIgnoreEnabled(bool bEnabled) { m_bIgnoreEnabled = bEnabled; };
72  bool isIgnoreEnabledFor(IgnoreFlags flag);
73 
74  const QString & name() { return m_szName; };
75  bool matches(const KviIrcMask & mask);
76  bool matchesFixed(const KviIrcMask & mask);
77  bool matchesFixed(const QString & szNick, const QString & szUser, const QString & szHost);
78 
79  void setProperty(const QString & szName, const QString & szValue);
80  void setProperty(const QString & szName, bool szValue);
81 
82  void setGroup(const QString & szName) { m_szGroup = szName; };
83  const QString & group() { return m_szGroup; };
84 
85  const QString & getProperty(const QString & szName); // returns 0 if the property is not there
86  bool getProperty(const QString & szName, QString & szValue); // returns false if the property is not there
87  bool getBoolProperty(const QString & szName, bool bDef = false); // returns true if the property is there and is true
88  // the propertyDict may be 0!
89  KviPointerHashTable<QString, QString> * propertyDict() { return m_pPropertyDict; };
90  // this is never zero (but may contain no masks)
91  KviPointerList<KviIrcMask> * maskList() { return m_pMaskList; };
92 };
93 
94 #endif
KviRegisteredUser * addMask(KviRegisteredUser *u, KviIrcMask *mask)
Definition: KviRegisteredUserDataBase.cpp:202
Definition: KviHeapObject.h:124
Irc user mask abstraction.
KviPointerHashTable< QString, QString > * m_pPropertyDict
Definition: KviRegisteredUser.h:59
bool ignoreEnabled()
Definition: KviRegisteredUser.h:70
int m_iIgnoreFlags
Definition: KviRegisteredUser.h:55
KviPointerList< KviIrcMask > * m_pMaskList
Definition: KviRegisteredUser.h:60
Definition: KviRegisteredUser.h:35
void setIgnoreFlags(int iFlags)
Definition: KviRegisteredUser.h:69
Irc user mask handling.
Definition: KviIrcMask.h:45
char Channel
Definition: KviIrcNumericCodes.h:391
bool removeMask(const KviIrcMask &mask)
Definition: KviRegisteredUserDataBase.cpp:341
Pointer Hash Table.
QString szHost
Definition: libkvisetup.cpp:45
IgnoreFlags
Definition: KviRegisteredUser.h:40
bool m_bIgnoreEnabled
Definition: KviRegisteredUser.h:56
KviPointerList< KviIrcMask > * maskList()
Definition: KviRegisteredUser.h:91
Definition: KviRegisteredUserDataBase.h:53
int ignoreFlags()
Definition: KviRegisteredUser.h:68
C++ Template based double linked pointer list class.
KviPointerHashTable< QString, QString > * propertyDict()
Definition: KviRegisteredUser.h:89
Heap Object.
void setIgnoreEnabled(bool bEnabled)
Definition: KviRegisteredUser.h:71
void setGroup(const QString &szName)
Definition: KviRegisteredUser.h:82
const QString & group()
Definition: KviRegisteredUser.h:83
QString m_szGroup
Definition: KviRegisteredUser.h:58
This file contains compile time settings.
#define KVILIB_API
Definition: kvi_settings.h:125
QString m_szName
Definition: KviRegisteredUser.h:57
const QString & name()
Definition: KviRegisteredUser.h:74