diff options
Diffstat (limited to 'src/modules/dcc/broker.cpp')
-rw-r--r-- | src/modules/dcc/broker.cpp | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/src/modules/dcc/broker.cpp b/src/modules/dcc/broker.cpp index b6548e0c..d183ebbf 100644 --- a/src/modules/dcc/broker.cpp +++ b/src/modules/dcc/broker.cpp @@ -44,13 +44,13 @@ extern KVIRC_API KviMediaManager * g_pMediaManager; extern KVIRC_API KviSharedFilesManager * g_pSharedFilesManager; -#include <qfileinfo.h> -#include <qstring.h> +#include <tqfileinfo.h> +#include <tqstring.h> //#warning "The broker might lookup the remote host name" KviDccBroker::KviDccBroker() -: QObject(0,"dcc_broker") +: TQObject(0,"dcc_broker") { KviDccFileTransfer::init(); @@ -60,7 +60,7 @@ KviDccBroker::KviDccBroker() m_pDccWindowList = new KviPointerList<KviWindow>; m_pDccWindowList->setAutoDelete(false); - m_pZeroPortTags = new KviPointerHashTable<QString,KviDccZeroPortTag>(17); + m_pZeroPortTags = new KviPointerHashTable<TQString,KviDccZeroPortTag>(17); m_pZeroPortTags->setAutoDelete(true); } @@ -81,7 +81,7 @@ KviDccZeroPortTag * KviDccBroker::addZeroPortTag() static unsigned int g_uNextZeroPortTag = 0; g_uNextZeroPortTag++; KviDccZeroPortTag * t = new KviDccZeroPortTag; - t->m_tTimestamp = QDateTime::currentDateTime(); + t->m_tTimestamp = TQDateTime::tqcurrentDateTime(); t->m_szTag.setNum(g_uNextZeroPortTag); //t->m_szTag.prepend("mIrc-zero-port-"); t->m_uResumePosition = 0; @@ -90,11 +90,11 @@ KviDccZeroPortTag * KviDccBroker::addZeroPortTag() return t; } -KviDccZeroPortTag * KviDccBroker::findZeroPortTag(const QString &szTag) +KviDccZeroPortTag * KviDccBroker::findZeroPortTag(const TQString &szTag) { - KviDccZeroPortTag * t = m_pZeroPortTags->find(szTag); + KviDccZeroPortTag * t = m_pZeroPortTags->tqfind(szTag); if(!t)return 0; - if(t->m_tTimestamp.secsTo(QDateTime::currentDateTime()) > 180) + if(t->m_tTimestamp.secsTo(TQDateTime::tqcurrentDateTime()) > 180) { // too late man... m_pZeroPortTags->remove(szTag); @@ -103,7 +103,7 @@ KviDccZeroPortTag * KviDccBroker::findZeroPortTag(const QString &szTag) return t; } -void KviDccBroker::removeZeroPortTag(const QString &szTag) +void KviDccBroker::removeZeroPortTag(const TQString &szTag) { m_pZeroPortTags->remove(szTag); } @@ -145,14 +145,14 @@ void KviDccBroker::cancelDcc(KviDccBox *box,KviDccDescriptor * dcc) void KviDccBroker::rsendManage(KviDccDescriptor * dcc) { // We need the filename... - QFileInfo fi(dcc->szLocalFileName); + TQFileInfo fi(dcc->szLocalFileName); if(fi.exists())rsendExecute(0,dcc); else rsendAskForFileName(dcc); } void KviDccBroker::rsendAskForFileName(KviDccDescriptor * dcc) { - QStringList filenames; + TQStringList filenames; if( KviFileDialog::askForOpenFileNames(filenames, __tr2qs_ctx("Choose Files to Send - KVIrc","dcc"),"") @@ -161,7 +161,7 @@ void KviDccBroker::rsendAskForFileName(KviDccDescriptor * dcc) { KviDccDescriptor * d; KviDccDescriptor * templ = dcc; - QStringList::Iterator it=filenames.begin(); + TQStringList::Iterator it=filenames.begin(); while(it != filenames.end()) { d = new KviDccDescriptor(*dcc); @@ -193,7 +193,7 @@ void KviDccBroker::rsendExecute(KviDccDescriptor * dcc) } // Ok...we need the file to exist - QFileInfo fi(dcc->szLocalFileName); + TQFileInfo fi(dcc->szLocalFileName); if(!(fi.exists() && fi.isReadable() && (fi.isFile()) && (fi.size() > 0))) { dcc->console()->output(KVI_OUT_DCCERROR,__tr2qs_ctx("Can't open file %Q for reading","dcc"), @@ -203,12 +203,12 @@ void KviDccBroker::rsendExecute(KviDccDescriptor * dcc) } dcc->szFileName = dcc->szLocalFileName; - dcc->szFileName = QFileInfo(dcc->szFileName).fileName(); + dcc->szFileName = TQFileInfo(dcc->szFileName).fileName(); - QString fName = dcc->szFileName; - fName.replace(' ',"\\040"); // be cool :) + TQString fName = dcc->szFileName; + fName.tqreplace(' ',"\\040"); // be cool :) - QString szTag; + TQString szTag; if(dcc->isZeroPortRequest()) { // actually we tagged it as "nonempty" in /dcc.rsend --zero-port @@ -239,7 +239,7 @@ void KviDccBroker::rsendExecute(KviDccDescriptor * dcc) // now add a file offer , so he we will accept it automatically // 120 secs is a reasonable timeout - QString szMask = dcc->szNick; + TQString szMask = dcc->szNick; szMask += "!*@*"; g_pSharedFilesManager->addSharedFile(szTag,dcc->szLocalFileName,szMask,120); @@ -265,10 +265,10 @@ void KviDccBroker::handleChatRequest(KviDccDescriptor * dcc) { // FIXME: better message ? Secure Direct Client Connection...eventually // need confirmation - QString tmp = __tr2qs_ctx( \ + TQString tmp = __tr2qs_ctx( \ "<b>%1 [%2@%3]</b> requests a " \ "<b>Direct Client Connection</b> in <b>%4</b> mode.<br>", \ - "dcc").arg(dcc->szNick).arg(dcc->szUser).arg(dcc->szHost).arg(dcc->szType); + "dcc").tqarg(dcc->szNick).tqarg(dcc->szUser).tqarg(dcc->szHost).tqarg(dcc->szType); #ifdef COMPILE_SSL_SUPPORT if(dcc->bIsSSL)tmp += __tr2qs_ctx("The connection will be secured using SSL.<br>","dcc"); @@ -282,19 +282,19 @@ void KviDccBroker::handleChatRequest(KviDccDescriptor * dcc) } else { tmp += __tr2qs_ctx( \ "The connection target will be host <b>%1</b> on port <b>%2</b><br>" \ - ,"dcc").arg(dcc->szIp).arg(dcc->szPort); + ,"dcc").tqarg(dcc->szIp).tqarg(dcc->szPort); } - QString caption = __tr2qs_ctx("DCC %1 Request - KVIrc","dcc").arg(dcc->szType); + TQString caption = __tr2qs_ctx("DCC %1 Request - KVIrc","dcc").tqarg(dcc->szType); KviDccAcceptBox * box = new KviDccAcceptBox(this,dcc,tmp,caption); m_pBoxList->append(box); - connect(box,SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), - this,SLOT(executeChat(KviDccBox *,KviDccDescriptor *))); - connect(box,SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), - this,SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(executeChat(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); box->show(); } else { // auto accept @@ -315,7 +315,7 @@ void KviDccBroker::executeChat(KviDccBox *box,KviDccDescriptor * dcc) KviStr szSubProto = dcc->szType; szSubProto.toLower(); - QString tmp = QString("dcc: %1 %2@%3:%4").arg(szSubProto.ptr()).arg(dcc->szNick).arg(dcc->szIp).arg(dcc->szPort); + TQString tmp = TQString("dcc: %1 %2@%3:%4").tqarg(szSubProto.ptr()).tqarg(dcc->szNick).tqarg(dcc->szIp).tqarg(dcc->szPort); KviDccChat * chat = new KviDccChat(dcc->console()->frame(),dcc,tmp.utf8().data()); bool bMinimized = dcc->bOverrideMinimize ? dcc->bShowMinimized : \ @@ -336,19 +336,19 @@ void KviDccBroker::activeVoiceManage(KviDccDescriptor * dcc) if(!dcc->bAutoAccept) { // need confirmation - QString tmp = __tr2qs_ctx( + TQString tmp = __tr2qs_ctx( "<b>%1 [%2@%3]</b> requests a<br>" \ "<b>Direct Client Connection</b> in <b>VOICE</b> mode.<br>" \ "The connection target will be host <b>%4</b> on port <b>%5</b><br>" \ ,"dcc" \ - ).arg(dcc->szNick).arg(dcc->szUser).arg(dcc->szHost).arg(dcc->szIp).arg(dcc->szPort); + ).tqarg(dcc->szNick).tqarg(dcc->szUser).tqarg(dcc->szHost).tqarg(dcc->szIp).tqarg(dcc->szPort); KviDccAcceptBox * box = new KviDccAcceptBox(this,dcc,tmp,__tr2qs_ctx("DCC VOICE request","dcc")); m_pBoxList->append(box); - connect(box,SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), - this,SLOT(activeVoiceExecute(KviDccBox *,KviDccDescriptor *))); - connect(box,SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), - this,SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(activeVoiceExecute(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); box->show(); } else { // auto accept @@ -407,19 +407,19 @@ void KviDccBroker::activeCanvasManage(KviDccDescriptor * dcc) if(!dcc->bAutoAccept) { // need confirmation - QString tmp = __tr2qs_ctx( \ + TQString tmp = __tr2qs_ctx( \ "<b>%1 [%2@%3]</b> requests a<br>" \ "<b>Direct Client Connection</b> in <b>CANVAS</b> mode.<br>" \ "The connection target will be host <b>%4</b> on port <b>%5</b><br>" \ ,"dcc" \ - ).arg(dcc->szNick).arg(dcc->szUser).arg(dcc->szHost).arg(dcc->szIp).arg(dcc->szPort); + ).tqarg(dcc->szNick).tqarg(dcc->szUser).tqarg(dcc->szHost).tqarg(dcc->szIp).tqarg(dcc->szPort); KviDccAcceptBox * box = new KviDccAcceptBox(this,dcc,tmp,__tr2qs_ctx("DCC CANVAS request","dcc")); m_pBoxList->append(box); - connect(box,SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), - this,SLOT(activeCanvasExecute(KviDccBox *,KviDccDescriptor *))); - connect(box,SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), - this,SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(activeCanvasExecute(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); box->show(); } else { // auto accept @@ -493,7 +493,7 @@ void KviDccBroker::recvFileManage(KviDccDescriptor * dcc) if(!dcc->bAutoAccept) { // need confirmation - QString tmp; + TQString tmp; if(dcc->bActive) { @@ -505,9 +505,9 @@ void KviDccBroker::recvFileManage(KviDccDescriptor * dcc) "<b>%5</b> large.<br>" \ "The connection target will be host <b>%6</b> on port <b>%7</b><br>" \ ,"dcc" \ - ).arg(dcc->szNick).arg(dcc->szUser).arg(dcc->szHost).arg( - dcc->szFileName).arg(KviQString::makeSizeReadable(dcc->szFileSize.toInt())).arg( - dcc->szIp).arg(dcc->szPort); + ).tqarg(dcc->szNick).tqarg(dcc->szUser).tqarg(dcc->szHost).tqarg( + dcc->szFileName).tqarg(KviTQString::makeSizeReadable(dcc->szFileSize.toInt())).tqarg( + dcc->szIp).tqarg(dcc->szPort); } else { // passive: we will be listening! @@ -518,8 +518,8 @@ void KviDccBroker::recvFileManage(KviDccDescriptor * dcc) "<b>%5</b> large.<br>" \ "You will be the passive side of the connection.<br>" \ ,"dcc" \ - ).arg(dcc->szNick).arg(dcc->szUser).arg(dcc->szHost).arg( - dcc->szFileName).arg(KviQString::makeSizeReadable(dcc->szFileSize.toInt())); + ).tqarg(dcc->szNick).tqarg(dcc->szUser).tqarg(dcc->szHost).tqarg( + dcc->szFileName).tqarg(KviTQString::makeSizeReadable(dcc->szFileSize.toInt())); } if(dcc->bIsIncomingAvatar) @@ -540,14 +540,14 @@ void KviDccBroker::recvFileManage(KviDccDescriptor * dcc) //#warning "Maybe remove the pending avatar if rejected ?" - QString title = __tr2qs_ctx("DCC %1 Request - KVIrc","dcc").arg(dcc->szType); + TQString title = __tr2qs_ctx("DCC %1 Request - KVIrc","dcc").tqarg(dcc->szType); KviDccAcceptBox * box = new KviDccAcceptBox(this,dcc,tmp,title); m_pBoxList->append(box); - connect(box,SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), - this,SLOT(chooseSaveFileName(KviDccBox *,KviDccDescriptor *))); - connect(box,SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), - this,SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(accepted(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(chooseSaveFileName(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(rejected(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); box->show(); } else { // auto accept @@ -586,7 +586,7 @@ void KviDccBroker::chooseSaveFileName(KviDccBox *box,KviDccDescriptor *dcc) } if(KVI_OPTION_BOOL(KviOption_boolSortReceivedByDccFilesByNicks)) { - KviQString::ensureLastCharIs(dcc->szLocalFileName,KVI_PATH_SEPARATOR_CHAR); + KviTQString::ensureLastCharIs(dcc->szLocalFileName,KVI_PATH_SEPARATOR_CHAR); dcc->szLocalFileName.append(dcc->szNick); KviFileUtils::adjustFilePath(dcc->szLocalFileName); } @@ -601,7 +601,7 @@ void KviDccBroker::chooseSaveFileName(KviDccBox *box,KviDccDescriptor *dcc) g_pApp->getLocalKvircDirectory(dcc->szLocalFileName,KviApp::Incoming); if(KVI_OPTION_BOOL(KviOption_boolSortReceivedByDccFilesByNicks)) { - KviQString::ensureLastCharIs(dcc->szLocalFileName,KVI_PATH_SEPARATOR_CHAR); + KviTQString::ensureLastCharIs(dcc->szLocalFileName,KVI_PATH_SEPARATOR_CHAR); dcc->szLocalFileName.append(dcc->szNick); KviFileUtils::adjustFilePath(dcc->szLocalFileName); KviFileUtils::makeDir(dcc->szLocalFileName); @@ -609,7 +609,7 @@ void KviDccBroker::chooseSaveFileName(KviDccBox *box,KviDccDescriptor *dcc) } } KviFileUtils::adjustFilePath(dcc->szLocalFileName); - KviQString::ensureLastCharIs(dcc->szLocalFileName,KVI_PATH_SEPARATOR_CHAR); + KviTQString::ensureLastCharIs(dcc->szLocalFileName,KVI_PATH_SEPARATOR_CHAR); if(!(dcc->bAutoAccept)) { @@ -641,7 +641,7 @@ void KviDccBroker::renameOverwriteResume(KviDccBox *box,KviDccDescriptor * dcc) if(box)box->forgetDescriptor(); // Check if file exists - QFileInfo fi(dcc->szLocalFileName); + TQFileInfo fi(dcc->szLocalFileName); if(fi.exists() && (fi.size() > 0)) // 0 byte files are senseless for us { dcc->szLocalFileSize.setNum(fi.size()); @@ -655,7 +655,7 @@ void KviDccBroker::renameOverwriteResume(KviDccBox *box,KviDccDescriptor * dcc) if(!dcc->bAutoAccept) { - QString tmp; + TQString tmp; bool bDisableResume = false; if((iRemoteSize > -1) || // remote size is unknown @@ -669,7 +669,7 @@ void KviDccBroker::renameOverwriteResume(KviDccBox *box,KviDccDescriptor * dcc) "<b>auto-rename</b> the new file, or<br>" \ "<b>resume</b> an incomplete download?" \ ,"dcc" \ - ).arg(dcc->szLocalFileName).arg(KviQString::makeSizeReadable(fi.size())); + ).tqarg(dcc->szLocalFileName).tqarg(KviTQString::makeSizeReadable(fi.size())); } else { bDisableResume = true; // the file on disk is larger or equal to the remote one @@ -680,17 +680,17 @@ void KviDccBroker::renameOverwriteResume(KviDccBox *box,KviDccDescriptor * dcc) "<b>overwrite</b> the existing file, or<br> " \ "<b>auto-rename</b> the new file ?" \ ,"dcc" \ - ).arg(dcc->szLocalFileName); + ).tqarg(dcc->szLocalFileName); } KviDccRenameBox * box = new KviDccRenameBox(this,dcc,tmp,bDisableResume); m_pBoxList->append(box); - connect(box,SIGNAL(renameSelected(KviDccBox *,KviDccDescriptor *)), - this,SLOT(renameDccSendFile(KviDccBox *,KviDccDescriptor *))); - connect(box,SIGNAL(overwriteSelected(KviDccBox *,KviDccDescriptor *)), - this,SLOT(recvFileExecute(KviDccBox *,KviDccDescriptor *))); - connect(box,SIGNAL(cancelSelected(KviDccBox *,KviDccDescriptor *)), - this,SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(renameSelected(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(renameDccSendFile(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(overwriteSelected(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(recvFileExecute(KviDccBox *,KviDccDescriptor *))); + connect(box,TQT_SIGNAL(cancelSelected(KviDccBox *,KviDccDescriptor *)), + this,TQT_SLOT(cancelDcc(KviDccBox *,KviDccDescriptor *))); box->show(); return; } else { @@ -720,7 +720,7 @@ void KviDccBroker::renameDccSendFile(KviDccBox *box,KviDccDescriptor * dcc) if(box)box->forgetDescriptor(); - if(QFileInfo(dcc->szLocalFileName).exists()) + if(TQFileInfo(dcc->szLocalFileName).exists()) { KviStr szOrig = dcc->szLocalFileName; int i = 1; @@ -740,7 +740,7 @@ void KviDccBroker::renameDccSendFile(KviDccBox *box,KviDccDescriptor * dcc) dcc->szLocalFileName += szNum; } i++; - } while(QFileInfo(dcc->szLocalFileName).exists()); + } while(TQFileInfo(dcc->szLocalFileName).exists()); if(_OUTPUT_VERBOSE) { @@ -777,7 +777,7 @@ void KviDccBroker::recvFileExecute(KviDccBox *box,KviDccDescriptor * dcc) void KviDccBroker::sendFileManage(KviDccDescriptor * dcc) { - QStringList filenames; + TQStringList filenames; if( KviFileDialog::askForOpenFileNames(filenames, __tr2qs_ctx("Choose Files to Send - KVIrc","dcc"),"") @@ -786,7 +786,7 @@ void KviDccBroker::sendFileManage(KviDccDescriptor * dcc) { KviDccDescriptor * d; KviDccDescriptor * templ = dcc; - QStringList::Iterator it=filenames.begin(); + TQStringList::Iterator it=filenames.begin(); while(it != filenames.end()) { d = new KviDccDescriptor(*dcc); @@ -815,7 +815,7 @@ void KviDccBroker::sendFileExecute(KviDccBox * box,KviDccDescriptor *dcc) dcc->setConsole(g_pApp->activeConsole()); } - QFileInfo fi(dcc->szLocalFileName); + TQFileInfo fi(dcc->szLocalFileName); if(!(fi.exists() && fi.isReadable() && (fi.isFile()) && (fi.size() > 0))) { dcc->console()->output(KVI_OUT_DCCERROR,__tr2qs_ctx("Can't open file %Q for reading","dcc"), @@ -825,7 +825,7 @@ void KviDccBroker::sendFileExecute(KviDccBox * box,KviDccDescriptor *dcc) } dcc->szFileName = dcc->szLocalFileName; - dcc->szFileName = QFileInfo(dcc->szFileName).fileName(); + dcc->szFileName = TQFileInfo(dcc->szFileName).fileName(); dcc->szLocalFileSize.setNum(fi.size()); @@ -859,7 +859,7 @@ bool KviDccBroker::handleResumeRequest(KviDccRequest * dcc,const char * filename if(kvi_strEqualCI("0",port) && szZeroPortTag) { // zero port resume request (we have sent out a DCC SEND <filename> <fakeip> 0 <tag> - KviDccZeroPortTag * t = findZeroPortTag(QString(szZeroPortTag)); + KviDccZeroPortTag * t = findZeroPortTag(TQString(szZeroPortTag)); if(t) { //debug("FOUND"); |