KVIrc  4.9.2
DeveloperAPIs
Public Member Functions | Protected Slots | Private Attributes | List of all members
KviIrcUserDataBase Class Reference

The class which manages the user database. More...

#include <KviIrcUserDataBase.h>

+ Inheritance diagram for KviIrcUserDataBase:

Public Member Functions

void clear ()
 Clears the database. More...
 
QColor * customColor (const QString &szNick)
 Returns the custom color of the user. More...
 
KviPointerHashTable< QString,
KviIrcUserEntry > * 
dict ()
 Returns the database dictionary. More...
 
KviIrcUserEntryfind (const QString &szNick)
 Searches for a user in the database. More...
 
bool haveCustomColor (const QString &szNick)
 Returns true if the user has custom colors set. More...
 
KviIrcUserEntryinsertUser (const QString &szNick, const QString &szUser, const QString &szHost)
 Adds the user to the database. More...
 
 KviIrcUserDataBase ()
 Constructs the Irc user database object. More...
 
KviRegisteredUserregisteredUser (const QString &szNick)
 Returns the registered user, if any, or 0. More...
 
KviRegisteredUserregisteredUser (const QString &szNick, const QString &szUser, const QString &szHost)
 Returns the registered user, if any, or 0. More...
 
bool removeUser (const QString &szNick, KviIrcUserEntry *pEntry)
 Decrements the user reference count and if it reaches 0 then deletes the user from the database. More...
 
void setupConnectionWithReguserDb ()
 Initialize the database by connecting signals and slots. More...
 
 ~KviIrcUserDataBase ()
 Destoys the object. More...
 

Protected Slots

void registeredDatabaseCleared ()
 Slot called when the database is cleared. More...
 
void registeredUserAdded (const QString &szUser)
 Slot called when a registered user is added. More...
 
void registeredUserChanged (const QString &szUser)
 Slot called when a registered user is changed or removed. More...
 

Private Attributes

KviPointerHashTable< QString,
KviIrcUserEntry > * 
m_pDict
 

Detailed Description

The class which manages the user database.

Constructor & Destructor Documentation

KviIrcUserDataBase::KviIrcUserDataBase ( )

Constructs the Irc user database object.

Returns
KviIrcUserDataBase

References m_pDict, KviPointerHashTable< Key, T >::setAutoDelete(), and setupConnectionWithReguserDb().

KviIrcUserDataBase::~KviIrcUserDataBase ( )

Destoys the object.

References m_pDict.

Member Function Documentation

void KviIrcUserDataBase::clear ( )

Clears the database.

Returns
void

References m_pDict, and KviPointerHashTable< Key, T >::setAutoDelete().

QColor * KviIrcUserDataBase::customColor ( const QString &  szNick)

Returns the custom color of the user.

Parameters
szNickThe nickname of the user
Returns
QColor *

References find(), KviIrcUserEntry::m_bNotFoundRegUserLookup, KviIrcUserEntry::m_cachedColor, KviIrcUserEntry::m_szLastRegisteredMatchNick, and registeredUser().

Referenced by KviUserListEntry::color(), and KviUserListViewArea::paintEvent().

KviPointerHashTable<QString, KviIrcUserEntry>* KviIrcUserDataBase::dict ( )
inline

Returns the database dictionary.

Returns
KviPointerHashTable<QString,KviIrcUserEntry> *
KviIrcUserEntry* KviIrcUserDataBase::find ( const QString &  szNick)
inline
bool KviIrcUserDataBase::haveCustomColor ( const QString &  szNick)

Returns true if the user has custom colors set.

Parameters
szNickThe nickname of the user
Returns
bool

References find(), KviIrcUserEntry::m_bNotFoundRegUserLookup, KviIrcUserEntry::m_bUseCustomColor, KviIrcUserEntry::m_szLastRegisteredMatchNick, and registeredUser().

Referenced by KviUserListEntry::color(), and KviUserListViewArea::paintEvent().

KviIrcUserEntry * KviIrcUserDataBase::insertUser ( const QString &  szNick,
const QString &  szUser,
const QString &  szHost 
)

Adds the user to the database.

Parameters
szNickThe nickname of the user
szUserThe username of the user
szHostThe hostname of the user
Returns
KviIrcUserEntry *

References KviPointerHashTable< Key, T >::find(), KviPointerHashTable< Key, T >::insert(), KviIrcUserEntry::m_nRefs, m_pDict, KviIrcUserEntry::m_szHost, KviIrcUserEntry::m_szUser, and szHost.

Referenced by KviUserListView::join().

void KviIrcUserDataBase::registeredDatabaseCleared ( )
protectedslot
KviRegisteredUser * KviIrcUserDataBase::registeredUser ( const QString &  szNick)
KviRegisteredUser * KviIrcUserDataBase::registeredUser ( const QString &  szNick,
const QString &  szUser,
const QString &  szHost 
)
void KviIrcUserDataBase::registeredUserAdded ( const QString &  szUser)
protectedslot

Slot called when a registered user is added.

Parameters
szUserThe user added
Returns
void

References KviPointerHashTableIterator< Key, T >::current(), KviIrcUserEntry::m_bNotFoundRegUserLookup, m_pDict, and KviIrcUserEntry::m_szRegisteredUserName.

Referenced by setupConnectionWithReguserDb().

void KviIrcUserDataBase::registeredUserChanged ( const QString &  szUser)
protectedslot

Slot called when a registered user is changed or removed.

Parameters
szUserThe user changed
Returns
void

References KviPointerHashTableIterator< Key, T >::current(), KviIrcUserEntry::m_bNotFoundRegUserLookup, m_pDict, and KviIrcUserEntry::m_szRegisteredUserName.

Referenced by setupConnectionWithReguserDb().

bool KviIrcUserDataBase::removeUser ( const QString &  szNick,
KviIrcUserEntry pEntry 
)

Decrements the user reference count and if it reaches 0 then deletes the user from the database.

Parameters
szNickThe nickname of the user
pEntryThe entry of the user
Returns
true if the reference count reached 0 and false otherwise (so true if the user was completely deleted from the db)

References KviIrcUserEntry::m_nRefs, m_pDict, and KviPointerHashTable< Key, T >::remove().

Referenced by KviUserListView::partInternal(), and KviUserListView::removeAllEntries().

void KviIrcUserDataBase::setupConnectionWithReguserDb ( )

Initialize the database by connecting signals and slots.

Returns
void

References connect(), g_pRegisteredUserDataBase, registeredDatabaseCleared(), registeredUserAdded(), and registeredUserChanged().

Referenced by KviIrcUserDataBase().

Member Data Documentation

KviPointerHashTable<QString, KviIrcUserEntry>* KviIrcUserDataBase::m_pDict
private

The documentation for this class was generated from the following files: