summaryrefslogtreecommitdiffstats
path: root/src/kvilib/irc/kvi_ircserverdb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kvilib/irc/kvi_ircserverdb.cpp')
-rw-r--r--src/kvilib/irc/kvi_ircserverdb.cpp168
1 files changed, 84 insertions, 84 deletions
diff --git a/src/kvilib/irc/kvi_ircserverdb.cpp b/src/kvilib/irc/kvi_ircserverdb.cpp
index 88198b12..172da1f6 100644
--- a/src/kvilib/irc/kvi_ircserverdb.cpp
+++ b/src/kvilib/irc/kvi_ircserverdb.cpp
@@ -25,10 +25,10 @@
#define __KVILIB__
-#include <qapplication.h>
-#include <qlayout.h>
-#include <qmessagebox.h>
-#include <qcheckbox.h>
+#include <tqapplication.h>
+#include <tqlayout.h>
+#include <tqmessagebox.h>
+#include <tqcheckbox.h>
#include "kvi_ircserverdb.h"
#include "kvi_config.h"
@@ -59,7 +59,7 @@ KviIrcServer * KviIrcServerDataBaseRecord::findServer(const KviIrcServer * pServ
{
for(KviIrcServer *s=m_pServerList->first();s;s=m_pServerList->next())
{
- if(KviQString::equalCI(s->m_szHostname,pServer->m_szHostname) &&
+ if(KviTQString::equalCI(s->m_szHostname,pServer->m_szHostname) &&
(s->m_uPort == pServer->m_uPort) &&
(s->useSSL() == pServer->useSSL()) &&
(s->isIpV6() == pServer->isIpV6()))return s;
@@ -69,7 +69,7 @@ KviIrcServer * KviIrcServerDataBaseRecord::findServer(const KviIrcServer * pServ
void KviIrcServerDataBaseRecord::setCurrentServer(KviIrcServer *srv)
{
- if(m_pServerList->findRef(srv) != -1)m_pCurrentServer = srv;
+ if(m_pServerList->tqfindRef(srv) != -1)m_pCurrentServer = srv;
}
KviIrcServer * KviIrcServerDataBaseRecord::currentServer()
@@ -90,7 +90,7 @@ KviIrcServer * KviIrcServerDataBaseRecord::currentServer()
KviIrcServerDataBase::KviIrcServerDataBase()
{
- m_pRecords = new KviPointerHashTable<QString,KviIrcServerDataBaseRecord>(17,false);
+ m_pRecords = new KviPointerHashTable<TQString,KviIrcServerDataBaseRecord>(17,false);
m_pRecords->setAutoDelete(true);
m_pAutoConnectOnStartupServers = 0;
m_pAutoConnectOnStartupNetworks = 0;
@@ -126,19 +126,19 @@ void KviIrcServerDataBase::clear()
KviIrcServerDataBaseRecord * KviIrcServerDataBase::insertNetwork(KviIrcNetwork *n)
{
KviIrcServerDataBaseRecord * r = new KviIrcServerDataBaseRecord(n);
- m_pRecords->replace(n->name(),r);
+ m_pRecords->tqreplace(n->name(),r);
return r;
}
-KviIrcServerDataBaseRecord * KviIrcServerDataBase::findRecord(const QString &szNetName)
+KviIrcServerDataBaseRecord * KviIrcServerDataBase::findRecord(const TQString &szNetName)
{
- return m_pRecords->find(szNetName);
+ return m_pRecords->tqfind(szNetName);
}
-KviIrcNetwork * KviIrcServerDataBase::findNetwork(const QString &szName)
+KviIrcNetwork * KviIrcServerDataBase::findNetwork(const TQString &szName)
{
- KviIrcServerDataBaseRecord * r = m_pRecords->find(szName);
+ KviIrcServerDataBaseRecord * r = m_pRecords->tqfind(szName);
if(!r)return 0;
return r->network();
}
@@ -146,19 +146,19 @@ KviIrcNetwork * KviIrcServerDataBase::findNetwork(const QString &szName)
KviIrcServerDataBaseRecord * KviIrcServerDataBase::currentRecord()
{
KviIrcServerDataBaseRecord * r = 0;
- if(!m_szCurrentNetwork.isEmpty())r = m_pRecords->find(m_szCurrentNetwork);
+ if(!m_szCurrentNetwork.isEmpty())r = m_pRecords->tqfind(m_szCurrentNetwork);
if(r)return r;
- KviPointerHashTableIterator<QString,KviIrcServerDataBaseRecord> it(*m_pRecords);
+ KviPointerHashTableIterator<TQString,KviIrcServerDataBaseRecord> it(*m_pRecords);
r = it.current();
if(!r)return 0;
m_szCurrentNetwork = r->network()->name();
return r;
}
-void KviIrcServerDataBase::updateServerIp(KviIrcServer * pServer,const QString & ip)
+void KviIrcServerDataBase::updateServerIp(KviIrcServer * pServer,const TQString & ip)
{
- KviPointerHashTableIterator<QString,KviIrcServerDataBaseRecord> it(*m_pRecords);
+ KviPointerHashTableIterator<TQString,KviIrcServerDataBaseRecord> it(*m_pRecords);
while(KviIrcServerDataBaseRecord * r = it.current())
{
KviIrcServer * srv = r->findServer(pServer);
@@ -171,7 +171,7 @@ void KviIrcServerDataBase::updateServerIp(KviIrcServer * pServer,const QString &
}
}
-bool KviIrcServerDataBase::makeCurrentBestServerInNetwork(const QString &szNetName,KviIrcServerDataBaseRecord * r,QString &szError)
+bool KviIrcServerDataBase::makeCurrentBestServerInNetwork(const TQString &szNetName,KviIrcServerDataBaseRecord * r,TQString &szError)
{
m_szCurrentNetwork = szNetName;
// find a round-robin server in that network
@@ -185,11 +185,11 @@ bool KviIrcServerDataBase::makeCurrentBestServerInNetwork(const QString &szNetNa
for(KviIrcServer * s = r->m_pServerList->first();s;s = r->m_pServerList->next())
{
#ifdef COMPILE_USE_QT4
- if(s->m_szDescription.contains("random",Qt::CaseInsensitive) ||
- (s->m_szDescription.contains("round",Qt::CaseInsensitive) && s->m_szDescription.contains("robin",Qt::CaseInsensitive)))
+ if(s->m_szDescription.tqcontains("random",TQt::CaseInsensitive) ||
+ (s->m_szDescription.tqcontains("round",TQt::CaseInsensitive) && s->m_szDescription.tqcontains("robin",TQt::CaseInsensitive)))
#else
- if(s->m_szDescription.contains("random",false) ||
- (s->m_szDescription.contains("round",false) && s->m_szDescription.contains("robin",false)))
+ if(s->m_szDescription.tqcontains("random",false) ||
+ (s->m_szDescription.tqcontains("round",false) && s->m_szDescription.tqcontains("robin",false)))
#endif
{
r->setCurrentServer(s);
@@ -199,17 +199,17 @@ bool KviIrcServerDataBase::makeCurrentBestServerInNetwork(const QString &szNetNa
// no explicit round robin... try some common names
- QString tryAlso1,tryAlso2,tryAlso3;
+ TQString tryAlso1,tryAlso2,tryAlso3;
- KviQString::sprintf(tryAlso1,"irc.%Q.org",&szNetName);
- KviQString::sprintf(tryAlso2,"irc.%Q.net",&szNetName);
- KviQString::sprintf(tryAlso3,"irc.%Q.com",&szNetName);
+ KviTQString::sprintf(tryAlso1,"irc.%Q.org",&szNetName);
+ KviTQString::sprintf(tryAlso2,"irc.%Q.net",&szNetName);
+ KviTQString::sprintf(tryAlso3,"irc.%Q.com",&szNetName);
for(KviIrcServer * ss = r->m_pServerList->first();ss;ss = r->m_pServerList->next())
{
- if(KviQString::equalCI(ss->m_szHostname,tryAlso1) ||
- KviQString::equalCI(ss->m_szHostname,tryAlso2) ||
- KviQString::equalCI(ss->m_szHostname,tryAlso3))
+ if(KviTQString::equalCI(ss->m_szHostname,tryAlso1) ||
+ KviTQString::equalCI(ss->m_szHostname,tryAlso2) ||
+ KviTQString::equalCI(ss->m_szHostname,tryAlso3))
{
r->setCurrentServer(ss);
return true;
@@ -221,36 +221,36 @@ bool KviIrcServerDataBase::makeCurrentBestServerInNetwork(const QString &szNetNa
}
-bool KviIrcServerDataBase::makeCurrentServer(KviIrcServerDefinition * d,QString &szError)
+bool KviIrcServerDataBase::makeCurrentServer(KviIrcServerDefinition * d,TQString &szError)
{
KviIrcServer * pServer = 0;
- KviPointerHashTableIterator<QString,KviIrcServerDataBaseRecord> it(*m_pRecords);
+ KviPointerHashTableIterator<TQString,KviIrcServerDataBaseRecord> it(*m_pRecords);
KviIrcServerDataBaseRecord * r = 0;
KviIrcServer * srv;
- if(KviQString::equalCIN(d->szServer,"net:",4))
+ if(KviTQString::equalCIN(d->szServer,"net:",4))
{
// net:networkname form
- QString szNet = d->szServer;
+ TQString szNet = d->szServer;
szNet.remove(0,4);
- KviIrcServerDataBaseRecord * r = m_pRecords->find(szNet);
+ KviIrcServerDataBaseRecord * r = m_pRecords->tqfind(szNet);
if(r)return makeCurrentBestServerInNetwork(szNet,r,szError);
szError = __tr2qs("The server specification seems to be in the net:<string> but the network couln't be found in the database");
return false;
}
- if(KviQString::equalCIN(d->szServer,"id:",3))
+ if(KviTQString::equalCIN(d->szServer,"id:",3))
{
// id:serverid form
- QString szId = d->szServer;
+ TQString szId = d->szServer;
szId.remove(0,3);
while((r = it.current()))
{
for(srv = r->serverList()->first();srv && (!pServer);srv = r->serverList()->next())
{
- if(KviQString::equalCI(srv->id(),szId))
+ if(KviTQString::equalCI(srv->id(),szId))
{
pServer = srv;
goto search_finished;
@@ -268,7 +268,7 @@ bool KviIrcServerDataBase::makeCurrentServer(KviIrcServerDefinition * d,QString
{
for(srv = r->serverList()->first();srv && (!pServer);srv = r->serverList()->next())
{
- if(KviQString::equalCI(srv->hostName(),d->szServer))
+ if(KviTQString::equalCI(srv->hostName(),d->szServer))
{
if(d->bIpV6 == srv->isIpV6())
{
@@ -283,7 +283,7 @@ bool KviIrcServerDataBase::makeCurrentServer(KviIrcServerDefinition * d,QString
if(!d->szLinkFilter.isEmpty())
{
// must match the link filter
- if(KviQString::equalCI(d->szLinkFilter,srv->linkFilter()))
+ if(KviTQString::equalCI(d->szLinkFilter,srv->linkFilter()))
{
// link filter matches
pServer = srv;
@@ -300,7 +300,7 @@ bool KviIrcServerDataBase::makeCurrentServer(KviIrcServerDefinition * d,QString
if(!d->szLinkFilter.isEmpty())
{
// must match the link filter
- if(KviQString::equalCI(d->szLinkFilter,srv->linkFilter()))
+ if(KviTQString::equalCI(d->szLinkFilter,srv->linkFilter()))
{
// link filter matches
pServer = srv;
@@ -344,13 +344,13 @@ search_finished:
{
// is it a valid hostname ? (must contain at least one dot)
#ifdef COMPILE_USE_QT4
- if(!d->szServer.contains('.'))
+ if(!d->szServer.tqcontains('.'))
#else
- if(d->szServer.contains('.') < 1)
+ if(d->szServer.tqcontains('.') < 1)
#endif
{
// assume it is a network name!
- KviIrcServerDataBaseRecord * r = m_pRecords->find(d->szServer);
+ KviIrcServerDataBaseRecord * r = m_pRecords->tqfind(d->szServer);
if(r)return makeCurrentBestServerInNetwork(d->szServer,r,szError);
// else probably not a network name
}
@@ -358,11 +358,11 @@ search_finished:
// a valid hostname or ip address , not found in list : add it and make it current
- r = m_pRecords->find(__tr2qs("Standalone Servers"));
+ r = m_pRecords->tqfind(__tr2qs("Standalone Servers"));
if(!r)
{
r = new KviIrcServerDataBaseRecord(new KviIrcNetwork(__tr2qs("Standalone Servers")));
- m_pRecords->replace(r->network()->name(),r);
+ m_pRecords->tqreplace(r->network()->name(),r);
}
KviIrcServer * s = new KviIrcServer();
@@ -397,11 +397,11 @@ search_finished:
return true;
}
-void parseMircServerRecord(QString entry,QString& szNet,
- QString& szDescription,QString& szHost,QString& szPort,bool& bSsl,kvi_u32_t& uPort)
+void parseMircServerRecord(TQString entry,TQString& szNet,
+ TQString& szDescription,TQString& szHost,TQString& szPort,bool& bSsl,kvi_u32_t& uPort)
{
bSsl = false;
- int idx = KviQString::find(entry,"SERVER:");
+ int idx = KviTQString::tqfind(entry,"SERVER:");
if(idx != -1)
{
szDescription = entry.left(idx);
@@ -409,7 +409,7 @@ void parseMircServerRecord(QString entry,QString& szNet,
szDescription=szDescription.section(':',1,1);
entry.remove(0,idx + 7);
- idx = KviQString::find(entry,"GROUP:");
+ idx = KviTQString::tqfind(entry,"GROUP:");
if(idx != -1)
{
szHost = entry.left(idx);
@@ -431,35 +431,35 @@ void parseMircServerRecord(QString entry,QString& szNet,
}
}
-void KviIrcServerDataBase::loadFromMircIni(const QString & filename, const QString & szMircIni, QStringList& recentServers)
+void KviIrcServerDataBase::loadFromMircIni(const TQString & filename, const TQString & szMircIni, TQStringList& recentServers)
{
clear();
recentServers.clear();
- QString szDefaultServer;
+ TQString szDefaultServer;
KviConfig mircCfg(szMircIni,KviConfig::Read,true);
if(mircCfg.hasGroup("mirc"))
{
mircCfg.setGroup("mirc");
- szDefaultServer = mircCfg.readQStringEntry("host");
+ szDefaultServer = mircCfg.readTQStringEntry("host");
}
KviConfig cfg(filename,KviConfig::Read,true);
int i = 0;
- QString entry;
- QString key;
+ TQString entry;
+ TQString key;
if(cfg.hasGroup("recent"))
{
cfg.setGroup("recent");
do {
- KviQString::sprintf(key,"n%d",i);
+ KviTQString::sprintf(key,"n%d",i);
entry = cfg.readEntry(key);
if(!entry.isEmpty())
{
- QString szNet;
- QString szDescription;
- QString szHost;
- QString szPort;
+ TQString szNet;
+ TQString szDescription;
+ TQString szHost;
+ TQString szPort;
bool bSsl = false;
kvi_u32_t uPort = 0;
@@ -477,15 +477,15 @@ void KviIrcServerDataBase::loadFromMircIni(const QString & filename, const QStri
{
cfg.setGroup("servers");
do {
- KviQString::sprintf(key,"n%d",i);
+ KviTQString::sprintf(key,"n%d",i);
entry = cfg.readEntry(key);
if(!entry.isEmpty())
{
bool bDefault = false;
- QString szNet;
- QString szDescription;
- QString szHost;
- QString szPort;
+ TQString szNet;
+ TQString szDescription;
+ TQString szHost;
+ TQString szPort;
bool bSsl = false;
kvi_u32_t uPort = 0;
// <net>:<description>SERVER:<server:port>GROUP:<group???>
@@ -520,14 +520,14 @@ void KviIrcServerDataBase::loadFromMircIni(const QString & filename, const QStri
}
-void KviIrcServerDataBase::load(const QString & filename)
+void KviIrcServerDataBase::load(const TQString & filename)
{
clear();
KviConfig cfg(filename,KviConfig::Read);
KviConfigIterator it(*(cfg.dict()));
- QString tmp;
+ TQString tmp;
while(it.current())
{
@@ -536,16 +536,16 @@ void KviIrcServerDataBase::load(const QString & filename)
KviIrcNetwork * n = new KviIrcNetwork(it.currentKey());
KviIrcServerDataBaseRecord * r = insertNetwork(n);
cfg.setGroup(it.currentKey());
- n->m_szEncoding = cfg.readQStringEntry("Encoding");
- n->m_szDescription = cfg.readQStringEntry("Description");
- n->m_szNickName = cfg.readQStringEntry("NickName");
- n->m_szRealName = cfg.readQStringEntry("RealName");
- n->m_szUserName = cfg.readQStringEntry("UserName");
- n->m_szOnConnectCommand = cfg.readQStringEntry("OnConnectCommand");
- n->m_szOnLoginCommand = cfg.readQStringEntry("OnLoginCommand");
- n->m_pNickServRuleSet = KviNickServRuleSet::load(&cfg,QString::null);
+ n->m_szEncoding = cfg.readTQStringEntry("Encoding");
+ n->m_szDescription = cfg.readTQStringEntry("Description");
+ n->m_szNickName = cfg.readTQStringEntry("NickName");
+ n->m_szRealName = cfg.readTQStringEntry("RealName");
+ n->m_szUserName = cfg.readTQStringEntry("UserName");
+ n->m_szOnConnectCommand = cfg.readTQStringEntry("OnConnectCommand");
+ n->m_szOnLoginCommand = cfg.readTQStringEntry("OnLoginCommand");
+ n->m_pNickServRuleSet = KviNickServRuleSet::load(&cfg,TQString());
n->m_bAutoConnect = cfg.readBoolEntry("AutoConnect",false);
- n->m_szUserIdentityId = cfg.readQStringEntry("UserIdentityId");
+ n->m_szUserIdentityId = cfg.readTQStringEntry("UserIdentityId");
if(n->m_bAutoConnect)
{
if(!m_pAutoConnectOnStartupNetworks)
@@ -555,8 +555,8 @@ void KviIrcServerDataBase::load(const QString & filename)
}
m_pAutoConnectOnStartupNetworks->append(r);
}
- QStringList l = cfg.readStringListEntry("AutoJoinChannels",QStringList());
- if(l.count() > 0)n->setAutoJoinChannelList(new QStringList(l));
+ TQStringList l = cfg.readStringListEntry("AutoJoinChannels",TQStringList());
+ if(l.count() > 0)n->setAutoJoinChannelList(new TQStringList(l));
if(cfg.readBoolEntry("Current",false))m_szCurrentNetwork = it.currentKey();
@@ -564,11 +564,11 @@ void KviIrcServerDataBase::load(const QString & filename)
for(int i=0;i < nServers;i++)
{
KviIrcServer *s = new KviIrcServer();
- KviQString::sprintf(tmp,"%d_",i);
+ KviTQString::sprintf(tmp,"%d_",i);
if(s->load(&cfg,tmp))
{
r->m_pServerList->append(s);
- KviQString::sprintf(tmp,"%d_Current",i);
+ KviTQString::sprintf(tmp,"%d_Current",i);
if(cfg.readBoolEntry(tmp,false))r->m_pCurrentServer = s;
if(s->autoConnect())
{
@@ -587,15 +587,15 @@ void KviIrcServerDataBase::load(const QString & filename)
}
}
-void KviIrcServerDataBase::save(const QString &filename)
+void KviIrcServerDataBase::save(const TQString &filename)
{
KviConfig cfg(filename,KviConfig::Write);
cfg.clear(); // clear any old entry
- KviPointerHashTableIterator<QString,KviIrcServerDataBaseRecord> it(*m_pRecords);
+ KviPointerHashTableIterator<TQString,KviIrcServerDataBaseRecord> it(*m_pRecords);
- QString tmp;
+ TQString tmp;
while(KviIrcServerDataBaseRecord * r = it.current())
{
@@ -618,7 +618,7 @@ void KviIrcServerDataBase::save(const QString &filename)
cfg.writeEntry("OnConnectCommand",n->m_szOnConnectCommand);
if(!n->m_szOnLoginCommand.isEmpty())
cfg.writeEntry("OnLoginCommand",n->m_szOnLoginCommand);
- if(n->m_pNickServRuleSet)n->m_pNickServRuleSet->save(&cfg,QString::null);
+ if(n->m_pNickServRuleSet)n->m_pNickServRuleSet->save(&cfg,TQString());
if(n->autoJoinChannelList())
cfg.writeEntry("AutoJoinChannels",*(n->autoJoinChannelList()));
if(n->m_szName == m_szCurrentNetwork)cfg.writeEntry("Current",true);
@@ -627,12 +627,12 @@ void KviIrcServerDataBase::save(const QString &filename)
int i=0;
for(KviIrcServer *s = r->m_pServerList->first();s;s = r->m_pServerList->next())
{
- KviQString::sprintf(tmp,"%d_",i);
+ KviTQString::sprintf(tmp,"%d_",i);
s->save(&cfg,tmp);
if(s == r->m_pCurrentServer)
{
- KviQString::sprintf(tmp,"%d_Current",i);
+ KviTQString::sprintf(tmp,"%d_Current",i);
cfg.writeEntry(tmp,true);
}