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/irc/kvi_nickserv.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/irc/kvi_nickserv.cpp')
-rw-r--r-- | src/kvilib/irc/kvi_nickserv.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/kvilib/irc/kvi_nickserv.cpp b/src/kvilib/irc/kvi_nickserv.cpp index a1809f84..24a50e96 100644 --- a/src/kvilib/irc/kvi_nickserv.cpp +++ b/src/kvilib/irc/kvi_nickserv.cpp @@ -29,7 +29,7 @@ #include "kvi_config.h" #include "kvi_ircmask.h" -#include <qregexp.h> +#include <tqregexp.h> @@ -85,31 +85,31 @@ KviNickServRuleSet::~KviNickServRuleSet() if(m_pRules)delete m_pRules; } -void KviNickServRuleSet::save(KviConfig * cfg,const QString &prefix) +void KviNickServRuleSet::save(KviConfig * cfg,const TQString &prefix) { if(!m_pRules)return; // nothing to save if(m_pRules->isEmpty())return; // should never happen anyway - QString tmp; + TQString tmp; if(m_bEnabled) { - KviQString::sprintf(tmp,"%QNSEnabled",&prefix); + KviTQString::sprintf(tmp,"%TQNSEnabled",&prefix); cfg->writeEntry(tmp,m_bEnabled); } - KviQString::sprintf(tmp,"%QNSRules",&prefix); + KviTQString::sprintf(tmp,"%TQNSRules",&prefix); cfg->writeEntry(tmp,m_pRules->count()); int idx = 0; for(KviNickServRule * r = m_pRules->first();r;r = m_pRules->next()) { - KviQString::sprintf(tmp,"%QNSRule%d_",&prefix,idx); + KviTQString::sprintf(tmp,"%TQNSRule%d_",&prefix,idx); r->save(cfg,tmp); idx++; } } -KviNickServRuleSet * KviNickServRuleSet::load(KviConfig * cfg,const QString &prefix) +KviNickServRuleSet * KviNickServRuleSet::load(KviConfig * cfg,const TQString &prefix) { - QString tmp; - KviQString::sprintf(tmp,"%QNSRules",&prefix); + TQString tmp; + KviTQString::sprintf(tmp,"%TQNSRules",&prefix); unsigned int cnt = cfg->readUIntEntry(tmp,0); if(cnt == 0)return 0; KviNickServRuleSet * s = new KviNickServRuleSet(); @@ -118,26 +118,26 @@ KviNickServRuleSet * KviNickServRuleSet::load(KviConfig * cfg,const QString &pre return 0; } -void KviNickServRuleSet::load(const QString &szConfigFile) +void KviNickServRuleSet::load(const TQString &szConfigFile) { clear(); KviConfig cfg(szConfigFile,KviConfig::Read); - QString tmp; - KviQString::sprintf(tmp,"NSRules"); + TQString tmp; + KviTQString::sprintf(tmp,"NSRules"); unsigned int cnt = cfg.readUIntEntry(tmp,0); if(cnt == 0)return; - loadPrivate(&cfg,QString(""),cnt); + loadPrivate(&cfg,TQString(""),cnt); } -void KviNickServRuleSet::save(const QString &szConfigFile) +void KviNickServRuleSet::save(const TQString &szConfigFile) { KviConfig cfg(szConfigFile,KviConfig::Write); cfg.clear(); - save(&cfg,QString("")); + save(&cfg,TQString("")); } -bool KviNickServRuleSet::loadPrivate(KviConfig * cfg,const QString &prefix,unsigned int nEntries) +bool KviNickServRuleSet::loadPrivate(KviConfig * cfg,const TQString &prefix,unsigned int nEntries) { if(m_pRules)m_pRules->clear(); else { @@ -147,12 +147,12 @@ bool KviNickServRuleSet::loadPrivate(KviConfig * cfg,const QString &prefix,unsig if(nEntries != 0) { - QString tmp; - KviQString::sprintf(tmp,"%QNSEnabled",&prefix); + TQString tmp; + KviTQString::sprintf(tmp,"%TQNSEnabled",&prefix); m_bEnabled = cfg->readBoolEntry(tmp,false); for(unsigned int u=0;u<nEntries;u++) { - KviQString::sprintf(tmp,"%QNSRule%u_",&prefix,u); + KviTQString::sprintf(tmp,"%TQNSRule%u_",&prefix,u); KviNickServRule * r = new KviNickServRule(); if(!r->load(cfg,tmp))delete r; else m_pRules->append(r); @@ -195,26 +195,26 @@ KviNickServRuleSet * KviNickServRuleSet::createInstance() } -KviNickServRule * KviNickServRuleSet::matchRule(const QString &szNick,const KviIrcMask *nickServ,const QString &szMsg,const QString &szServer) +KviNickServRule * KviNickServRuleSet::matchRule(const TQString &szNick,const KviIrcMask *nickServ,const TQString &szMsg,const TQString &szServer) { if(!m_pRules)return 0; for(KviNickServRule *r = m_pRules->first();r;r = m_pRules->next()) { - if(!KviQString::matchStringCI(r->registeredNick(),szNick,false,true)) continue; + if(!KviTQString::matchStringCI(r->registeredNick(),szNick,false,true)) continue; if(!szServer.isEmpty()) { #ifdef COMPILE_USE_QT4 - QRegExp res(r->serverMask(),Qt::CaseInsensitive,QRegExp::Wildcard); + TQRegExp res(r->serverMask(),TQt::CaseInsensitive,TQRegExp::Wildcard); #else - QRegExp res(r->serverMask(),false,true); + TQRegExp res(r->serverMask(),false,true); #endif if(!res.exactMatch(szServer))continue; } if(!nickServ->matchedBy(KviIrcMask(r->nickServMask())))continue; #ifdef COMPILE_USE_QT4 - QRegExp re(r->messageRegexp(),Qt::CaseInsensitive,QRegExp::Wildcard); + TQRegExp re(r->messageRegexp(),TQt::CaseInsensitive,TQRegExp::Wildcard); #else - QRegExp re(r->messageRegexp(),false,true); + TQRegExp re(r->messageRegexp(),false,true); #endif if(re.exactMatch(szMsg))return r; } @@ -264,45 +264,45 @@ void KviNickServRule::copyFrom(const KviNickServRule &src) m_szServerMask = src.m_szServerMask; } -void KviNickServRule::save(KviConfig * cfg,const QString &prefix) +void KviNickServRule::save(KviConfig * cfg,const TQString &prefix) { - QString tmp; - KviQString::sprintf(tmp,"%QRegisteredNick",&prefix); + TQString tmp; + KviTQString::sprintf(tmp,"%TQRegisteredNick",&prefix); cfg->writeEntry(tmp,m_szRegisteredNick); - KviQString::sprintf(tmp,"%QNickServMask",&prefix); + KviTQString::sprintf(tmp,"%TQNickServMask",&prefix); cfg->writeEntry(tmp,m_szNickServMask); - KviQString::sprintf(tmp,"%QMessageRegexp",&prefix); + KviTQString::sprintf(tmp,"%TQMessageRegexp",&prefix); cfg->writeEntry(tmp,m_szMessageRegexp); - KviQString::sprintf(tmp,"%QIdentifyCommand",&prefix); + KviTQString::sprintf(tmp,"%TQIdentifyCommand",&prefix); cfg->writeEntry(tmp,m_szIdentifyCommand); - KviQString::sprintf(tmp,"%QServerMask",&prefix); + KviTQString::sprintf(tmp,"%TQServerMask",&prefix); cfg->writeEntry(tmp,m_szServerMask); } -bool KviNickServRule::load(KviConfig * cfg,const QString &prefix) +bool KviNickServRule::load(KviConfig * cfg,const TQString &prefix) { - QString tmp; - KviQString::sprintf(tmp,"%QRegisteredNick",&prefix); - m_szRegisteredNick = KviQString::trimmed(cfg->readQStringEntry(tmp)); + TQString tmp; + KviTQString::sprintf(tmp,"%TQRegisteredNick",&prefix); + m_szRegisteredNick = KviTQString::trimmed(cfg->readTQStringEntry(tmp)); if(m_szRegisteredNick.isEmpty())return false; - KviQString::sprintf(tmp,"%QNickServMask",&prefix); - m_szNickServMask = cfg->readQStringEntry(tmp); + KviTQString::sprintf(tmp,"%TQNickServMask",&prefix); + m_szNickServMask = cfg->readTQStringEntry(tmp); if(m_szNickServMask.isEmpty())return false; - KviQString::sprintf(tmp,"%QServerMask",&prefix); - m_szServerMask = cfg->readQStringEntry(tmp,QString::null); - KviQString::sprintf(tmp,"%QMessageRegexp",&prefix); - m_szMessageRegexp = cfg->readQStringEntry(tmp); + KviTQString::sprintf(tmp,"%TQServerMask",&prefix); + m_szServerMask = cfg->readTQStringEntry(tmp,TQString()); + KviTQString::sprintf(tmp,"%TQMessageRegexp",&prefix); + m_szMessageRegexp = cfg->readTQStringEntry(tmp); if(m_szMessageRegexp.isEmpty())return false; - KviQString::sprintf(tmp,"%QIdentifyCommand",&prefix); - m_szIdentifyCommand = cfg->readQStringEntry(tmp); + KviTQString::sprintf(tmp,"%TQIdentifyCommand",&prefix); + m_szIdentifyCommand = cfg->readTQStringEntry(tmp); return !m_szIdentifyCommand.isEmpty(); } -KviNickServRule * KviNickServRule::createInstance(const QString &szRegisteredNick, - const QString &szNickServMask, - const QString &szMessageRegexp, - const QString &szIdentifyCommand, - const QString &szServerMask) +KviNickServRule * KviNickServRule::createInstance(const TQString &szRegisteredNick, + const TQString &szNickServMask, + const TQString &szMessageRegexp, + const TQString &szIdentifyCommand, + const TQString &szServerMask) { return new KviNickServRule(szRegisteredNick,szNickServMask,szMessageRegexp,szIdentifyCommand,szServerMask); } |