summaryrefslogtreecommitdiffstats
path: root/src/kvilib/irc/kvi_ircmask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kvilib/irc/kvi_ircmask.cpp')
-rw-r--r--src/kvilib/irc/kvi_ircmask.cpp196
1 files changed, 98 insertions, 98 deletions
diff --git a/src/kvilib/irc/kvi_ircmask.cpp b/src/kvilib/irc/kvi_ircmask.cpp
index dbdc1b6c..4460cba6 100644
--- a/src/kvilib/irc/kvi_ircmask.cpp
+++ b/src/kvilib/irc/kvi_ircmask.cpp
@@ -29,18 +29,18 @@
#include "kvi_ircmask.h"
/*
- @doc: irc_masks
+ @doc: irc_tqmasks
@title:
- Irc masks
+ Irc tqmasks
@type:
generic
@short:
- Decription of the standard IRC masks
+ Decription of the standard IRC tqmasks
@keyterms:
- irc masks , nickname , username , hostname , wildcard
+ irc tqmasks , nickname , username , hostname , wildcard
@body:
- [big]Simple masks[/big][br]
- An irc mask is a string in a special format that identifies an user on irc.[br]
+ [big]Simple tqmasks[/big][br]
+ An irc tqmask is a string in a special format that identifies an user on irc.[br]
The standard basic format is:[br]
[b]<nick>!<username>@<host>[/b][br]
The <nick> part contains the nickname with that the user is widely known across the network.[br]
@@ -60,7 +60,7 @@
+: i line with ident[br]
=: i line with OTHER type ident[br]
-: i line, no ident[br]
- So finally you can find <username> strings like "~pragma" or "^pragma", where "pragma"
+ So finally you can tqfind <username> strings like "~pragma" or "^pragma", where "pragma"
is the system username of the irc-user and ~ and ^ are prefixes.[br]
The <host> part is the hostname of the remote user.[br]
In most cases it is the human-readable format of the host name, but sometimes
@@ -68,23 +68,23 @@
The IP address can be either in IPV4 format or in IPV6 format.[br]
Some (weird from my point of view) servers hide certain parts of the IP address to
prevent attacks to the user's machine.[br]
- Here are some examples of full irc-masks:[br]
+ Here are some examples of full irc-tqmasks:[br]
Pragma!^pragma@staff.kvirc.net[br]
[jazz]!~jazz@jazz.myhome.com[br]
luke!=skywalker@212.213.41.12[br]
HAN!^solo@ff0f:a0a0:1011::ea80:1[br]
Darth!vader@210.11.12.XXX[br]
- The irc-masks are [b]case insensitive[/b].[br]
+ The irc-tqmasks are [b]case insensitive[/b].[br]
[br]
- [big]Wildcard masks[/big][br]
- In some contexts the irc-masks can contain '*' and '?' wildcards.[br]
- The wild masks are used to "match" an user within a set of them.[br]
+ [big]Wildcard tqmasks[/big][br]
+ In some contexts the irc-tqmasks can contain '*' and '?' wildcards.[br]
+ The wild tqmasks are used to "match" an user within a set of them.[br]
'*' matches any sequence (eventually empty) of characters and '?' matches a single character.[br]
Wildcards are allowed only in the <nick> , <user> and <host> part: so the
- "wildest" mask possible is:[br]
+ "wildest" tqmask possible is:[br]
[b]*!*@*[/b][br]
that designates "any nickname, any username on any host".[br]
- Here are some examples of wild masks:[br]
+ Here are some examples of wild tqmasks:[br]
Pragma!*pragma@212.101.102.*: matches any user with nickname "Pragma" , username that ends with "pragma" and
coming from any machine on the 212.101.102 network.[br]
*!solo@*.starwars.org: matches any nick with username solo (no prefix!) coming from any machine in
@@ -225,15 +225,15 @@ KviIrcMask::KviIrcMask()
m_szNick = m_szWild;
}
-KviIrcMask::KviIrcMask(const QString &szMask)
+KviIrcMask::KviIrcMask(const TQString &szMask)
{
- static QString szWild("*");
- const QChar * b = KviQString::nullTerminatedArray(szMask);
+ static TQString szWild("*");
+ const TQChar * b = KviTQString::nullTerminatedArray(szMask);
if(b)
{
- const QChar * p = b;
- while(p->unicode() && (p->unicode() != '!'))p++;
- if(p->unicode())
+ const TQChar * p = b;
+ while(p->tqunicode() && (p->tqunicode() != '!'))p++;
+ if(p->tqunicode())
{
if(p != b)
{
@@ -250,8 +250,8 @@ KviIrcMask::KviIrcMask(const QString &szMask)
}
p++;
b = p;
- while(p->unicode() && (p->unicode() != '@'))p++;
- if(p->unicode())
+ while(p->tqunicode() && (p->tqunicode() != '@'))p++;
+ if(p->tqunicode())
{
if(p != b)
{
@@ -267,7 +267,7 @@ KviIrcMask::KviIrcMask(const QString &szMask)
}
p++;
b=p;
- while(p->unicode())p++;
+ while(p->tqunicode())p++;
if(p != b)
{
m_szHost.setUnicode(b,p-b);
@@ -282,27 +282,27 @@ KviIrcMask::KviIrcMask(const QString &szMask)
}
}
-QString KviIrcMask::m_szWild("*");
+TQString KviIrcMask::m_szWild("*");
bool KviIrcMask::hasNumericHost() const
{
- const QChar * p = KviQString::nullTerminatedArray(m_szHost);
+ const TQChar * p = KviTQString::nullTerminatedArray(m_szHost);
if(!p)return false;
int nPoints = 0;
int nDoublePoints = 0;
unsigned short uc;
- while((uc = p->unicode()))
+ while((uc = p->tqunicode()))
{
- if(uc == '.')nPoints++; // ipv6 masks can contain dots too!
+ if(uc == '.')nPoints++; // ipv6 tqmasks can contain dots too!
else {
if(uc == ':')nDoublePoints++;
else {
if((uc < '0') || (uc > '9'))
{
#ifdef COMPILE_USE_QT4
- uc = p->toUpper().unicode();
+ uc = p->toUpper().tqunicode();
#else
- uc = p->upper().unicode();
+ uc = p->upper().tqunicode();
#endif
if((uc < 'A') || (uc > 'F'))return false;
}
@@ -315,8 +315,8 @@ bool KviIrcMask::hasNumericHost() const
/**
-* Retuns in szMask the specified (if possible) mask of this user.<br>
-* If the host or username are not known , the mask may contain less information
+* Retuns in szMask the specified (if possible) tqmask of this user.<br>
+* If the host or username are not known , the tqmask may contain less information
* than requested.<br>
* Mask types:<br>
* 0 : nick!user@machine.host.top (nick!user@XXX.XXX.XXX.XXX) (default)<br>
@@ -341,7 +341,7 @@ bool KviIrcMask::hasNumericHost() const
* 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
+* smart versions of the tqmasks 17-21 that try take care of tqmasked 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.*)
@@ -349,7 +349,7 @@ bool KviIrcMask::hasNumericHost() const
* 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:<br>
-* For example , if hostname is missing , the mask type 3 or 4 may be reduced to type 5
+* For example , if hostname is missing , the tqmask type 3 or 4 may be reduced to type 5
*/
/*
@@ -363,13 +363,13 @@ bool KviIrcMask::hasNumericHost() const
** - i line, no ident
*/
-static unsigned char maskTable[27][3] = {
+static unsigned char tqmaskTable[27][3] = {
{ 0 , 0 , 0 }, //0 means normal block
- { 0 , 0 , 2 }, //2 in the third field means type *.abc.host.top (or XXX.XXX.XXX.*) host mask
+ { 0 , 0 , 2 }, //2 in the third field means type *.abc.host.top (or XXX.XXX.XXX.*) host tqmask
{ 0 , 0 , 1 }, //2 in the second field means *user (strip prefixes)
{ 0 , 1 , 0 }, //1 means *
- { 0 , 1 , 2 }, //3 in the third field means type *.host.top (or XXX.XXX.*) host mask
- { 0 , 1 , 1 }, //4 in the third field is like 3 but tries to detect masked ip addresses too
+ { 0 , 1 , 2 }, //3 in the third field means type *.host.top (or XXX.XXX.*) host tqmask
+ { 0 , 1 , 1 }, //4 in the third field is like 3 but tries to detect tqmasked ip addresses too
{ 1 , 0 , 0 },
{ 1 , 0 , 2 },
{ 1 , 0 , 1 },
@@ -393,12 +393,12 @@ static unsigned char maskTable[27][3] = {
{ 1 , 2 , 4 }
};
-void KviIrcMask::mask(QString &szMask,MaskType eMaskType) const
+void KviIrcMask::tqmask(TQString &szMask,MaskType eMaskType) const
{
if((((int)eMaskType) > 26)||(((int)eMaskType) < 0))eMaskType = NickUserHost;
- szMask = maskTable[((int)eMaskType)][0] ? m_szWild : m_szNick;
+ szMask = tqmaskTable[((int)eMaskType)][0] ? m_szWild : m_szNick;
szMask.append("!");
- switch(maskTable[((int)eMaskType)][1])
+ switch(tqmaskTable[((int)eMaskType)][1])
{
case 0:
szMask.append(m_szUser);
@@ -408,20 +408,20 @@ void KviIrcMask::mask(QString &szMask,MaskType eMaskType) const
break;
default:
if (m_szUser.length() > 0) {
- if(m_szUser[0].unicode() != '*')
+ if(m_szUser[0].tqunicode() != '*')
szMask.append(m_szWild);
- if ((m_szUser[0].unicode() == '~') ||
- (m_szUser[0].unicode() == '^') ||
- (m_szUser[0].unicode() == '+') ||
- (m_szUser[0].unicode() == '-') ||
- (m_szUser[0].unicode() == '='))szMask.append(m_szUser.right(m_szUser.length() - 1));
+ if ((m_szUser[0].tqunicode() == '~') ||
+ (m_szUser[0].tqunicode() == '^') ||
+ (m_szUser[0].tqunicode() == '+') ||
+ (m_szUser[0].tqunicode() == '-') ||
+ (m_szUser[0].tqunicode() == '='))szMask.append(m_szUser.right(m_szUser.length() - 1));
else
szMask.append(m_szUser);
}
break;
}
szMask.append('@');
- switch(maskTable[((int)eMaskType)][2])
+ switch(tqmaskTable[((int)eMaskType)][2])
{
case 0:
szMask.append(m_szHost);
@@ -434,7 +434,7 @@ void KviIrcMask::mask(QString &szMask,MaskType eMaskType) const
{
if(hasNumericHost())
{
- QString szHost(m_szHost.left(getIpDomainMaskLen()));
+ TQString szHost(m_szHost.left(getIpDomainMaskLen()));
szMask.append(szHost);
szMask.append(m_szWild);
} else {
@@ -450,7 +450,7 @@ void KviIrcMask::mask(QString &szMask,MaskType eMaskType) const
{
if(hasNumericHost())
{
- QString szHost(m_szHost.left(getLargeIpDomainMaskLen()));
+ TQString szHost(m_szHost.left(getLargeIpDomainMaskLen()));
szMask.append(szHost);
szMask.append(m_szWild);
} else {
@@ -466,7 +466,7 @@ void KviIrcMask::mask(QString &szMask,MaskType eMaskType) const
{
if(hasNumericHost() || hasMaskedIp())
{
- QString szHost(m_szHost.left(getLargeIpDomainMaskLen()));
+ TQString szHost(m_szHost.left(getLargeIpDomainMaskLen()));
szMask.append(szHost);
szMask.append(m_szWild);
} else {
@@ -532,7 +532,7 @@ bool KviIrcMask::matchesFixed(const char *szMask) const
*/
/*
-bool KviIrcMask::matchedBy(const QString &szMask) const
+bool KviIrcMask::matchedBy(const TQString &szMask) const
{
const char * ret1;
const char * ret2;
@@ -556,25 +556,25 @@ bool KviIrcMask::matchedBy(const QString &szMask) const
}
*/
-bool KviIrcMask::matches(const KviIrcMask &mask) const
+bool KviIrcMask::matches(const KviIrcMask &tqmask) const
{
- if(KviQString::matchWildExpressionsCI(m_szNick,mask.m_szNick))
+ if(KviTQString::matchWildExpressionsCI(m_szNick,tqmask.m_szNick))
{
- if(KviQString::matchWildExpressionsCI(m_szUser,mask.m_szUser))
+ if(KviTQString::matchWildExpressionsCI(m_szUser,tqmask.m_szUser))
{
- if(KviQString::matchWildExpressionsCI(m_szHost,mask.m_szHost))return true;
+ if(KviTQString::matchWildExpressionsCI(m_szHost,tqmask.m_szHost))return true;
}
}
return false;
}
-bool KviIrcMask::matchesFixed(const KviIrcMask &mask) const
+bool KviIrcMask::matchesFixed(const KviIrcMask &tqmask) const
{
- if(KviQString::matchStringCI(m_szNick,mask.m_szNick,0,1))
+ if(KviTQString::matchStringCI(m_szNick,tqmask.m_szNick,0,1))
{
- if(KviQString::matchStringCI(m_szUser,mask.m_szUser,0,1))
+ if(KviTQString::matchStringCI(m_szUser,tqmask.m_szUser,0,1))
{
- if(KviQString::matchStringCI(m_szHost,mask.m_szHost,0,1))return true;
+ if(KviTQString::matchStringCI(m_szHost,tqmask.m_szHost,0,1))return true;
}
}
return false;
@@ -601,26 +601,26 @@ bool KviIrcMask::matches(const char * nick,const char * user,const char * host)
}
*/
-bool KviIrcMask::matchesFixed(const QString &nick,const QString &user,const QString &host) const
+bool KviIrcMask::matchesFixed(const TQString &nick,const TQString &user,const TQString &host) const
{
- if(!KviQString::matchStringCI(m_szNick,nick,0,1))return false;
- if(!KviQString::matchStringCI(m_szUser,user,0,1))return false;
- if(!KviQString::matchStringCI(m_szHost,host,0,1))return false;
+ if(!KviTQString::matchStringCI(m_szNick,nick,0,1))return false;
+ if(!KviTQString::matchStringCI(m_szUser,user,0,1))return false;
+ if(!KviTQString::matchStringCI(m_szHost,host,0,1))return false;
return true;
}
-//Internals for mask()
+//Internals for tqmask()
int KviIrcMask::getIpDomainMaskLen() const
{
int len = m_szHost.length();
- const QChar *p = m_szHost.unicode();
- const QChar *b = p;
+ const TQChar *p = m_szHost.tqunicode();
+ const TQChar *b = p;
p += len;
if(b < p)
{
p--;
- while((b < p) && (p->unicode() != '.') && (p->unicode() != ':'))p--;
+ while((b < p) && (p->tqunicode() != '.') && (p->tqunicode() != ':'))p--;
}
// 000.000.000.000
// p
@@ -632,17 +632,17 @@ int KviIrcMask::getIpDomainMaskLen() const
int KviIrcMask::getLargeIpDomainMaskLen() const
{
int len = m_szHost.length();
- const QChar *p = m_szHost.unicode();
- const QChar *b = p;
+ const TQChar *p = m_szHost.tqunicode();
+ const TQChar *b = p;
p += len;
if(b < p)
{
p--;
- while((b < p) && (p->unicode() != '.') && (p->unicode() != ':'))p--;
+ while((b < p) && (p->tqunicode() != '.') && (p->tqunicode() != ':'))p--;
if(b < p)
{
p--;
- while((b < p) && (p->unicode() != '.') && (p->unicode() != ':'))p--;
+ while((b < p) && (p->tqunicode() != '.') && (p->tqunicode() != ':'))p--;
}
}
// 000.000.000.000
@@ -651,40 +651,40 @@ int KviIrcMask::getLargeIpDomainMaskLen() const
return (p == b) ? 0 : ((p-b) + 1);
}
-QString KviIrcMask::getHostDomainMask() const
+TQString KviIrcMask::getHostDomainMask() const
{
int len = m_szHost.length();
- const QChar *p=KviQString::nullTerminatedArray(m_szHost);
- if(!p)return QString::null;
- const QChar *b = p;
- while(p->unicode() && p->unicode() != '.')p++;
- QString ret(p,len - (p - b));
+ const TQChar *p=KviTQString::nullTerminatedArray(m_szHost);
+ if(!p)return TQString();
+ const TQChar *b = p;
+ while(p->tqunicode() && p->tqunicode() != '.')p++;
+ TQString ret(p,len - (p - b));
return ret;
}
-QString KviIrcMask::getLargeHostDomainMask() const
+TQString KviIrcMask::getLargeHostDomainMask() const
{
int len = m_szHost.length();
- const QChar *p = m_szHost.unicode();
- const QChar *b = p;
+ const TQChar *p = m_szHost.tqunicode();
+ const TQChar *b = p;
p += len;
if(b < p)
{
p--;
- while((b < p) && (p->unicode() != '.'))p--;
+ while((b < p) && (p->tqunicode() != '.'))p--;
if(b < p)
{
p--;
- while((b < p) && (p->unicode() != '.'))p--;
+ while((b < p) && (p->tqunicode() != '.'))p--;
}
}
// xyz.klm.abc.host.top
// p
- QString ret(p,len - (p - b));
+ TQString ret(p,len - (p - b));
return ret;
}
@@ -692,25 +692,25 @@ QString KviIrcMask::getLargeHostDomainMask() const
bool KviIrcMask::hasMaskedIp() const
{
int len = m_szHost.length();
- const QChar *p = m_szHost.unicode();
- const QChar *b = p;
+ const TQChar *p = m_szHost.tqunicode();
+ const TQChar *b = p;
if(len == 0)return false;
//run to the end
p += len;
- const QChar *e = p;
+ const TQChar *e = p;
p--;
- while((b < p) && (p->unicode() != '.'))p--;
+ while((b < p) && (p->tqunicode() != '.'))p--;
return ((e - p) > 4); // at the moment 4 should be enough : the largest top part is "name"
}
bool KviIrcMask::operator==(const KviIrcMask &user)
{
- if(KviQString::equalCI(m_szNick,user.m_szNick))
+ if(KviTQString::equalCI(m_szNick,user.m_szNick))
{
- if(KviQString::equalCI(m_szUser,user.m_szUser))
+ if(KviTQString::equalCI(m_szUser,user.m_szUser))
{
- if(KviQString::equalCI(m_szHost,user.m_szHost))return true;
+ if(KviTQString::equalCI(m_szHost,user.m_szHost))return true;
}
}
return false;
@@ -718,10 +718,10 @@ bool KviIrcMask::operator==(const KviIrcMask &user)
bool KviIrcMask::hasWildNick()
{
- const QChar * aux = KviQString::nullTerminatedArray(m_szNick);
+ const TQChar * aux = KviTQString::nullTerminatedArray(m_szNick);
if(!aux)return false;
unsigned short uc;
- while((uc = aux->unicode()))
+ while((uc = aux->tqunicode()))
{
if((uc == '*') || (uc == '?'))return true;
aux++;
@@ -732,26 +732,26 @@ bool KviIrcMask::hasWildNick()
int KviIrcMask::nonWildChars()
{
int iCnt = 0;
- const QChar * aux = KviQString::nullTerminatedArray(m_szNick);
+ const TQChar * aux = KviTQString::nullTerminatedArray(m_szNick);
if(!aux)return 0;
unsigned short uc;
- while((uc = aux->unicode()))
+ while((uc = aux->tqunicode()))
{
if((uc != '*') && (uc != '?'))iCnt++;
aux++;
}
- aux = KviQString::nullTerminatedArray(m_szUser);
- while((uc = aux->unicode()))
+ aux = KviTQString::nullTerminatedArray(m_szUser);
+ while((uc = aux->tqunicode()))
{
if((uc != '*') && (uc != '?'))iCnt++;
aux++;
}
- aux = KviQString::nullTerminatedArray(m_szHost);
- while((uc = aux->unicode()))
+ aux = KviTQString::nullTerminatedArray(m_szHost);
+ while((uc = aux->tqunicode()))
{
if((uc != '*') && (uc != '?'))iCnt++;
aux++;