diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-28 18:31:12 +0000 |
commit | 0a80cfd57d271dd44221467efb426675fa470356 (patch) | |
tree | 6f503a31aa078eaf8fa015cf1749808529d49fc9 /src/kvilib/ext/kvi_regusersdb.cpp | |
parent | 3329e5a804e28ef3f5eb51d1e7affdd5a508e8f2 (diff) | |
download | kvirc-0a80cfd57d271dd44221467efb426675fa470356.tar.gz kvirc-0a80cfd57d271dd44221467efb426675fa470356.zip |
TQt4 port kvirc
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kvilib/ext/kvi_regusersdb.cpp')
-rw-r--r-- | src/kvilib/ext/kvi_regusersdb.cpp | 318 |
1 files changed, 159 insertions, 159 deletions
diff --git a/src/kvilib/ext/kvi_regusersdb.cpp b/src/kvilib/ext/kvi_regusersdb.cpp index 6d36c975..c60d2c9e 100644 --- a/src/kvilib/ext/kvi_regusersdb.cpp +++ b/src/kvilib/ext/kvi_regusersdb.cpp @@ -42,12 +42,12 @@ @short: Registration of users in KVIrc @keyterms: - registered users, registration mask, registered user properties, + registered users, registration tqmask, registered user properties, user properties, notify property, avatar property @body: [big]Introduction[/big][br] The "registered user database" is basically a set of users with associated - [doc:irc_masks]irc-masks[/doc] and properties.[br] + [doc:irc_tqmasks]irc-tqmasks[/doc] and properties.[br] It is used to recognize users on IRC and associate properties to them.[br] This works more or less like the IRC ban list, K-Line list, or invite list.[br] [big]User entry[/big][br] @@ -55,50 +55,50 @@ It may be the nickname of the user that you want to match, or the real name (if you know it) or any other string (even with spaces). The name is an "internal identifier" for the user entry: each name maps to a single entry and each entry has a single name.[br] - Each entry has a set of registration [doc:irc_masks]irc-masks[/doc]: these masks + Each entry has a set of registration [doc:irc_tqmasks]irc-tqmasks[/doc]: these tqmasks are used to recognize the user on irc.[br] [br] - [big]Registration masks[/big][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] + [big]Registration tqmasks[/big][br] + The tqmasks have the common IRC tqmask format: [b]<nick>!<user>@<host>[/b][br] + The tqmasks may contain '*' and '?' wildcards that match any portion of text.[br] [b]*!*@*[/b][br] [b]Pragma!*@*[/b][br] [b]*!~daemon@*[/b][br] [b]Pragma!*daemon@*.it[/b][br] [b]Pragma!?daemon@some*.it[/b][br] [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 mask *!root@*.host.com will match all the users + Are examples of valid registration tqmasks.[br] + The tqmasks with wildcards can actually match more than a single user.[br] + For example the tqmask *!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 mask will always refer to a single user.[br] + in a single irc connection , a tqmask 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 mask will really match the correct user.[br] + In this way you can be 95% sure that the tqmask 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 mask like the following: + You will add an entry with name "Derek Riggs" and a registration tqmask 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 + If the IRC servers keep adding strange characters ([doc:irc_tqmasks]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 mask 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 tqmask as follows: Eddie!*eddie@*.wasted.years.org.[br] - An alternative could be use only one mask with *.org as domain and allow any username (Eddie!*@*.org) but this + An alternative could be use only one tqmask 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 mask to register is "Eddie!*@*.org".[br] + and you're implementing an auto-kick system, the correct tqmask 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, + If you have two tqmasks registered: Pragma!*xor@*.myisp.it and *!*@*.myisp.it, kvirc will match Pragma!~xor@233-dyn.myisp.it with the first one even if the second one matches too; the firs one is a best match.[br] [br] @@ -117,7 +117,7 @@ [br] [big]The interface to the database[/big][br] The [module:reguser]reguser module[/module] is the interface to the "registered users database".[br] - It provides a set of commands for adding and removing masks and manipulating properties.[br] + It provides a set of commands for adding and removing tqmasks and manipulating properties.[br] */ //============================================================================================================ @@ -140,7 +140,7 @@ KviRegisteredMask::KviRegisteredMask(KviRegisteredUser * u,KviIrcMask * m) // -KviRegisteredUser::KviRegisteredUser(const QString & name) +KviRegisteredUser::KviRegisteredUser(const TQString & name) { m_iIgnoreFlags =0; m_bIgnoreEnabled=false; @@ -162,52 +162,52 @@ bool KviRegisteredUser::isIgnoreEnabledFor(IgnoreFlags flag) return m_iIgnoreFlags & flag; } -KviIrcMask * KviRegisteredUser::findMask(const KviIrcMask &mask) +KviIrcMask * KviRegisteredUser::findMask(const KviIrcMask &tqmask) { for(KviIrcMask * m = m_pMaskList->first();m;m = m_pMaskList->next()) { - if(*m == mask)return m; + if(*m == tqmask)return m; } return 0; } -bool KviRegisteredUser::addMask(KviIrcMask * mask) +bool KviRegisteredUser::addMask(KviIrcMask * tqmask) { - if(findMask(*mask)) + if(findMask(*tqmask)) { - delete mask; - mask = 0; + delete tqmask; + tqmask = 0; return false; } - m_pMaskList->append(mask); + m_pMaskList->append(tqmask); return true; } -bool KviRegisteredUser::removeMask(KviIrcMask * mask) +bool KviRegisteredUser::removeMask(KviIrcMask * tqmask) { - if(!mask)return false; - return m_pMaskList->removeRef(mask); + if(!tqmask)return false; + return m_pMaskList->removeRef(tqmask); } -bool KviRegisteredUser::matches(const KviIrcMask &mask) +bool KviRegisteredUser::matches(const KviIrcMask &tqmask) { for(KviIrcMask * m = m_pMaskList->first();m;m = m_pMaskList->next()) { - if(m->matches(mask))return true; + if(m->matches(tqmask))return true; } return false; } -bool KviRegisteredUser::matchesFixed(const KviIrcMask &mask) +bool KviRegisteredUser::matchesFixed(const KviIrcMask &tqmask) { for(KviIrcMask * m = m_pMaskList->first();m;m = m_pMaskList->next()) { - if(m->matchesFixed(mask))return true; + if(m->matchesFixed(tqmask))return true; } return false; } -bool KviRegisteredUser::matchesFixed(const QString & nick,const QString & user,const QString & host) +bool KviRegisteredUser::matchesFixed(const TQString & nick,const TQString & user,const TQString & host) { for(KviIrcMask * m = m_pMaskList->first();m;m = m_pMaskList->next()) { @@ -216,28 +216,28 @@ bool KviRegisteredUser::matchesFixed(const QString & nick,const QString & user,c return false; } -void KviRegisteredUser::setProperty(const QString &name,bool value) +void KviRegisteredUser::setProperty(const TQString &name,bool value) { - setProperty(name,value ? QString("true") : QString("false")); + setProperty(name,value ? TQString("true") : TQString("false")); } -void KviRegisteredUser::setProperty(const QString & name,const QString & value) +void KviRegisteredUser::setProperty(const TQString & name,const TQString & value) { if(!value.isEmpty()) { if(!m_pPropertyDict) { - m_pPropertyDict = new KviPointerHashTable<QString,QString>(7,false); + m_pPropertyDict = new KviPointerHashTable<TQString,TQString>(7,false); m_pPropertyDict->setAutoDelete(true); } #ifdef COMPILE_USE_QT4 - QString * val = new QString(value.trimmed()); + TQString * val = new TQString(value.trimmed()); #else - QString * val = new QString(value.stripWhiteSpace()); + TQString * val = new TQString(value.stripWhiteSpace()); #endif if(!val->isEmpty()) { - m_pPropertyDict->replace(name,val); + m_pPropertyDict->tqreplace(name,val); } else { delete val; val = 0; @@ -247,39 +247,39 @@ void KviRegisteredUser::setProperty(const QString & name,const QString & value) } } -bool KviRegisteredUser::getProperty(const QString & name,QString &value) +bool KviRegisteredUser::getProperty(const TQString & name,TQString &value) { if(!m_pPropertyDict)return false; if(name.isEmpty()) return false; - QString * pValue = m_pPropertyDict->find(name); + TQString * pValue = m_pPropertyDict->tqfind(name); if(pValue)value = *pValue; else return false; return true; } -const QString & KviRegisteredUser::getProperty(const QString & name) +const TQString & KviRegisteredUser::getProperty(const TQString & name) { - if(!m_pPropertyDict)return KviQString::empty; - if(name.isEmpty())return KviQString::empty; - QString * pValue = m_pPropertyDict->find(name); + if(!m_pPropertyDict)return KviTQString::empty; + if(name.isEmpty())return KviTQString::empty; + TQString * pValue = m_pPropertyDict->tqfind(name); if(pValue)return *pValue; - return KviQString::empty; + return KviTQString::empty; } -bool KviRegisteredUser::getBoolProperty(const QString & name,bool def) +bool KviRegisteredUser::getBoolProperty(const TQString & name,bool def) { if(!m_pPropertyDict)return def; if(name.isEmpty()) return def; - QString * pValue = m_pPropertyDict->find(name); + TQString * pValue = m_pPropertyDict->tqfind(name); if(pValue) { // be flexible , allow more "true" values (pragma) - if(KviQString::equalCS(*pValue,"1"))return true; - if(KviQString::equalCI(*pValue,"true"))return true; - if(KviQString::equalCI(*pValue,"yes"))return true; - //if(KviQString::equalCI(*pValue,"yeah"))return true; - //if(KviQString::equalCI(*pValue,"sure"))return true; - //if(KviQString::equalCI(*pValue,"sureashell"))return true; + if(KviTQString::equalCS(*pValue,"1"))return true; + if(KviTQString::equalCI(*pValue,"true"))return true; + if(KviTQString::equalCI(*pValue,"yes"))return true; + //if(KviTQString::equalCI(*pValue,"yeah"))return true; + //if(KviTQString::equalCI(*pValue,"sure"))return true; + //if(KviTQString::equalCI(*pValue,"sureashell"))return true; } return def; } @@ -289,7 +289,7 @@ bool KviRegisteredUser::getBoolProperty(const QString & name,bool def) // KviRegisteredUserGroup // -KviRegisteredUserGroup::KviRegisteredUserGroup(const QString &name) +KviRegisteredUserGroup::KviRegisteredUserGroup(const TQString &name) { setName(name); } @@ -306,16 +306,16 @@ KviRegisteredUserGroup::~KviRegisteredUserGroup() KviRegisteredUserDataBase::KviRegisteredUserDataBase() { - m_pUserDict = new KviPointerHashTable<QString,KviRegisteredUser>(31,false); // do not copy keys + m_pUserDict = new KviPointerHashTable<TQString,KviRegisteredUser>(31,false); // do not copy keys m_pUserDict->setAutoDelete(true); m_pWildMaskList = new KviRegisteredMaskList; m_pWildMaskList->setAutoDelete(true); - m_pMaskDict = new KviPointerHashTable<QString,KviRegisteredMaskList>(49,false); // copy keys here! + m_pMaskDict = new KviPointerHashTable<TQString,KviRegisteredMaskList>(49,false); // copy keys here! m_pMaskDict->setAutoDelete(true); - m_pGroupDict = new KviPointerHashTable<QString,KviRegisteredUserGroup>(5,false); // copy keys here! + m_pGroupDict = new KviPointerHashTable<TQString,KviRegisteredUserGroup>(5,false); // copy keys here! m_pGroupDict->setAutoDelete(true); } @@ -328,40 +328,40 @@ KviRegisteredUserDataBase::~KviRegisteredUserDataBase() delete m_pGroupDict; } -KviRegisteredUser * KviRegisteredUserDataBase::addUser(const QString & name) +KviRegisteredUser * KviRegisteredUserDataBase::addUser(const TQString & name) { if(name.isEmpty()) return false; - if(m_pUserDict->find(name))return 0; + if(m_pUserDict->tqfind(name))return 0; KviRegisteredUser * u = new KviRegisteredUser(name); - m_pUserDict->replace(u->name(),u); //u->name() because we're NOT copying keys! + m_pUserDict->tqreplace(u->name(),u); //u->name() because we're NOT copying keys! emit(userAdded(name)); return u; } -KviRegisteredUserGroup * KviRegisteredUserDataBase::addGroup(const QString & name) +KviRegisteredUserGroup * KviRegisteredUserDataBase::addGroup(const TQString & name) { if(name.isEmpty()) return false; - if(m_pGroupDict->find(name))return 0; + if(m_pGroupDict->tqfind(name))return 0; KviRegisteredUserGroup * pGroup = new KviRegisteredUserGroup(name); - m_pGroupDict->replace(pGroup->name(),pGroup); //u->name() because we're NOT copying keys! + m_pGroupDict->tqreplace(pGroup->name(),pGroup); //u->name() because we're NOT copying keys! return pGroup; } -KviRegisteredUser * KviRegisteredUserDataBase::getUser(const QString & name) +KviRegisteredUser * KviRegisteredUserDataBase::getUser(const TQString & name) { if(name.isEmpty()) return 0; - KviRegisteredUser * u = m_pUserDict->find(name); + KviRegisteredUser * u = m_pUserDict->tqfind(name); if(!u) { u = new KviRegisteredUser(name); - m_pUserDict->replace(u->name(),u); //u->name() because we're NOT copying keys! + m_pUserDict->tqreplace(u->name(),u); //u->name() because we're NOT copying keys! } return u; } -static void append_mask_to_list(KviRegisteredMaskList *l,KviRegisteredUser *u,KviIrcMask *mask) +static void append_tqmask_to_list(KviRegisteredMaskList *l,KviRegisteredUser *u,KviIrcMask *tqmask) { - KviRegisteredMask * newMask = new KviRegisteredMask(u,mask); + KviRegisteredMask * newMask = new KviRegisteredMask(u,tqmask); int idx = 0; for(KviRegisteredMask * m = l->first();m;m = l->next()) { @@ -375,65 +375,65 @@ static void append_mask_to_list(KviRegisteredMaskList *l,KviRegisteredUser *u,Kv l->append(newMask); } -KviRegisteredUser * KviRegisteredUserDataBase::addMask(KviRegisteredUser * u,KviIrcMask * mask) +KviRegisteredUser * KviRegisteredUserDataBase::addMask(KviRegisteredUser * u,KviIrcMask * tqmask) { - if(!u || !mask) return 0; - __range_valid(u == m_pUserDict->find(u->name())); + if(!u || !tqmask) return 0; + __range_valid(u == m_pUserDict->tqfind(u->name())); KviRegisteredMaskList * l; - if(mask->hasWildNick()) + if(tqmask->hasWildNick()) { for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next()) { - if(*(m->mask()) == *mask) + if(*(m->tqmask()) == *tqmask) { - delete mask; - mask = 0; + delete tqmask; + tqmask = 0; return m->user(); } } // not found ...ok... add it - // masks with more info go first in the list + // tqmasks with more info go first in the list l = m_pWildMaskList; } else { - l = m_pMaskDict->find(mask->nick()); + l = m_pMaskDict->tqfind(tqmask->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->mask()) == *mask) + if(*(m->tqmask()) == *tqmask) { - delete mask; - mask = 0; + delete tqmask; + tqmask = 0; return m->user(); } } // not found ...ok... add it } else { // not found ...ok... add it - // this is the first mask in the list + // this is the first tqmask in the list l = new KviRegisteredMaskList; l->setAutoDelete(true); - if(!u->addMask(mask)) + if(!u->addMask(tqmask)) { debug(" Ops...got an incoherent regusers action...recovered ?"); delete l; l = 0; } else { - append_mask_to_list(l,u,mask); - m_pMaskDict->insert(mask->nick(),l); + append_tqmask_to_list(l,u,tqmask); + m_pMaskDict->insert(tqmask->nick(),l); } return 0; } } // Ok...add it - if(!u->addMask(mask)) + if(!u->addMask(tqmask)) { debug("ops...got an incoherent regusers action...recovered ?"); return 0; // ops...already there ? } - append_mask_to_list(l,u,mask); + append_tqmask_to_list(l,u,tqmask); return 0; } @@ -445,23 +445,23 @@ void KviRegisteredUserDataBase::copyFrom(KviRegisteredUserDataBase * db) m_pGroupDict->clear(); emit(databaseCleared()); - KviPointerHashTableIterator<QString,KviRegisteredUser> it(*(db->m_pUserDict)); + KviPointerHashTableIterator<TQString,KviRegisteredUser> it(*(db->m_pUserDict)); while(KviRegisteredUser * theCur = it.current()) { KviRegisteredUser * u = getUser(theCur->name()); - // copy masks - KviPointerList<KviIrcMask> * l = theCur->maskList(); + // copy tqmasks + KviPointerList<KviIrcMask> * l = theCur->tqmaskList(); for(KviIrcMask * m=l->first();m;m = l->next()) { KviIrcMask * m2 = new KviIrcMask(*m); addMask(u,m2); } // copy properties - KviPointerHashTable<QString,QString> * pd = theCur->propertyDict(); + KviPointerHashTable<TQString,TQString> * pd = theCur->propertyDict(); if(pd) { - KviPointerHashTableIterator<QString,QString> pdi(*pd); + KviPointerHashTableIterator<TQString,TQString> pdi(*pd); while(pdi.current()) { u->setProperty(pdi.currentKey(),*(pdi.current())); @@ -474,7 +474,7 @@ void KviRegisteredUserDataBase::copyFrom(KviRegisteredUserDataBase * db) ++it; } - KviPointerHashTableIterator<QString,KviRegisteredUserGroup> git(*db->m_pGroupDict); + KviPointerHashTableIterator<TQString,KviRegisteredUserGroup> git(*db->m_pGroupDict); while(git.current()) { addGroup(git.currentKey()); @@ -483,34 +483,34 @@ void KviRegisteredUserDataBase::copyFrom(KviRegisteredUserDataBase * db) } -bool KviRegisteredUserDataBase::removeUser(const QString & name) +bool KviRegisteredUserDataBase::removeUser(const TQString & name) { if(name.isEmpty()) return false; - KviRegisteredUser * u = m_pUserDict->find(name); + KviRegisteredUser * u = m_pUserDict->tqfind(name); if(!u)return false; - while(KviIrcMask * mask = u->maskList()->first()) + while(KviIrcMask * tqmask = u->tqmaskList()->first()) { - if(!removeMaskByPointer(mask)) - debug("Ops... removeMaskByPointer(%s) failed ?",KviQString::toUtf8(name).data()); + if(!removeMaskByPointer(tqmask)) + debug("Ops... removeMaskByPointer(%s) failed ?",KviTQString::toUtf8(name).data()); } emit(userRemoved(name)); m_pUserDict->remove(name); return true; } -bool KviRegisteredUserDataBase::removeGroup(const QString & name) +bool KviRegisteredUserDataBase::removeGroup(const TQString & name) { if(name.isEmpty()) return false; m_pGroupDict->remove(name); return true; } -bool KviRegisteredUserDataBase::removeMask(const KviIrcMask &mask) +bool KviRegisteredUserDataBase::removeMask(const KviIrcMask &tqmask) { - // find the mask pointer - KviRegisteredMask * m = findExactMask(mask); + // find the tqmask pointer + KviRegisteredMask * m = findExactMask(tqmask); // and remove it if(m){ - if(removeMaskByPointer(m->mask())) + if(removeMaskByPointer(m->tqmask())) { return true; } @@ -518,36 +518,36 @@ bool KviRegisteredUserDataBase::removeMask(const KviIrcMask &mask) return 0; } -bool KviRegisteredUserDataBase::removeMaskByPointer(KviIrcMask * mask) +bool KviRegisteredUserDataBase::removeMaskByPointer(KviIrcMask * tqmask) { - if(!mask) return 0; - if(mask->hasWildNick()) + if(!tqmask) return 0; + if(tqmask->hasWildNick()) { // remove from the wild list for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next()) { - if(m->mask() == mask) + if(m->tqmask() == tqmask) { // ok..got it, remove from the list and from the user struct (user struct deletes it!) - emit(userChanged(mask->nick())); - m->user()->removeMask(mask); // this one deletes m->mask() + emit(userChanged(tqmask->nick())); + m->user()->removeMask(tqmask); // this one deletes m->tqmask() m_pWildMaskList->removeRef(m); // this one deletes m return true; } } // not found ...opz :) } else { - KviRegisteredMaskList * l = m_pMaskDict->find(mask->nick()); + KviRegisteredMaskList * l = m_pMaskDict->tqfind(tqmask->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->mask() == mask) + if(m->tqmask() == tqmask) { - QString nick = mask->nick(); + TQString nick = tqmask->nick(); emit(userChanged(nick)); - m->user()->removeMask(mask); // this one deletes m->mask() (or mask) + m->user()->removeMask(tqmask); // this one deletes m->tqmask() (or tqmask) l->removeRef(m); // this one deletes m if(l->count() == 0)m_pMaskDict->remove(nick); return true; @@ -563,89 +563,89 @@ bool KviRegisteredUserDataBase::removeMaskByPointer(KviIrcMask * mask) /* -KviRegisteredUser * KviRegisteredUserDataBase::findMatchingUser(const KviIrcMask &mask) +KviRegisteredUser * KviRegisteredUserDataBase::findMatchingUser(const KviIrcMask &tqmask) { - // first lookup the nickname in the maskDict - KviRegisteredMaskList * l = m_pMaskDict->find(mask.nick()); + // first lookup the nickname in the tqmaskDict + KviRegisteredMaskList * l = m_pMaskDict->tqfind(tqmask.nick()); if(l) { for(KviRegisteredMask *m = l->first();m;m = l->next()) { - if(m->mask()->matchesFixed(0,mask.user(),mask.host()))return m->user(); + if(m->tqmask()->matchesFixed(0,tqmask.user(),tqmask.host()))return m->user(); } } // not found....lookup the wild ones for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next()) { - if(m->mask()->matchesFixed(mask))return m->user(); + if(m->tqmask()->matchesFixed(tqmask))return m->user(); } return 0; // no match at all } */ -KviRegisteredUser * KviRegisteredUserDataBase::findMatchingUser(const QString & nick,const QString &user,const QString & host) +KviRegisteredUser * KviRegisteredUserDataBase::findMatchingUser(const TQString & nick,const TQString &user,const TQString & host) { KviRegisteredMask * m = findMatchingMask(nick,user,host); if(m)return m->user(); return 0; // no match at all } -KviRegisteredMask * KviRegisteredUserDataBase::findMatchingMask(const QString & nick,const QString &user,const QString & host) +KviRegisteredMask * KviRegisteredUserDataBase::findMatchingMask(const TQString & nick,const TQString &user,const TQString & host) { - // first lookup the nickname in the maskDict + // first lookup the nickname in the tqmaskDict if(nick.isEmpty()) return false; - KviRegisteredMaskList * l = m_pMaskDict->find(nick); + KviRegisteredMaskList * l = m_pMaskDict->tqfind(nick); if(l) { for(KviRegisteredMask *m = l->first();m;m = l->next()) { - if(m->mask()->matchesFixed(nick,user,host))return m; + if(m->tqmask()->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->mask()->matchesFixed(nick,user,host))return m; + if(m->tqmask()->matchesFixed(nick,user,host))return m; } return 0; // no match at all } -KviRegisteredUser * KviRegisteredUserDataBase::findUserWithMask(const KviIrcMask &mask) +KviRegisteredUser * KviRegisteredUserDataBase::findUserWithMask(const KviIrcMask &tqmask) { - KviRegisteredMask * m = findExactMask(mask); + KviRegisteredMask * m = findExactMask(tqmask); if(m)return m->user(); return 0; } -KviRegisteredMask * KviRegisteredUserDataBase::findExactMask(const KviIrcMask &mask) +KviRegisteredMask * KviRegisteredUserDataBase::findExactMask(const KviIrcMask &tqmask) { - // first lookup the nickname in the maskDict - if(mask.nick()=="") return 0; - KviRegisteredMaskList * l = m_pMaskDict->find(mask.nick()); + // first lookup the nickname in the tqmaskDict + if(tqmask.nick()=="") return 0; + KviRegisteredMaskList * l = m_pMaskDict->tqfind(tqmask.nick()); if(l) { for(KviRegisteredMask *m = l->first();m;m = l->next()) { - if(*(m->mask()) == mask)return m; + if(*(m->tqmask()) == tqmask)return m; } } // not found....lookup the wild ones for(KviRegisteredMask * m = m_pWildMaskList->first();m;m = m_pWildMaskList->next()) { - if(*(m->mask()) == mask)return m; + if(*(m->tqmask()) == tqmask)return m; } return 0; // no match at all } /* -bool KviRegisteredUserDataBase::isIgnoredUser(const QString & nick,const QString & user,const QString & host) +bool KviRegisteredUserDataBase::isIgnoredUser(const TQString & nick,const TQString & user,const TQString & host) { KviRegisteredUser * u = findMatchingUser(nick,user,host); if(u)return u->getBoolProperty("IGNORE"); else return false; } */ -void KviRegisteredUserDataBase::load(const QString & filename) +void KviRegisteredUserDataBase::load(const TQString & filename) { - QString szCurrent; + TQString szCurrent; KviConfig cfg(filename,KviConfig::Read); KviConfigIterator it(*cfg.dict()); @@ -653,7 +653,7 @@ void KviRegisteredUserDataBase::load(const QString & filename) { cfg.setGroup(it.currentKey()); szCurrent=it.currentKey(); - if(KviQString::equalCSN("#Group ",szCurrent,7)) + if(KviTQString::equalCSN("#Group ",szCurrent,7)) { szCurrent.remove(0,7); addGroup(szCurrent); @@ -667,16 +667,16 @@ void KviRegisteredUserDataBase::load(const QString & filename) KviConfigGroupIterator sdi(*(it.current())); while(sdi.current()) { - QString tmp = sdi.currentKey(); - if(KviQString::equalCSN("prop_",tmp,5)) + TQString tmp = sdi.currentKey(); + if(KviTQString::equalCSN("prop_",tmp,5)) { tmp.remove(0,5); u->setProperty(tmp,*(sdi.current())); - } else if(KviQString::equalCSN("mask_",tmp,5)) + } else if(KviTQString::equalCSN("tqmask_",tmp,5)) { - KviIrcMask * mask = new KviIrcMask(*(sdi.current())); - addMask(u,mask); - } else if(KviQString::equalCI(tmp,"Group")) + KviIrcMask * tqmask = new KviIrcMask(*(sdi.current())); + addMask(u,tqmask); + } else if(KviTQString::equalCI(tmp,"Group")) { u->setGroup(*(sdi.current())); } @@ -686,18 +686,18 @@ void KviRegisteredUserDataBase::load(const QString & filename) } ++it; } - if(!m_pGroupDict->find(__tr("Default"))) + if(!m_pGroupDict->tqfind(__tr("Default"))) addGroup(__tr("Default")); } -void KviRegisteredUserDataBase::save(const QString & filename) +void KviRegisteredUserDataBase::save(const TQString & filename) { KviConfig cfg(filename,KviConfig::Write); cfg.clear(); cfg.preserveEmptyGroups(true); - KviPointerHashTableIterator<QString,KviRegisteredUser> it(*m_pUserDict); + KviPointerHashTableIterator<TQString,KviRegisteredUser> it(*m_pUserDict); while(it.current()) { @@ -707,35 +707,35 @@ void KviRegisteredUserDataBase::save(const QString & filename) cfg.writeEntry("IgnoreFlags",it.current()->ignoreFlags()); if(it.current()->propertyDict()) { - KviPointerHashTableIterator<QString,QString> pit(*(it.current()->propertyDict())); + KviPointerHashTableIterator<TQString,TQString> pit(*(it.current()->propertyDict())); while(pit.current()) { - QString tmp = "prop_"; + TQString tmp = "prop_"; tmp.append(pit.currentKey()); cfg.writeEntry(tmp,*(pit.current())); ++pit; } } - // Write masks + // Write tqmasks int idx = 0; - for(KviIrcMask * m = it.current()->maskList()->first();m;m = it.current()->maskList()->next()) + for(KviIrcMask * m = it.current()->tqmaskList()->first();m;m = it.current()->tqmaskList()->next()) { - QString tmp; - KviQString::sprintf(tmp,"mask_%d",idx); - QString mask; - m->mask(mask,KviIrcMask::NickUserHost); - cfg.writeEntry(tmp,mask); + TQString tmp; + KviTQString::sprintf(tmp,"tqmask_%d",idx); + TQString tqmask; + m->tqmask(tqmask,KviIrcMask::NickUserHost); + cfg.writeEntry(tmp,tqmask); ++idx; } cfg.writeEntry("Group",it.current()->group()); ++it; } - KviPointerHashTableIterator<QString,KviRegisteredUserGroup> git(*m_pGroupDict); - QString szTmp; + KviPointerHashTableIterator<TQString,KviRegisteredUserGroup> git(*m_pGroupDict); + TQString szTmp; while(git.current()) { - KviQString::sprintf(szTmp,"#Group %Q",&(git.current()->name())); + KviTQString::sprintf(szTmp,"#Group %Q",&(git.current()->name())); cfg.setGroup(szTmp); ++git; } |