summaryrefslogtreecommitdiffstats
path: root/src/kvilib/ext/kvi_regusersdb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kvilib/ext/kvi_regusersdb.cpp')
-rw-r--r--src/kvilib/ext/kvi_regusersdb.cpp150
1 files changed, 75 insertions, 75 deletions
diff --git a/src/kvilib/ext/kvi_regusersdb.cpp b/src/kvilib/ext/kvi_regusersdb.cpp
index 6145d0ba..1edd2d77 100644
--- a/src/kvilib/ext/kvi_regusersdb.cpp
+++ b/src/kvilib/ext/kvi_regusersdb.cpp
@@ -42,7 +42,7 @@
@short:
Registration of users in KVIrc
@keyterms:
- registered users, registration tqmask, registered user properties,
+ registered users, registration mask, registered user properties,
user properties, notify property, avatar property
@body:
[big]Introduction[/big][br]
@@ -59,7 +59,7 @@
are used to recognize the user on irc.[br]
[br]
[big]Registration masks[/big][br]
- The masks have the common IRC tqmask format: [b]<nick>!<user>@<host>[/b][br]
+ The masks have the common IRC mask format: [b]<nick>!<user>@<host>[/b][br]
The masks may contain '*' and '?' wildcards that match any portion of text.[br]
[b]*!*@*[/b][br]
[b]Pragma!*@*[/b][br]
@@ -69,33 +69,33 @@
[b]Pragma!~daemon@some.host.it[/b][br]
Are examples of valid registration masks.[br]
The masks with wildcards can actually match more than a single user.[br]
- For example the tqmask *!root@*.host.com will match all the users
+ For example the mask *!root@*.host.com will match all the users
having root as username and coming from the host.com domain.[br]
For this reason putting wildcards in nicknames could become a problem
if not used carefully (but may also be used to achieve interesting tricks).[br]
If you don't use wildcards in nicknames you are sure that
- in a single irc connection , a tqmask will always refer to a single user.[br]
+ in a single irc connection , a mask will always refer to a single user.[br]
You will commonly use the following format:[br]
<nick>!*<username>@*.<host>.<top>[br]
or[br]
<nick>!*<username>@<number>.<number>.<number>.*[br]
- In this way you can be 95% sure that the tqmask will really match the correct user.[br]
+ In this way you can be 95% sure that the mask will really match the correct user.[br]
[br]
[big]Example of registration and lookups[/big]
Assume that you want to registere a friend of yours: Derek Riggs.[br]
Derek often uses "Eddie" as his nickname
"stranger" as username and has a dial-up connection that makes his IP address appear as
<variable-number>.somewhere.in.time.org.[br]
- You will add an entry with name "Derek Riggs" and a registration tqmask like the following:
+ You will add an entry with name "Derek Riggs" and a registration mask like the following:
Eddie!stranger@*.somewhere.in.time.org.[br]
If the IRC servers keep adding strange characters ([doc:irc_masks]prefixes[/doc]) at the beginning of his username you may use
Eddie!*stranger@*.somewhere.in.time.org.[br]
- If Eddie also often connects from the wasted.years.org domain and gets 'eddie' as username there, you might add a second registration tqmask as follows:
+ If Eddie also often connects from the wasted.years.org domain and gets 'eddie' as username there, you might add a second registration mask as follows:
Eddie!*eddie@*.wasted.years.org.[br]
- An alternative could be use only one tqmask with *.org as domain and allow any username (Eddie!*@*.org) but this
+ An alternative could be use only one mask with *.org as domain and allow any username (Eddie!*@*.org) but this
could become dangerous since it could match the users that you don't want to.[br]
On the other hand, if you dislike the users with the nickname Eddie that come from .org
- and you're implementing an auto-kick system, the correct tqmask to register is "Eddie!*@*.org".[br]
+ and you're implementing an auto-kick system, the correct mask to register is "Eddie!*@*.org".[br]
[br]
KVirc ties to be smart , and always find the most correct match for an user:
If you have two masks registered: Pragma!*xor@*.myisp.it and *!*@*.myisp.it,
@@ -162,47 +162,47 @@ bool KviRegisteredUser::isIgnoreEnabledFor(IgnoreFlags flag)
return m_iIgnoreFlags & flag;
}
-KviIrcMask * KviRegisteredUser::findMask(const KviIrcMask &tqmask)
+KviIrcMask * KviRegisteredUser::findMask(const KviIrcMask &mask)
{
for(KviIrcMask * m = m_pMaskList->first();m;m = m_pMaskList->next())
{
- if(*m == tqmask)return m;
+ if(*m == mask)return m;
}
return 0;
}
-bool KviRegisteredUser::addMask(KviIrcMask * tqmask)
+bool KviRegisteredUser::addMask(KviIrcMask * mask)
{
- if(findMask(*tqmask))
+ if(findMask(*mask))
{
- delete tqmask;
- tqmask = 0;
+ delete mask;
+ mask = 0;
return false;
}
- m_pMaskList->append(tqmask);
+ m_pMaskList->append(mask);
return true;
}
-bool KviRegisteredUser::removeMask(KviIrcMask * tqmask)
+bool KviRegisteredUser::removeMask(KviIrcMask * mask)
{
- if(!tqmask)return false;
- return m_pMaskList->removeRef(tqmask);
+ if(!mask)return false;
+ return m_pMaskList->removeRef(mask);
}
-bool KviRegisteredUser::matches(const KviIrcMask &tqmask)
+bool KviRegisteredUser::matches(const KviIrcMask &mask)
{
for(KviIrcMask * m = m_pMaskList->first();m;m = m_pMaskList->next())
{
- if(m->matches(tqmask))return true;
+ if(m->matches(mask))return true;
}
return false;
}
-bool KviRegisteredUser::matchesFixed(const KviIrcMask &tqmask)
+bool KviRegisteredUser::matchesFixed(const KviIrcMask &mask)
{
for(KviIrcMask * m = m_pMaskList->first();m;m = m_pMaskList->next())
{
- if(m->matchesFixed(tqmask))return true;
+ if(m->matchesFixed(mask))return true;
}
return false;
}
@@ -359,9 +359,9 @@ KviRegisteredUser * KviRegisteredUserDataBase::getUser(const TQString & name)
return u;
}
-static void append_mask_to_list(KviRegisteredMaskList *l,KviRegisteredUser *u,KviIrcMask *tqmask)
+static void append_mask_to_list(KviRegisteredMaskList *l,KviRegisteredUser *u,KviIrcMask *mask)
{
- KviRegisteredMask * newMask = new KviRegisteredMask(u,tqmask);
+ KviRegisteredMask * newMask = new KviRegisteredMask(u,mask);
int idx = 0;
for(KviRegisteredMask * m = l->first();m;m = l->next())
{
@@ -375,20 +375,20 @@ static void append_mask_to_list(KviRegisteredMaskList *l,KviRegisteredUser *u,Kv
l->append(newMask);
}
-KviRegisteredUser * KviRegisteredUserDataBase::addMask(KviRegisteredUser * u,KviIrcMask * tqmask)
+KviRegisteredUser * KviRegisteredUserDataBase::addMask(KviRegisteredUser * u,KviIrcMask * mask)
{
- if(!u || !tqmask) return 0;
+ if(!u || !mask) return 0;
__range_valid(u == m_pUserDict->find(u->name()));
KviRegisteredMaskList * l;
- if(tqmask->hasWildNick())
+ if(mask->hasWildNick())
{
for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next())
{
- if(*(m->tqmask()) == *tqmask)
+ if(*(m->mask()) == *mask)
{
- delete tqmask;
- tqmask = 0;
+ delete mask;
+ mask = 0;
return m->user();
}
}
@@ -396,44 +396,44 @@ KviRegisteredUser * KviRegisteredUserDataBase::addMask(KviRegisteredUser * u,Kvi
// masks with more info go first in the list
l = m_pWildMaskList;
} else {
- l = m_pMaskDict->find(tqmask->nick());
+ l = m_pMaskDict->find(mask->nick());
if(l)
{
// FIXME: #warning "Here we could compare the host and username only: nick matches for sure"
for(KviRegisteredMask * m = l->first();m;m = l->next())
{
- if(*(m->tqmask()) == *tqmask)
+ if(*(m->mask()) == *mask)
{
- delete tqmask;
- tqmask = 0;
+ delete mask;
+ mask = 0;
return m->user();
}
}
// not found ...ok... add it
} else {
// not found ...ok... add it
- // this is the first tqmask in the list
+ // this is the first mask in the list
l = new KviRegisteredMaskList;
l->setAutoDelete(true);
- if(!u->addMask(tqmask))
+ if(!u->addMask(mask))
{
debug(" Ops...got an incoherent regusers action...recovered ?");
delete l;
l = 0;
} else {
- append_mask_to_list(l,u,tqmask);
- m_pMaskDict->insert(tqmask->nick(),l);
+ append_mask_to_list(l,u,mask);
+ m_pMaskDict->insert(mask->nick(),l);
}
return 0;
}
}
// Ok...add it
- if(!u->addMask(tqmask))
+ if(!u->addMask(mask))
{
debug("ops...got an incoherent regusers action...recovered ?");
return 0; // ops...already there ?
}
- append_mask_to_list(l,u,tqmask);
+ append_mask_to_list(l,u,mask);
return 0;
}
@@ -488,9 +488,9 @@ bool KviRegisteredUserDataBase::removeUser(const TQString & name)
if(name.isEmpty()) return false;
KviRegisteredUser * u = m_pUserDict->find(name);
if(!u)return false;
- while(KviIrcMask * tqmask = u->maskList()->first())
+ while(KviIrcMask * mask = u->maskList()->first())
{
- if(!removeMaskByPointer(tqmask))
+ if(!removeMaskByPointer(mask))
debug("Ops... removeMaskByPointer(%s) failed ?",KviTQString::toUtf8(name).data());
}
emit(userRemoved(name));
@@ -504,13 +504,13 @@ bool KviRegisteredUserDataBase::removeGroup(const TQString & name)
return true;
}
-bool KviRegisteredUserDataBase::removeMask(const KviIrcMask &tqmask)
+bool KviRegisteredUserDataBase::removeMask(const KviIrcMask &mask)
{
- // find the tqmask pointer
- KviRegisteredMask * m = findExactMask(tqmask);
+ // find the mask pointer
+ KviRegisteredMask * m = findExactMask(mask);
// and remove it
if(m){
- if(removeMaskByPointer(m->tqmask()))
+ if(removeMaskByPointer(m->mask()))
{
return true;
}
@@ -518,36 +518,36 @@ bool KviRegisteredUserDataBase::removeMask(const KviIrcMask &tqmask)
return 0;
}
-bool KviRegisteredUserDataBase::removeMaskByPointer(KviIrcMask * tqmask)
+bool KviRegisteredUserDataBase::removeMaskByPointer(KviIrcMask * mask)
{
- if(!tqmask) return 0;
- if(tqmask->hasWildNick())
+ if(!mask) return 0;
+ if(mask->hasWildNick())
{
// remove from the wild list
for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next())
{
- if(m->tqmask() == tqmask)
+ if(m->mask() == mask)
{
// ok..got it, remove from the list and from the user struct (user struct deletes it!)
- emit(userChanged(tqmask->nick()));
- m->user()->removeMask(tqmask); // this one deletes m->tqmask()
+ emit(userChanged(mask->nick()));
+ m->user()->removeMask(mask); // this one deletes m->mask()
m_pWildMaskList->removeRef(m); // this one deletes m
return true;
}
}
// not found ...opz :)
} else {
- KviRegisteredMaskList * l = m_pMaskDict->find(tqmask->nick());
+ KviRegisteredMaskList * l = m_pMaskDict->find(mask->nick());
if(l)
{
// FIXME: #warning "Here we could compare the host and username only: nick matches for sure"
for(KviRegisteredMask * m = l->first();m;m = l->next())
{
- if(m->tqmask() == tqmask)
+ if(m->mask() == mask)
{
- TQString nick = tqmask->nick();
+ TQString nick = mask->nick();
emit(userChanged(nick));
- m->user()->removeMask(tqmask); // this one deletes m->tqmask() (or tqmask)
+ m->user()->removeMask(mask); // this one deletes m->mask() (or mask)
l->removeRef(m); // this one deletes m
if(l->count() == 0)m_pMaskDict->remove(nick);
return true;
@@ -563,21 +563,21 @@ bool KviRegisteredUserDataBase::removeMaskByPointer(KviIrcMask * tqmask)
/*
-KviRegisteredUser * KviRegisteredUserDataBase::findMatchingUser(const KviIrcMask &tqmask)
+KviRegisteredUser * KviRegisteredUserDataBase::findMatchingUser(const KviIrcMask &mask)
{
// first lookup the nickname in the maskDict
- KviRegisteredMaskList * l = m_pMaskDict->find(tqmask.nick());
+ KviRegisteredMaskList * l = m_pMaskDict->find(mask.nick());
if(l)
{
for(KviRegisteredMask *m = l->first();m;m = l->next())
{
- if(m->tqmask()->matchesFixed(0,tqmask.user(),tqmask.host()))return m->user();
+ if(m->mask()->matchesFixed(0,mask.user(),mask.host()))return m->user();
}
}
// not found....lookup the wild ones
for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next())
{
- if(m->tqmask()->matchesFixed(tqmask))return m->user();
+ if(m->mask()->matchesFixed(mask))return m->user();
}
return 0; // no match at all
}
@@ -598,40 +598,40 @@ KviRegisteredMask * KviRegisteredUserDataBase::findMatchingMask(const TQString &
{
for(KviRegisteredMask *m = l->first();m;m = l->next())
{
- if(m->tqmask()->matchesFixed(nick,user,host))return m;
+ if(m->mask()->matchesFixed(nick,user,host))return m;
}
}
// not found....lookup the wild ones
for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next())
{
- if(m->tqmask()->matchesFixed(nick,user,host))return m;
+ if(m->mask()->matchesFixed(nick,user,host))return m;
}
return 0; // no match at all
}
-KviRegisteredUser * KviRegisteredUserDataBase::findUserWithMask(const KviIrcMask &tqmask)
+KviRegisteredUser * KviRegisteredUserDataBase::findUserWithMask(const KviIrcMask &mask)
{
- KviRegisteredMask * m = findExactMask(tqmask);
+ KviRegisteredMask * m = findExactMask(mask);
if(m)return m->user();
return 0;
}
-KviRegisteredMask * KviRegisteredUserDataBase::findExactMask(const KviIrcMask &tqmask)
+KviRegisteredMask * KviRegisteredUserDataBase::findExactMask(const KviIrcMask &mask)
{
// first lookup the nickname in the maskDict
- if(tqmask.nick()=="") return 0;
- KviRegisteredMaskList * l = m_pMaskDict->find(tqmask.nick());
+ if(mask.nick()=="") return 0;
+ KviRegisteredMaskList * l = m_pMaskDict->find(mask.nick());
if(l)
{
for(KviRegisteredMask *m = l->first();m;m = l->next())
{
- if(*(m->tqmask()) == tqmask)return m;
+ if(*(m->mask()) == mask)return m;
}
}
// not found....lookup the wild ones
for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next())
{
- if(*(m->tqmask()) == tqmask)return m;
+ if(*(m->mask()) == mask)return m;
}
return 0; // no match at all
}
@@ -674,8 +674,8 @@ void KviRegisteredUserDataBase::load(const TQString & filename)
u->setProperty(tmp,*(sdi.current()));
} else if(KviTQString::equalCSN("mask_",tmp,5))
{
- KviIrcMask * tqmask = new KviIrcMask(*(sdi.current()));
- addMask(u,tqmask);
+ KviIrcMask * mask = new KviIrcMask(*(sdi.current()));
+ addMask(u,mask);
} else if(KviTQString::equalCI(tmp,"Group"))
{
u->setGroup(*(sdi.current()));
@@ -722,9 +722,9 @@ void KviRegisteredUserDataBase::save(const TQString & filename)
{
TQString tmp;
KviTQString::sprintf(tmp,"mask_%d",idx);
- TQString tqmask;
- m->tqmask(tqmask,KviIrcMask::NickUserHost);
- cfg.writeEntry(tmp,tqmask);
+ TQString mask;
+ m->mask(mask,KviIrcMask::NickUserHost);
+ cfg.writeEntry(tmp,mask);
++idx;
}
cfg.writeEntry("Group",it.current()->group());