KVIrc
4.9.2
DeveloperAPIs
|
Irc user mask handling. More...
#include <KviIrcMask.h>
Public Types | |
enum | MaskType { NickUserHost = 0, NickUserNet = 1, NickUser = 2, NickHost = 3, NickNet = 4, Nick = 5, UserHost = 6, UserNet = 7, User = 8, Host = 9, Net = 10, NickCleanUserHost = 11, NickCleanUserNet = 12, NickCleanUser = 13, CleanUserHost = 14, CleanUserNet = 15, CleanUser = 16, NickUserLargeNet = 17, NickLargeNet = 18, UserLargeNet = 19, NickCleanUserLargeNet = 20, CleanUserLargeNet = 21, NickUserSmartNet = 22, NickSmartNet = 23, UserSmartNet = 24, NickCleanUserSmartNet = 25, CleanUserSmartNet = 26 } |
Defines the type of the masks. More... | |
Public Member Functions | |
bool | hasHost () const |
Returns true if the hostname is set in the mask. More... | |
bool | hasNumericHost () const |
Returns true if the hostname is a numeric IP. More... | |
bool | hasUser () const |
Returns true if the username is set in the mask. More... | |
bool | hasWildNick () |
Returns true if the nickname contains wildcards (* and ?) More... | |
const QString & | host () const |
Returns the hostname of this user. More... | |
KviIrcMask () | |
Constructs an empty mask (*!*@*) More... | |
KviIrcMask (const QString &szMask) | |
Constructs this KviIrcMask object from a string mask. More... | |
KviIrcMask (const KviIrcMask &ircUser) | |
Carbon copy. More... | |
KviIrcMask (const QString &nick, const QString &user, const QString &host) | |
Carbon copy. More... | |
void | mask (QString &szMask, MaskType eMaskType=NickCleanUserHost) const |
Returns in szMask the specified (if possible) mask of this user. More... | |
bool | matchedBy (const KviIrcMask &mask) const |
Fixed internal matches (this is fixed, external is wild) More... | |
bool | matches (const KviIrcMask &mask) const |
Wild external matches (this and external are wild) More... | |
bool | matchesFixed (const QString &szNick, const QString &szUser, const QString &szHost) const |
Fixed external matches (this is wild, external is fixed) More... | |
bool | matchesFixed (const KviIrcMask &mask) const |
Fixed external matches (this is wild, external is fixed) More... | |
bool | matchWildString (const QString &szExp, const QString &szStr) const |
Matches 2 strings. More... | |
const QString & | nick () const |
Returns the nickname of this user. More... | |
int | nonWildChars () |
Returns the number of non-wildcards characters in the mask. More... | |
bool | operator== (const KviIrcMask &user) |
Comparison. More... | |
void | setHost (const QString &szHost) |
Sets the host for this user. More... | |
void | setNick (const QString &szNick) |
Sets the nick for this user. More... | |
void | setUser (const QString &szUser) |
Sets the username for this user. More... | |
void | setUsername (const QString &szUser) |
Sets the username for this user. More... | |
const QString & | user () const |
Returns the username of this user. More... | |
Private Member Functions | |
QString | getHostDomainMask () const |
Returns the ip in the form xxx.xxx.xxx.*. More... | |
int | getIpDomainMaskLen () const |
Returns the number of characters which are parts of the IP. More... | |
QString | getLargeHostDomainMask () const |
Returns the ip in the form xxx.xxx.*. More... | |
int | getLargeIpDomainMaskLen () const |
Returns the number of characters which are parts of the IP. More... | |
bool | hasMaskedIp () const |
Returns true if the user has the ip in the mask. More... | |
Private Attributes | |
QString | m_szHost |
QString | m_szNick |
QString | m_szUser |
Static Private Attributes | |
static QString | m_szWild |
Friends | |
class | KviIrcUserChanList |
class | KviIrcUserList |
Irc user mask handling.
enum KviIrcMask::MaskType |
Defines the type of the masks.
KviIrcMask::KviIrcMask | ( | ) |
Constructs an empty mask (*!*@*)
KviIrcMask::KviIrcMask | ( | const QString & | szMask | ) |
Constructs this KviIrcMask object from a string mask.
szMask | The mask of the user |
|
inline |
|
inline |
Carbon copy.
nick | The nickname of the user |
user | The username of the user |
host | The hostname of the user |
|
private |
|
private |
|
private |
|
private |
|
inline |
Returns true if the hostname is set in the mask.
Referenced by KviIrcServerParser::parseNumericTopicWhoTime(), and KviUserListView::userAction().
|
private |
bool KviIrcMask::hasNumericHost | ( | ) | const |
Returns true if the hostname is a numeric IP.
References m_szHost.
Referenced by mask(), and mask_kvs_fnc_hasnumerichost().
|
inline |
Returns true if the username is set in the mask.
Referenced by KviIrcServerParser::parseNumericTopicWhoTime(), and KviUserListView::userAction().
bool KviIrcMask::hasWildNick | ( | ) |
Returns true if the nickname contains wildcards (* and ?)
References m_szNick.
Referenced by KviRegisteredUserDataBase::addMask(), and KviRegisteredUserDataBase::removeMaskByPointer().
|
inline |
Returns the hostname of this user.
In the worst case you get a string == "*"
Referenced by RegisteredUserEntryDialog::addMaskClicked(), dccModuleParseDccCanvas(), dccModuleParseDccChat(), dccModuleParseDccGet(), dccModuleParseDccRecv(), dccModuleParseDccRSend(), dccModuleParseDccSend(), dccModuleParseDccVideo(), dccModuleParseDccVoice(), KviIsOnNotifyListManager::doMatchUser(), KviWatchNotifyListManager::doMatchUser(), KviIrcServerParser::echoCtcpReply(), KviIrcServerParser::echoCtcpRequest(), RegisteredUserEntryDialog::editMaskClicked(), mask_kvs_fnc_host(), mask_kvs_fnc_match(), KviIrcServerParser::parseCtcpReply(), KviIrcServerParser::parseCtcpReplyAvatar(), KviIrcServerParser::parseCtcpReplyPing(), KviIrcServerParser::parseCtcpRequest(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseCtcpRequestDcc(), KviIrcServerParser::parseCtcpRequestPage(), KviIrcServerParser::parseNumericTopicWhoTime(), RegisteredUserMaskDialog::RegisteredUserMaskDialog(), reguser_kvs_fnc_mask(), reguser_kvs_fnc_match(), reguser_kvs_fnc_matchProperty(), KviQueryWindow::userAction(), and KviUserListView::userAction().
void KviIrcMask::mask | ( | QString & | szMask, |
MaskType | eMaskType = NickCleanUserHost |
||
) | const |
Returns in szMask the specified (if possible) mask of this user.
If the host or username are not known, the mask may contain less information than requested.
Mask types: 0: nick!user\machine.host.top (nick!user\XXX.XXX.XXX.XXX) (default) 1: nick!user@*.host.top (nick!user\XXX.XXX.XXX.*) 2: nick!user@* 3: nick!*\machine.host.top (nick!user\XXX.XXX.XXX.XXX) 4: nick!*@*.host.top (nick!user\XXX.XXX.XXX.*) 5: nick!*@* 6: *!user\machine.host.top (*!user\XXX.XXX.XXX.XX) 7: *!user@*.host.top (*!user\XXX.XXX.XXX.*) 8: *!user@* 9: *!*\machine.host.top (*!*\XXX.XXX.XXX.XXX) 10: *!*@*.host.top (*!*\XXX.XXX.XXX.*) 11: nick!*user\machine.host.top (nick!*user\machine.host.top) 12: nick!*user@*.host.top (nick!*user@*.host.top) 13: nick!*user@* 14: *!*user\machine.host.top (*!*user\machine.host.top) 15: *!*user@*.host.top (*!*user@*.host.top) 16: *!*user@* 17: nick!~user@*.host.top (nick!~user\XXX.XXX.*) 18: nick!*@*.host.top (nick!*\XXX.XXX.*) 19: *!~user@*.host.top (*!~user\XXX.XXX.*) 20: nick!*user@*.host.top (nick!*user\XXX.XXX.*) 21: *!*user@*.host.top (*!user@*XXX.XXX.*)
Smart versions of the masks 17-21 that try take care of masked ip addresses in the form xxx.xxx.INVALID-TOP-MASK 22: nick!~user@*.host.top (nick!~user\XXX.XXX.*) 23: nick!*@*.host.top (nick!*\XXX.XXX.*) 24: *!~user@*.host.top (*!~user\XXX.XXX.*) 25: nick!*user@*.host.top (nick!*user\XXX.XXX.*) 26: *!*user@*.host.top (*!user@*XXX.XXX.*)
If some data is missing, these types may change: For example, if hostname is missing, the mask type 3 or 4 may be reduced to type 5
ident is fun.. ahem prefixes used: none I line with ident ^ I line with OTHER type ident ~ I line, no ident
szMask | The mask of the user |
eMaskType | The mask type |
References getHostDomainMask(), getIpDomainMaskLen(), getLargeHostDomainMask(), getLargeIpDomainMaskLen(), hasMaskedIp(), hasNumericHost(), m_szHost, m_szNick, m_szUser, m_szWild, NickUserHost, szHost, and ucMaskTable.
Referenced by dccModuleParseDccGet(), KviConsoleWindow::getUserTipText(), KviKvsCoreFunctions::KVSCF(), KviAvatarCache::lookup(), OptionsWidget_channelAdvanced::OptionsWidget_channelAdvanced(), KviIrcServerParser::parseCtcpRequestAvatar(), KviAvatarCache::remove(), KviAvatarCache::replace(), and sharedfile_kvs_cmd_add().
|
inline |
Fixed internal matches (this is fixed, external is wild)
mask | The mask of the user |
References matchesFixed().
Referenced by KviSharedFilesManager::lookupSharedFile(), and KviNickServRuleSet::matchRule().
bool KviIrcMask::matches | ( | const KviIrcMask & | mask | ) | const |
Wild external matches (this and external are wild)
mask | The mask of the user |
References m_szHost, m_szNick, m_szUser, and KviQString::matchWildExpressions().
bool KviIrcMask::matchesFixed | ( | const QString & | szNick, |
const QString & | szUser, | ||
const QString & | szHost | ||
) | const |
Fixed external matches (this is wild, external is fixed)
szNick | The nickname of the user |
szUser | The username of the user |
szHost | The hostname of the user |
References m_szHost, m_szNick, m_szUser, and matchWildString().
Referenced by chan_kvs_fnc_users(), mask_kvs_fnc_match(), matchedBy(), and KviIrcServerParser::parseChannelMode().
bool KviIrcMask::matchesFixed | ( | const KviIrcMask & | mask | ) | const |
Fixed external matches (this is wild, external is fixed)
mask | The make of the user |
References m_szHost, m_szNick, m_szUser, and matchWildString().
bool KviIrcMask::matchWildString | ( | const QString & | szExp, |
const QString & | szStr | ||
) | const |
Matches 2 strings.
szExp | First string; can contains wildcards; special escape applies |
szStr | Second string, fixed |
Referenced by matchesFixed().
|
inline |
Returns the nickname of this user.
In the worst case you get a string == "*"
Referenced by KviRegisteredUserDataBase::addMask(), RegisteredUserEntryDialog::addMaskClicked(), dcc_module_reply_errmsg(), dccModuleParseDccCanvas(), dccModuleParseDccChat(), dccModuleParseDccGet(), dccModuleParseDccRecv(), dccModuleParseDccRSend(), dccModuleParseDccSend(), dccModuleParseDccVideo(), dccModuleParseDccVoice(), KviIsOnNotifyListManager::doMatchUser(), KviWatchNotifyListManager::doMatchUser(), KviIrcServerParser::echoCtcpReply(), KviIrcServerParser::echoCtcpRequest(), RegisteredUserEntryDialog::editMaskClicked(), KviRegisteredUserDataBase::findExactMask(), DccBroker::handleResumeRequest(), mask_kvs_fnc_match(), mask_kvs_fnc_nick(), KviIrcServerParser::parseCtcpReply(), KviIrcServerParser::parseCtcpReplyAvatar(), KviIrcServerParser::parseCtcpReplyPing(), KviIrcServerParser::parseCtcpReplyUserinfo(), KviIrcServerParser::parseCtcpRequest(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseCtcpRequestDcc(), KviIrcServerParser::parseCtcpRequestPage(), KviIrcServerParser::parseNumericTopicWhoTime(), RegisteredUserMaskDialog::RegisteredUserMaskDialog(), reguser_kvs_fnc_mask(), reguser_kvs_fnc_match(), reguser_kvs_fnc_matchProperty(), KviRegisteredUserDataBase::removeMaskByPointer(), KviIrcServerParser::replyCtcp(), KviQueryWindow::userAction(), KviUserListView::userAction(), and KviChannelWindow::userAction().
int KviIrcMask::nonWildChars | ( | ) |
Returns the number of non-wildcards characters in the mask.
References m_szHost, m_szNick, and m_szUser.
Referenced by KviRegisteredUserMask::KviRegisteredUserMask().
bool KviIrcMask::operator== | ( | const KviIrcMask & | user | ) |
Comparison.
user | The username of the user |
References KviQString::equalCI(), m_szHost, m_szNick, and m_szUser.
|
inline |
Sets the host for this user.
If szHost is NULL or it points to an empty string the host is set to "*".
szHost | The hostname of the user |
References szHost.
Referenced by KviKvsCoreFunctions::KVSCF(), and RegisteredUserMaskDialog::okClicked().
|
inline |
Sets the nick for this user.
If szNick is NULL or it points to an empty string the nick is set to "*".
szNick | The nickname of the user |
Referenced by KviKvsCoreFunctions::KVSCF(), and RegisteredUserMaskDialog::okClicked().
|
inline |
Sets the username for this user.
If szUsername is NULL or it points to an empty string the username is set to "*". This is an alias of setUsername()
szUser | The username of the user |
|
inline |
Sets the username for this user.
If szUsername is NULL or it points to an empty string the username is set to "*".
szUser | The username of the user |
Referenced by KviKvsCoreFunctions::KVSCF(), and RegisteredUserMaskDialog::okClicked().
|
inline |
Returns the username of this user.
In the worst case you get a string == "*"
Referenced by RegisteredUserEntryDialog::addMaskClicked(), dccModuleParseDccChat(), dccModuleParseDccGet(), dccModuleParseDccRecv(), dccModuleParseDccRSend(), dccModuleParseDccSend(), dccModuleParseDccVideo(), dccModuleParseDccVoice(), KviIsOnNotifyListManager::doMatchUser(), KviWatchNotifyListManager::doMatchUser(), KviIrcServerParser::echoCtcpReply(), KviIrcServerParser::echoCtcpRequest(), RegisteredUserEntryDialog::editMaskClicked(), mask_kvs_fnc_match(), mask_kvs_fnc_user(), KviIrcServerParser::parseCtcpReply(), KviIrcServerParser::parseCtcpReplyAvatar(), KviIrcServerParser::parseCtcpReplyPing(), KviIrcServerParser::parseCtcpRequest(), KviIrcServerParser::parseCtcpRequestAction(), KviIrcServerParser::parseCtcpRequestDcc(), KviIrcServerParser::parseCtcpRequestPage(), KviIrcServerParser::parseNumericTopicWhoTime(), RegisteredUserMaskDialog::RegisteredUserMaskDialog(), reguser_kvs_fnc_mask(), reguser_kvs_fnc_match(), reguser_kvs_fnc_matchProperty(), KviQueryWindow::userAction(), and KviUserListView::userAction().
|
friend |
|
friend |
|
private |
|
private |
Referenced by hasWildNick(), KviIrcMask(), mask(), matches(), matchesFixed(), nonWildChars(), and operator==().
|
private |
Referenced by KviIrcMask(), mask(), matches(), matchesFixed(), nonWildChars(), and operator==().
|
staticprivate |
Referenced by KviIrcMask(), and mask().