diff options
| author | 2010-12-29 02:53:29 +0000 | |
|---|---|---|
| committer | 2010-12-29 02:53:29 +0000 | |
| commit | f0a08c4ec0dd3cf649133bfb1f4b5606522d8159 (patch) | |
| tree | 54615daa64460d60276ccfad90fdf1bcb3fb1956 /src | |
| parent | yet more splitting (diff) | |
| download | KVIrc-f0a08c4ec0dd3cf649133bfb1f4b5606522d8159.tar.gz KVIrc-f0a08c4ec0dd3cf649133bfb1f4b5606522d8159.tar.bz2 KVIrc-f0a08c4ec0dd3cf649133bfb1f4b5606522d8159.zip | |
yet more splitting
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5253 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvilib/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/kvilib/ext/KviAnimatedPixmapCache.h | 11 | ||||
| -rw-r--r-- | src/kvilib/ext/KviAnimatedPixmapInterface.h | 37 | ||||
| -rw-r--r-- | src/kvilib/ext/KviRegisteredChannel.cpp | 175 | ||||
| -rw-r--r-- | src/kvilib/ext/KviRegisteredChannel.h | 57 | ||||
| -rw-r--r-- | src/kvilib/ext/KviRegisteredChannelDataBase.cpp | 187 | ||||
| -rw-r--r-- | src/kvilib/ext/KviRegisteredChannelDataBase.h | 56 | ||||
| -rw-r--r-- | src/kvilib/ext/KviSharedFile.cpp | 41 | ||||
| -rw-r--r-- | src/kvilib/ext/KviSharedFile.h | 70 | ||||
| -rw-r--r-- | src/kvilib/ext/KviSharedFilesManager.cpp | 20 | ||||
| -rw-r--r-- | src/kvilib/ext/KviSharedFilesManager.h | 73 | ||||
| -rw-r--r-- | src/kvirc/kernel/KviApplication.cpp | 2 | ||||
| -rw-r--r-- | src/modules/channelsjoin/channelsjoinwindow.cpp | 1 | ||||
| -rw-r--r-- | src/modules/regchan/libkviregchan.cpp | 2 |
14 files changed, 413 insertions, 321 deletions
diff --git a/src/kvilib/CMakeLists.txt b/src/kvilib/CMakeLists.txt index 42e5045ce..c98e2671c 100644 --- a/src/kvilib/CMakeLists.txt +++ b/src/kvilib/CMakeLists.txt @@ -79,10 +79,12 @@ SET(kvilib_SRCS ext/KviProxy.cpp ext/KviProxyDataBase.cpp ext/KviRegisteredChannel.cpp + ext/KviRegisteredChannelDataBase.cpp ext/KviRegisteredMask.cpp ext/KviRegisteredUser.cpp ext/KviRegisteredUserDataBase.cpp ext/KviRegisteredUserGroup.cpp + ext/KviSharedFile.cpp ext/KviSharedFilesManager.cpp ext/KviStringConversion.cpp file/KviFile.cpp diff --git a/src/kvilib/ext/KviAnimatedPixmapCache.h b/src/kvilib/ext/KviAnimatedPixmapCache.h index 89a133db7..18f68cf21 100644 --- a/src/kvilib/ext/KviAnimatedPixmapCache.h +++ b/src/kvilib/ext/KviAnimatedPixmapCache.h @@ -24,19 +24,14 @@ // //============================================================================= +#include "kvi_settings.h" +#include "KviAnimatedPixmapInterface.h" + #include <QMutex> #include <QPixmap> #include <QMultiHash> #include <QMultiMap> #include <QTimer> -#include "kvi_settings.h" - -class KviAnimatedPixmapInterface -{ -public: - virtual void nextFrame(bool) = 0; - virtual ~KviAnimatedPixmapInterface() {}; -}; class KVILIB_API KviAnimatedPixmapCache : public QObject { diff --git a/src/kvilib/ext/KviAnimatedPixmapInterface.h b/src/kvilib/ext/KviAnimatedPixmapInterface.h new file mode 100644 index 000000000..f128fd6fb --- /dev/null +++ b/src/kvilib/ext/KviAnimatedPixmapInterface.h @@ -0,0 +1,37 @@ +#ifndef _KVIANIPIXINTERFACE_H_ +#define _KVIANIPIXINTERFACE_H_ + +//============================================================================= +// +// File : KviAnimatedPixmapInterface.h +// Creation date : Wed Dec 29 2010 03:19:21 CEST by Elvio Basello +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +// this file was originally part of KviAnimatedPixmapCache.h + +class KviAnimatedPixmapInterface +{ +public: + virtual void nextFrame(bool) = 0; + virtual ~KviAnimatedPixmapInterface(){}; +}; + +#endif // _KVIANIPIXINTERFACE_H_
\ No newline at end of file diff --git a/src/kvilib/ext/KviRegisteredChannel.cpp b/src/kvilib/ext/KviRegisteredChannel.cpp index 3af08a961..fd9e591a4 100644 --- a/src/kvilib/ext/KviRegisteredChannel.cpp +++ b/src/kvilib/ext/KviRegisteredChannel.cpp @@ -22,16 +22,13 @@ // //============================================================================= - -#include "KviRegisteredChannel.h" -#include "KviConfigurationFile.h" -#include "KviQString.h" #include "kvi_debug.h" +#include "KviRegisteredChannel.h" -KviRegisteredChannel::KviRegisteredChannel(const QString &name,const QString &netmask) +KviRegisteredChannel::KviRegisteredChannel(const QString & szName, const QString & szNetMask) { - m_szName = name; - m_szNetMask = netmask; + m_szName = szName; + m_szNetMask = szNetMask; m_pPropertyDict = new QHash<QString,QString>(); } @@ -39,167 +36,3 @@ KviRegisteredChannel::~KviRegisteredChannel() { delete m_pPropertyDict; } - - - -KviRegisteredChannelDataBase::KviRegisteredChannelDataBase() -{ - m_pChannelDict = new QHash<QString,KviRegisteredChannelList *>(); -} - -KviRegisteredChannelDataBase::~KviRegisteredChannelDataBase() -{ - qDeleteAll(*m_pChannelDict); - delete m_pChannelDict; -} - -void KviRegisteredChannelDataBase::load(const QString &filename) -{ - KviConfigurationFile cfg(filename,KviConfigurationFile::Read); - - qDeleteAll(*m_pChannelDict); - m_pChannelDict->clear(); - - KviConfigurationFileIterator it(*(cfg.dict())); - - while(KviConfigurationFileGroup * d = it.current()) - { - QString szMask = it.currentKey(); - QString szChan = KviQString::leftToLast(szMask,QChar('@'),false); - KviQString::cutToLast(szMask,QChar('@'),true); - KviRegisteredChannel * c = new KviRegisteredChannel(szChan,szMask); - add(c); - KviConfigurationFileGroupIterator sit(*d); - while(QString * s = sit.current()) - { - c->setProperty(sit.currentKey(),*s); - ++sit; - } - ++it; - } -} - -void KviRegisteredChannelDataBase::save(const QString &filename) -{ - KviConfigurationFile cfg(filename,KviConfigurationFile::Write); - cfg.clear(); - cfg.preserveEmptyGroups(true); - - for(QHash<QString,KviRegisteredChannelList *>::Iterator it = m_pChannelDict->begin();it != m_pChannelDict->end();++it) - { - KviRegisteredChannelList * l = it.value(); - KVI_ASSERT(l); - - for(KviRegisteredChannel * c = l->first();c;c = l->next()) - { - QString szGroup = QString::fromUtf8("%1@%2").arg(c->name(),c->netMask()); - cfg.setGroup(szGroup); - - QHash<QString,QString> * pPropertyDict = c->propertyDict(); - KVI_ASSERT(pPropertyDict); - - for(QHash<QString,QString>::Iterator it2 = pPropertyDict->begin();it2 != pPropertyDict->end();++it2) - cfg.writeEntry(it2.key(),it2.value()); - } - } -} - -KviRegisteredChannel * KviRegisteredChannelDataBase::find(const QString &name,const QString &net) -{ - KviRegisteredChannelList * l = m_pChannelDict->value(name); - - if(!l) - return 0; - - for(KviRegisteredChannel * c = l->first();c;c = l->next()) - { - if(KviQString::matchWildExpressions(c->netMask(),net)) - return c; - } - - return 0; -} - -KviRegisteredChannel * KviRegisteredChannelDataBase::findExact(const QString &name,const QString &netmask) -{ - KviRegisteredChannelList * l = m_pChannelDict->value(name); - - if(!l) - return 0; - - for(KviRegisteredChannel * c = l->first();c;c = l->next()) - { - if(KviQString::equalCI(c->netMask(),netmask)) - return c; - } - - return 0; -} - -void KviRegisteredChannelDataBase::remove(KviRegisteredChannel * c) -{ - KVI_TRACE_FUNCTION; - KviRegisteredChannelList * l = m_pChannelDict->value(c->name()); - if(!l)return; - for(KviRegisteredChannel * ch = l->first();ch;ch = l->next()) - { - if(ch == c) - { - if(l->count() <= 1) - { - m_pChannelDict->remove(c->name()); - delete l; // will kill the channel too - } else { - l->removeRef(c); - } - return; - } - } -} - - -void KviRegisteredChannelDataBase::add(KviRegisteredChannel * c) -{ - KviRegisteredChannel * old = findExact(c->name(),c->netMask()); - - if(old) - { - // merge properties - QHash<QString,QString> * pPropertyDict = old->propertyDict(); - KVI_ASSERT(pPropertyDict); - - for(QHash<QString,QString>::Iterator it = pPropertyDict->begin();it != pPropertyDict->end();++it) - { - if(!c->property(it.key()).isEmpty()) - c->setProperty(it.key(),it.value()); - } - - remove(old); - } - - KviRegisteredChannelList * l = m_pChannelDict->value(c->name()); - if(!l) - { - l = new KviRegisteredChannelList(); - l->setAutoDelete(true); - m_pChannelDict->insert(c->name(),l); - } - - // insert where there are less wildcards - int o = c->netMask().count(QChar('*')); - - int idx = 0; - for(KviRegisteredChannel * rc = l->first();rc;rc = l->next()) - { - if(rc->netMask().count(QChar('*')) > o) - { - // the existing has more wildcards, insert here! - l->insert(idx,c); - return; - } - idx++; - } - - l->append(c); -} - diff --git a/src/kvilib/ext/KviRegisteredChannel.h b/src/kvilib/ext/KviRegisteredChannel.h index fa84c3d08..1b3f220ab 100644 --- a/src/kvilib/ext/KviRegisteredChannel.h +++ b/src/kvilib/ext/KviRegisteredChannel.h @@ -35,69 +35,26 @@ class KVILIB_API KviRegisteredChannel : public KviHeapObject { friend class KviRegisteredChannelDataBase; public: - KviRegisteredChannel(const QString &name,const QString &netmask); + KviRegisteredChannel(const QString & szName, const QString & szNetMask); ~KviRegisteredChannel(); protected: QString m_szName; QString m_szNetMask; QHash<QString,QString> * m_pPropertyDict; public: - QHash<QString,QString> * propertyDict() - { - return m_pPropertyDict; - } + QHash<QString,QString> * propertyDict(){ return m_pPropertyDict; } - const QString & name() - { - return m_szName; - } + const QString & name(){ return m_szName; } - const QString & netMask() - { - return m_szNetMask; - } + const QString & netMask(){ return m_szNetMask; } - QString property(const QString &name) - { - return m_pPropertyDict->value(name); - } + QString property(const QString & szName){ return m_pPropertyDict->value(szName); } - void setProperty(const QString &name,const QString &val) - { - m_pPropertyDict->insert(name,val); - } + void setProperty(const QString & szName,const QString & szValue){ m_pPropertyDict->insert(szName,szValue); } - void removeProperty(const QString &name) - { - m_pPropertyDict->remove(name); - } + void removeProperty(const QString & szName){ m_pPropertyDict->remove(szName); } }; typedef KVILIB_API_TYPEDEF KviPointerList<KviRegisteredChannel> KviRegisteredChannelList; -class KVILIB_API KviRegisteredChannelDataBase -{ -public: - KviRegisteredChannelDataBase(); - ~KviRegisteredChannelDataBase(); -protected: - QHash<QString,KviRegisteredChannelList *> * m_pChannelDict; -public: - QHash<QString,KviRegisteredChannelList *> * channelDict() - { - return m_pChannelDict; - } - - KviRegisteredChannel * find(const QString &name,const QString &net); - - KviRegisteredChannel * findExact(const QString &name,const QString &netmask); - - void remove(KviRegisteredChannel * c); - void add(KviRegisteredChannel * c); - - void load(const QString &filename); - void save(const QString &filename); -}; - - #endif //_KVI_REGCHAN_H_ diff --git a/src/kvilib/ext/KviRegisteredChannelDataBase.cpp b/src/kvilib/ext/KviRegisteredChannelDataBase.cpp new file mode 100644 index 000000000..1353c093c --- /dev/null +++ b/src/kvilib/ext/KviRegisteredChannelDataBase.cpp @@ -0,0 +1,187 @@ +//============================================================================= +// +// File : KviRegisteredChannelDataBase.cpp +// Creation date : Wed Dec 29 2010 03:28:05 CEST by Elvio Basello +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#include "KviRegisteredChannelDataBase.h" +#include "KviConfigurationFile.h" + +KviRegisteredChannelDataBase::KviRegisteredChannelDataBase() +{ + m_pChannelDict = new QHash<QString,KviRegisteredChannelList *>(); +} + +KviRegisteredChannelDataBase::~KviRegisteredChannelDataBase() +{ + qDeleteAll(*m_pChannelDict); + delete m_pChannelDict; +} + +void KviRegisteredChannelDataBase::load(const QString &filename) +{ + KviConfigurationFile cfg(filename,KviConfigurationFile::Read); + + qDeleteAll(*m_pChannelDict); + m_pChannelDict->clear(); + + KviConfigurationFileIterator it(*(cfg.dict())); + + while(KviConfigurationFileGroup * d = it.current()) + { + QString szMask = it.currentKey(); + QString szChan = KviQString::leftToLast(szMask,QChar('@'),false); + KviQString::cutToLast(szMask,QChar('@'),true); + KviRegisteredChannel * c = new KviRegisteredChannel(szChan,szMask); + add(c); + KviConfigurationFileGroupIterator sit(*d); + while(QString * s = sit.current()) + { + c->setProperty(sit.currentKey(),*s); + ++sit; + } + ++it; + } +} + +void KviRegisteredChannelDataBase::save(const QString &filename) +{ + KviConfigurationFile cfg(filename,KviConfigurationFile::Write); + cfg.clear(); + cfg.preserveEmptyGroups(true); + + for(QHash<QString,KviRegisteredChannelList *>::Iterator it = m_pChannelDict->begin();it != m_pChannelDict->end();++it) + { + KviRegisteredChannelList * l = it.value(); + KVI_ASSERT(l); + + for(KviRegisteredChannel * c = l->first();c;c = l->next()) + { + QString szGroup = QString::fromUtf8("%1@%2").arg(c->name(),c->netMask()); + cfg.setGroup(szGroup); + + QHash<QString,QString> * pPropertyDict = c->propertyDict(); + KVI_ASSERT(pPropertyDict); + + for(QHash<QString,QString>::Iterator it2 = pPropertyDict->begin();it2 != pPropertyDict->end();++it2) + cfg.writeEntry(it2.key(),it2.value()); + } + } +} + +KviRegisteredChannel * KviRegisteredChannelDataBase::find(const QString &name,const QString &net) +{ + KviRegisteredChannelList * l = m_pChannelDict->value(name); + + if(!l) + return 0; + + for(KviRegisteredChannel * c = l->first();c;c = l->next()) + { + if(KviQString::matchWildExpressions(c->netMask(),net)) + return c; + } + + return 0; +} + +KviRegisteredChannel * KviRegisteredChannelDataBase::findExact(const QString &name,const QString &netmask) +{ + KviRegisteredChannelList * l = m_pChannelDict->value(name); + + if(!l) + return 0; + + for(KviRegisteredChannel * c = l->first();c;c = l->next()) + { + if(KviQString::equalCI(c->netMask(),netmask)) + return c; + } + + return 0; +} + +void KviRegisteredChannelDataBase::remove(KviRegisteredChannel * c) +{ + KVI_TRACE_FUNCTION; + KviRegisteredChannelList * l = m_pChannelDict->value(c->name()); + if(!l)return; + for(KviRegisteredChannel * ch = l->first();ch;ch = l->next()) + { + if(ch == c) + { + if(l->count() <= 1) + { + m_pChannelDict->remove(c->name()); + delete l; // will kill the channel too + } else { + l->removeRef(c); + } + return; + } + } +} + + +void KviRegisteredChannelDataBase::add(KviRegisteredChannel * c) +{ + KviRegisteredChannel * old = findExact(c->name(),c->netMask()); + + if(old) + { + // merge properties + QHash<QString,QString> * pPropertyDict = old->propertyDict(); + KVI_ASSERT(pPropertyDict); + + for(QHash<QString,QString>::Iterator it = pPropertyDict->begin();it != pPropertyDict->end();++it) + { + if(!c->property(it.key()).isEmpty()) + c->setProperty(it.key(),it.value()); + } + + remove(old); + } + + KviRegisteredChannelList * l = m_pChannelDict->value(c->name()); + if(!l) + { + l = new KviRegisteredChannelList(); + l->setAutoDelete(true); + m_pChannelDict->insert(c->name(),l); + } + + // insert where there are less wildcards + int o = c->netMask().count(QChar('*')); + + int idx = 0; + for(KviRegisteredChannel * rc = l->first();rc;rc = l->next()) + { + if(rc->netMask().count(QChar('*')) > o) + { + // the existing has more wildcards, insert here! + l->insert(idx,c); + return; + } + idx++; + } + + l->append(c); +} diff --git a/src/kvilib/ext/KviRegisteredChannelDataBase.h b/src/kvilib/ext/KviRegisteredChannelDataBase.h new file mode 100644 index 000000000..3dd81d356 --- /dev/null +++ b/src/kvilib/ext/KviRegisteredChannelDataBase.h @@ -0,0 +1,56 @@ +#ifndef _KVIREGCHANDB_H_ +#define _KVIREGCHANDB_H_ + +//============================================================================= +// +// File : KviRegisteredChannelDataBase.h +// Creation date : Wed Dec 29 2010 03:28:05 CEST by Elvio Basello +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +// this file was originally part of KviRegisteredChannel.h + +#include "kvi_settings.h" +#include "KviRegisteredChannel.h" + +#include <QHash> + +class KVILIB_API KviRegisteredChannelDataBase +{ +public: + KviRegisteredChannelDataBase(); + ~KviRegisteredChannelDataBase(); +protected: + QHash<QString,KviRegisteredChannelList *> * m_pChannelDict; +public: + QHash<QString,KviRegisteredChannelList *> * channelDict(){ return m_pChannelDict; } + + KviRegisteredChannel * find(const QString & szName, const QString & szNetMask); + + KviRegisteredChannel * findExact(const QString & szName,const QString & szNetMask); + + void remove(KviRegisteredChannel * pChan); + void add(KviRegisteredChannel * pChan); + + void load(const QString & szFilename); + void save(const QString & szFilename); +}; + +#endif // _KVIREGCHANDB_H_ diff --git a/src/kvilib/ext/KviSharedFile.cpp b/src/kvilib/ext/KviSharedFile.cpp new file mode 100644 index 000000000..e62801548 --- /dev/null +++ b/src/kvilib/ext/KviSharedFile.cpp @@ -0,0 +1,41 @@ +//============================================================================= +// +// File : KviSharedFile.h +// Creation date : Wed Dec 29 2010 03:40:05 CEST by Elvio Basello +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#include "KviSharedFile.h" + +KviSharedFile::KviSharedFile(const QString & szName, const QString & szAbsPath, const QString & szUserMask, time_t expireTime, unsigned int uFileSize) +{ + m_szName = szName; + m_szAbsFilePath = szAbsPath; + m_szUserMask = szUserMask; + m_expireTime = expireTime; + m_uFileSize = uFileSize; + + m_uWildCount = m_szUserMask.count('*'); + m_uNonWildCount = m_szUserMask.length() - m_uWildCount; +} + +KviSharedFile::~KviSharedFile() +{ +} diff --git a/src/kvilib/ext/KviSharedFile.h b/src/kvilib/ext/KviSharedFile.h new file mode 100644 index 000000000..6fb280d5d --- /dev/null +++ b/src/kvilib/ext/KviSharedFile.h @@ -0,0 +1,70 @@ +#ifndef _KVISHAREDFILE_H_ +#define _KVISHAREDFILE_H_ + +//============================================================================= +// +// File : KviSharedFile.h +// Creation date : Wed Dec 29 2010 03:40:05 CEST by Elvio Basello +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2010 Elvio Basello (hellvis69 at gmail dot com) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +// this file was originally part of KviPixmap.h + +#include "kvi_settings.h" +#include "KviHeapObject.h" +#include "KviPointerList.h" + +#include <QString> + +#include <time.h> + +class KVILIB_API KviSharedFile : public KviHeapObject +{ +public: + KviSharedFile(const QString & szName, const QString & szAbsPath, const QString & szUserMask, time_t expireTime, unsigned int uFileSize); + ~KviSharedFile(); +private: + QString m_szName; + QString m_szAbsFilePath; + time_t m_expireTime; + QString m_szUserMask; + unsigned int m_uFileSize; + unsigned int m_uWildCount; + unsigned int m_uNonWildCount; +public: + const QString & name(){ return m_szName; }; + + const QString & absFilePath(){ return m_szAbsFilePath; }; + + const QString & userMask(){ return m_szUserMask; }; + + time_t expireTime(){ return m_expireTime; }; + bool expires(){ return (m_expireTime != 0); }; + + unsigned int fileSize(){ return m_uFileSize; }; + + unsigned int wildcardCount(){ return m_uWildCount; }; + unsigned int nonWildcardCount(){ return m_uNonWildCount; }; + int maskLength(){ return m_szUserMask.length(); }; +}; + +typedef KviPointerList<KviSharedFile> KviSharedFileList; + +#endif // _KVISHAREDFILE_H_ diff --git a/src/kvilib/ext/KviSharedFilesManager.cpp b/src/kvilib/ext/KviSharedFilesManager.cpp index 4bdd4574d..990082950 100644 --- a/src/kvilib/ext/KviSharedFilesManager.cpp +++ b/src/kvilib/ext/KviSharedFilesManager.cpp @@ -22,12 +22,10 @@ // //============================================================================= - - #include "KviSharedFilesManager.h" - #include "KviConfigurationFile.h" #include "KviFileUtils.h" +#include "KviIrcMask.h" #include <QFileInfo> @@ -78,22 +76,6 @@ Please don't send complains if someone stoles your /etc/passwd : it is because you have permitted that.[br] */ -KviSharedFile::KviSharedFile(const QString &szName,const QString &szAbsPath,const QString &szUserMask,time_t expireTime,unsigned int uFileSize) -{ - m_szName = szName; - m_szAbsFilePath = szAbsPath; - m_szUserMask = szUserMask; - m_expireTime = expireTime; - m_uFileSize = uFileSize; - - m_uWildCount = m_szUserMask.count('*'); - m_uNonWildCount = m_szUserMask.length() - m_uWildCount; -} - -KviSharedFile::~KviSharedFile() -{ -} - KviSharedFilesManager::KviSharedFilesManager() : QObject() diff --git a/src/kvilib/ext/KviSharedFilesManager.h b/src/kvilib/ext/KviSharedFilesManager.h index 4e230b660..02af7fd9d 100644 --- a/src/kvilib/ext/KviSharedFilesManager.h +++ b/src/kvilib/ext/KviSharedFilesManager.h @@ -25,51 +25,12 @@ //============================================================================= #include "kvi_settings.h" -#include "KviHeapObject.h" -#include "KviCString.h" -#include "KviIrcMask.h" -#include "KviPointerList.h" -#include "KviQString.h" - #include "KviPointerHashTable.h" +#include "KviSharedFile.h" -#include <time.h> #include <QTimer> - -class KVILIB_API KviSharedFile : public KviHeapObject -{ -public: - KviSharedFile(const QString &szName,const QString &szAbsPath,const QString &szUserMask,time_t expireTime,unsigned int uFileSize); - ~KviSharedFile(); -private: - QString m_szName; - QString m_szAbsFilePath; - time_t m_expireTime; - QString m_szUserMask; - unsigned int m_uFileSize; - unsigned int m_uWildCount; - unsigned int m_uNonWildCount; -public: - const QString &name(){ return m_szName; }; - - const QString &absFilePath(){ return m_szAbsFilePath; }; - - const QString &userMask(){ return m_szUserMask; }; - - time_t expireTime(){ return m_expireTime; }; - bool expires(){ return (m_expireTime != 0); }; - - unsigned int fileSize(){ return m_uFileSize; }; - - unsigned int wildcardCount(){ return m_uWildCount; }; - unsigned int nonWildcardCount(){ return m_uNonWildCount; }; - int maskLength(){ return m_szUserMask.length(); }; -}; - - -typedef KviPointerList<KviSharedFile> KviSharedFileList; - +class KviIrcMask; class KVILIB_API KviSharedFilesManager : public QObject { @@ -100,34 +61,4 @@ signals: void sharedFileRemoved(KviSharedFile * f); }; - -/* -class KviSharedFile -{ - KviSharedFile(); - KviSharedFile(const KviCString &filePath,const KviCString &userMask); - ~KviSharedFile(); -protected: - KviCString m_szFilePath; - KviCString m_szVisibleName; - KviCString m_szMd5Sum; - KviCString m_szUserMask; - unsigned short int m_uWildCount; - unsigned short int m_uNonWildCount; - - unsigned int m_uFileSize; - time_t m_tExpireTime; -public: - void setFilePath(const KviCString &filePath); - void setUserMask(const KviCString &userMask); - void setVisibleName(const KviCString &visibleName); - void setMd5Sum(const KviCString &md5Sum); - void setFileSize(unsigned int uFileSize); - void setExpireTime(time_t expireTime); - void doNotExpire(){ setExpireTime((time_t)0); }; - - void computeMd5Sum(); -}; -*/ - #endif //_KVI_FILETRADER_H_ diff --git a/src/kvirc/kernel/KviApplication.cpp b/src/kvirc/kernel/KviApplication.cpp index 5f449ca79..0f6c2d41f 100644 --- a/src/kvirc/kernel/KviApplication.cpp +++ b/src/kvirc/kernel/KviApplication.cpp @@ -59,7 +59,7 @@ #include "KviTextIconWindow.h" #include "KviHistoryWindow.h" #include "KviCtcpPageDialog.h" -#include "KviRegisteredChannel.h" +#include "KviRegisteredChannelDataBase.h" #include "KviModuleExtension.h" #include "KviInternalCommand.h" #include "KviFileTransfer.h" diff --git a/src/modules/channelsjoin/channelsjoinwindow.cpp b/src/modules/channelsjoin/channelsjoinwindow.cpp index 79d108abc..783d5fca6 100644 --- a/src/modules/channelsjoin/channelsjoinwindow.cpp +++ b/src/modules/channelsjoin/channelsjoinwindow.cpp @@ -33,6 +33,7 @@ #include "KviIconManager.h" #include "KviConsoleWindow.h" #include "KviRegisteredChannel.h" +#include "KviRegisteredChannelDataBase.h" #include "KviKvsScript.h" #include "KviTalGroupBox.h" diff --git a/src/modules/regchan/libkviregchan.cpp b/src/modules/regchan/libkviregchan.cpp index b4384a536..f20ea76cb 100644 --- a/src/modules/regchan/libkviregchan.cpp +++ b/src/modules/regchan/libkviregchan.cpp @@ -24,7 +24,7 @@ // incomplete #include "KviModule.h" -#include "KviRegisteredChannel.h" +#include "KviRegisteredChannelDataBase.h" #include "KviLocale.h" #include "kvi_out.h" #include "KviMircCntrl.h" |
