diff options
Diffstat (limited to 'src/kvilib/ext')
-rw-r--r-- | src/kvilib/ext/kvi_mediatype.cpp | 16 | ||||
-rw-r--r-- | src/kvilib/ext/kvi_mediatype.h | 2 | ||||
-rw-r--r-- | src/kvilib/ext/kvi_regchan.cpp | 8 | ||||
-rw-r--r-- | src/kvilib/ext/kvi_regchan.h | 4 | ||||
-rw-r--r-- | src/kvilib/ext/kvi_regusersdb.cpp | 150 | ||||
-rw-r--r-- | src/kvilib/ext/kvi_regusersdb.h | 30 | ||||
-rw-r--r-- | src/kvilib/ext/kvi_sharedfiles.cpp | 16 | ||||
-rw-r--r-- | src/kvilib/ext/kvi_sharedfiles.h | 2 |
8 files changed, 114 insertions, 114 deletions
diff --git a/src/kvilib/ext/kvi_mediatype.cpp b/src/kvilib/ext/kvi_mediatype.cpp index d7adeb2e..e961359d 100644 --- a/src/kvilib/ext/kvi_mediatype.cpp +++ b/src/kvilib/ext/kvi_mediatype.cpp @@ -98,13 +98,13 @@ KviMediaType * KviMediaManager::findMediaTypeByIanaType(const char * ianaType) return 0; } -KviMediaType * KviMediaManager::findMediaTypeByFileMask(const char * filetqmask) +KviMediaType * KviMediaManager::findMediaTypeByFileMask(const char * filemask) { __range_valid(locked()); for(KviMediaType * mt = m_pMediaTypeList->first();mt;mt = m_pMediaTypeList->next()) { // FIXME: #warning "Should this be case sensitive ?" - if(kvi_strEqualCI(mt->szFileMask.ptr(),filetqmask))return mt; + if(kvi_strEqualCI(mt->szFileMask.ptr(),filemask))return mt; } return 0; @@ -137,7 +137,7 @@ void KviMediaManager::insertMediaType(KviMediaType * m) { if(iWildCount) { - // the new tqmask has wildcards... if the current one has none, skip it + // the new mask has wildcards... if the current one has none, skip it int iWildCountExisting = mt->szFileMask.occurences('*'); if(iWildCountExisting) { @@ -164,7 +164,7 @@ void KviMediaManager::insertMediaType(KviMediaType * m) } } // else the current has no wildcards...skip } else { - // the new tqmask has no wildcards.... + // the new mask has no wildcards.... if(mt->szFileMask.contains('*')) { // current one has wildcards...insert @@ -433,7 +433,7 @@ KviMediaType * KviMediaManager::findMediaTypeForRegularFile(const char * szFullP typedef struct _KviDefaultMediaType { - const char * filetqmask; + const char * filemask; const char * magicbytes; const char * ianatype; const char * description; @@ -489,12 +489,12 @@ void KviMediaManager::load(const char * filename) insertMediaType(m); } - for(int u = 0;g_defMediaTypes[u].filetqmask;u++) + for(int u = 0;g_defMediaTypes[u].filemask;u++) { - if(!findMediaTypeByFileMask(g_defMediaTypes[u].filetqmask)) + if(!findMediaTypeByFileMask(g_defMediaTypes[u].filemask)) { KviMediaType * m = new KviMediaType; - m->szFileMask = g_defMediaTypes[u].filetqmask; + m->szFileMask = g_defMediaTypes[u].filemask; m->szMagicBytes = g_defMediaTypes[u].magicbytes; m->szIanaType = g_defMediaTypes[u].ianatype; m->szDescription = g_defMediaTypes[u].description; diff --git a/src/kvilib/ext/kvi_mediatype.h b/src/kvilib/ext/kvi_mediatype.h index 99b427f9..77e96594 100644 --- a/src/kvilib/ext/kvi_mediatype.h +++ b/src/kvilib/ext/kvi_mediatype.h @@ -67,7 +67,7 @@ private: KviMediaType * findMediaTypeForRegularFile(const char * szFullPath,const char * szFileName,bool bCheckMagic); public: KviPointerList<KviMediaType> * mediaTypeList(){ return m_pMediaTypeList; }; - KviMediaType * findMediaTypeByFileMask(const char * filetqmask); + KviMediaType * findMediaTypeByFileMask(const char * filemask); KviMediaType * findMediaTypeByIanaType(const char * ianaType); bool removeMediaType(KviMediaType * t){ return m_pMediaTypeList->removeRef(t); }; void clear(){ m_pMediaTypeList->clear(); }; diff --git a/src/kvilib/ext/kvi_regchan.cpp b/src/kvilib/ext/kvi_regchan.cpp index 434ebd9f..9cddac5c 100644 --- a/src/kvilib/ext/kvi_regchan.cpp +++ b/src/kvilib/ext/kvi_regchan.cpp @@ -28,10 +28,10 @@ #include "kvi_config.h" #include "kvi_qstring.h" -KviRegisteredChannel::KviRegisteredChannel(const KviStr &name,const KviStr &nettqmask) +KviRegisteredChannel::KviRegisteredChannel(const KviStr &name,const KviStr &netmask) { m_szName = name; - m_szNetMask = nettqmask; + m_szNetMask = netmask; m_pPropertyDict = new KviPointerHashTable<const char *,KviStr>(7,false,true); m_pPropertyDict->setAutoDelete(true); } @@ -111,13 +111,13 @@ KviRegisteredChannel * KviRegisteredChannelDataBase::find(const char * name,cons return 0; } -KviRegisteredChannel * KviRegisteredChannelDataBase::findExact(const char * name,const char * nettqmask) +KviRegisteredChannel * KviRegisteredChannelDataBase::findExact(const char * name,const char * netmask) { KviRegisteredChannelList * l = m_pChannelDict->find(name); if(!l)return 0; for(KviRegisteredChannel * c = l->first();c;c = l->next()) { - if(kvi_strEqualCI(c->netMask().ptr(),nettqmask))return c; + if(kvi_strEqualCI(c->netMask().ptr(),netmask))return c; } return 0; } diff --git a/src/kvilib/ext/kvi_regchan.h b/src/kvilib/ext/kvi_regchan.h index 5cdad198..f447c313 100644 --- a/src/kvilib/ext/kvi_regchan.h +++ b/src/kvilib/ext/kvi_regchan.h @@ -35,7 +35,7 @@ class KVILIB_API KviRegisteredChannel : public KviHeapObject { friend class KviRegisteredChannelDataBase; public: - KviRegisteredChannel(const KviStr &name,const KviStr &nettqmask); + KviRegisteredChannel(const KviStr &name,const KviStr &netmask); ~KviRegisteredChannel(); protected: KviStr m_szName; @@ -63,7 +63,7 @@ protected: public: KviPointerHashTable<const char *,KviRegisteredChannelList> * channelDict(){ return m_pChannelDict; }; KviRegisteredChannel * find(const char * name,const char * net); - KviRegisteredChannel * findExact(const char * name,const char * nettqmask); + KviRegisteredChannel * findExact(const char * name,const char * netmask); void remove(KviRegisteredChannel * c); void add(KviRegisteredChannel * c); void load(const char * filename); 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()); diff --git a/src/kvilib/ext/kvi_regusersdb.h b/src/kvilib/ext/kvi_regusersdb.h index 797ae101..6f20422c 100644 --- a/src/kvilib/ext/kvi_regusersdb.h +++ b/src/kvilib/ext/kvi_regusersdb.h @@ -27,7 +27,7 @@ // // REGISTERED USERS // -// Here we manage users resigered by tqmask and their (generic!) properties +// Here we manage users resigered by mask and their (generic!) properties // #include "kvi_settings.h" @@ -74,10 +74,10 @@ private: KviPointerHashTable<TQString,TQString> * m_pPropertyDict; // owned properties KviPointerList<KviIrcMask> * m_pMaskList; // owned masks protected: - // tqmask ownership is transferred! (always!) returns false if the tqmask was already there - bool addMask(KviIrcMask * tqmask); - bool removeMask(KviIrcMask * tqmask); - KviIrcMask * findMask(const KviIrcMask &tqmask); + // mask ownership is transferred! (always!) returns false if the mask was already there + bool addMask(KviIrcMask * mask); + bool removeMask(KviIrcMask * mask); + KviIrcMask * findMask(const KviIrcMask &mask); public: int ignoreFlags() { return m_iIgnoreFlags; }; void setIgnoreFlags(int flags) {m_iIgnoreFlags=flags; }; @@ -86,8 +86,8 @@ public: bool isIgnoreEnabledFor(IgnoreFlags flag); const TQString &name(){ return m_szName; }; - bool matches(const KviIrcMask &tqmask); - bool matchesFixed(const KviIrcMask &tqmask); + bool matches(const KviIrcMask &mask); + bool matchesFixed(const KviIrcMask &mask); bool matchesFixed(const TQString &nick,const TQString &user,const TQString &host); void setProperty(const TQString &name,const TQString &value); @@ -139,7 +139,7 @@ public: public: int nonWildChars(){ return m_iMaskNonWildChars; }; KviRegisteredUser * user(){ return m_pUser; }; - KviIrcMask * tqmask(){ return m_pMask; }; + KviIrcMask * mask(){ return m_pMask; }; }; typedef KviPointerList<KviRegisteredMask> KviRegisteredMaskList; @@ -173,14 +173,14 @@ public: bool removeUser(const TQString &name); bool removeGroup(const TQString &name); KviRegisteredUser * findUserByName(const TQString &name){ return m_pUserDict->find(name); }; - // tqmask must be allocated on the heap and the ownership is transferred! - // returns non zero if there is already an user with this tqmask (returns the pointer to it!) - KviRegisteredUser * addMask(KviRegisteredUser * u,KviIrcMask * tqmask); - bool removeMaskByPointer(KviIrcMask * tqmask); - bool removeMask(const KviIrcMask &tqmask); + // mask must be allocated on the heap and the ownership is transferred! + // returns non zero if there is already an user with this mask (returns the pointer to it!) + KviRegisteredUser * addMask(KviRegisteredUser * u,KviIrcMask * mask); + bool removeMaskByPointer(KviIrcMask * mask); + bool removeMask(const KviIrcMask &mask); KviRegisteredUser * findMatchingUser(const TQString &nick,const TQString &user,const TQString &host); - KviRegisteredUser * findUserWithMask(const KviIrcMask &tqmask); - KviRegisteredMask * findExactMask(const KviIrcMask &tqmask); + KviRegisteredUser * findUserWithMask(const KviIrcMask &mask); + KviRegisteredMask * findExactMask(const KviIrcMask &mask); KviRegisteredMask * findMatchingMask(const TQString &nick,const TQString &user,const TQString &host); //Only used in few places (actually one) of the code, but lot of times;perfect for inlining... //bool isIgnoredUser(const char * nick,const char * user,const char * host); diff --git a/src/kvilib/ext/kvi_sharedfiles.cpp b/src/kvilib/ext/kvi_sharedfiles.cpp index 0e793a34..a0d52a77 100644 --- a/src/kvilib/ext/kvi_sharedfiles.cpp +++ b/src/kvilib/ext/kvi_sharedfiles.cpp @@ -60,7 +60,7 @@ with /usr/arch/mp3/SonataArctica_SingInSilence_Live.mp3 as real file path , something like "SonataArctica_SingInSilence.mp3". A remote user will then request you a DCC GET SonataArctica_SingInSilence.mp3 and KVIrc will automatically send the file.[br] - Each file offer has an "user tqmask" that the requesting remote users must match to + Each file offer has an "user mask" that the requesting remote users must match to obtain the file: *!*@* matches any user, Pragma!*@* matches any user with nickname pragma, *!*@*.omnikron.net matches any user coming from the omnikron.net domain.[br] Each offer can have an expire time: the offer will be automatically removed after @@ -69,8 +69,8 @@ use an additional "size" parameter in the DCC GET request.[br] [big]Security issues[/big] This is a nice but unsecure method of sharing files.[br] - The user tqmask is a good protection but you have to use it properly!.[br] - Setting the user tqmask to Nick!*@* can be easily exploited (just by making an user disconnect + The user mask is a good protection but you have to use it properly!.[br] + Setting the user mask to Nick!*@* can be easily exploited (just by making an user disconnect in one of the well known ways and then by using his nickname).[br] On the other side, the remote end must know exactly the visible name of the offer to request and noone but you will tell him that name.[br] @@ -175,7 +175,7 @@ void KviSharedFilesManager::doInsert(KviSharedFileList * l, KviSharedFile * o) { if(o->wildcardCount() > 0) { - // the new tqmask has wildcards... if the current one has none, skip it + // the new mask has wildcards... if the current one has none, skip it if(fo->wildcardCount() > 0) { // the one in the list has wildcards too... @@ -200,7 +200,7 @@ void KviSharedFilesManager::doInsert(KviSharedFileList * l, KviSharedFile * o) } } // else the current has no wildcards...skip } else { - // the new tqmask has no wildcards.... + // the new mask has no wildcards.... if(fo->wildcardCount() > 0) { // current one has wildcards...insert @@ -275,7 +275,7 @@ KviSharedFile * KviSharedFilesManager::addSharedFile(const TQString &szName,cons } } -KviSharedFile * KviSharedFilesManager::lookupSharedFile(const TQString &szName,KviIrcMask * tqmask,unsigned int uFileSize) +KviSharedFile * KviSharedFilesManager::lookupSharedFile(const TQString &szName,KviIrcMask * mask,unsigned int uFileSize) { KviSharedFileList * l = m_pSharedListDict->find(szName); if(!l)return 0; @@ -283,10 +283,10 @@ KviSharedFile * KviSharedFilesManager::lookupSharedFile(const TQString &szName,K for(KviSharedFile * o = l->first();o;o = l->next()) { bool bMatch; - if(tqmask) + if(mask) { KviIrcMask umask(o->userMask()); - bMatch = tqmask->matchedBy(umask); + bMatch = mask->matchedBy(umask); } else bMatch = KviTQString::equalCS(o->userMask(),"*!*@*"); if(bMatch) { diff --git a/src/kvilib/ext/kvi_sharedfiles.h b/src/kvilib/ext/kvi_sharedfiles.h index 385682a2..64b22638 100644 --- a/src/kvilib/ext/kvi_sharedfiles.h +++ b/src/kvilib/ext/kvi_sharedfiles.h @@ -84,7 +84,7 @@ private: public: void addSharedFile(KviSharedFile * f); KviSharedFile * addSharedFile(const TQString &szName,const TQString &szAbsPath,const TQString &szMask,int timeoutInSecs); - KviSharedFile * lookupSharedFile(const TQString &szName,KviIrcMask * tqmask,unsigned int uFileSize = 0); + KviSharedFile * lookupSharedFile(const TQString &szName,KviIrcMask * mask,unsigned int uFileSize = 0); bool removeSharedFile(const TQString &szName,const TQString &szMask,unsigned int uFileSize); bool removeSharedFile(const TQString &szName,KviSharedFile * off); void load(const TQString &filename); |