summaryrefslogtreecommitdiffstats
path: root/kioslaves/sieve/sieve.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kioslaves/sieve/sieve.cpp')
-rw-r--r--kioslaves/sieve/sieve.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/kioslaves/sieve/sieve.cpp b/kioslaves/sieve/sieve.cpp
index 012d77d15..9f3b547a2 100644
--- a/kioslaves/sieve/sieve.cpp
+++ b/kioslaves/sieve/sieve.cpp
@@ -40,8 +40,8 @@ extern "C" {
#include <kmdcodec.h>
#include <kglobal.h>
-#include <qcstring.h>
-#include <qregexp.h>
+#include <tqcstring.h>
+#include <tqregexp.h>
#include <cstdlib>
using std::exit;
@@ -123,25 +123,25 @@ const uint kio_sieveResponse::getQuantity() const
}
/* ---------------------------------------------------------------------------------- */
-const QCString& kio_sieveResponse::getAction() const
+const TQCString& kio_sieveResponse::getAction() const
{
return key;
}
/* ---------------------------------------------------------------------------------- */
-const QCString& kio_sieveResponse::getKey() const
+const TQCString& kio_sieveResponse::getKey() const
{
return key;
}
/* ---------------------------------------------------------------------------------- */
-const QCString& kio_sieveResponse::getVal() const
+const TQCString& kio_sieveResponse::getVal() const
{
return val;
}
/* ---------------------------------------------------------------------------------- */
-const QCString& kio_sieveResponse::getExtra() const
+const TQCString& kio_sieveResponse::getExtra() const
{
return extra;
}
@@ -154,27 +154,27 @@ void kio_sieveResponse::setQuantity(const uint& newQty)
}
/* ---------------------------------------------------------------------------------- */
-void kio_sieveResponse::setAction(const QCString& newAction)
+void kio_sieveResponse::setAction(const TQCString& newAction)
{
rType = ACTION;
key = newAction.copy();
}
/* ---------------------------------------------------------------------------------- */
-void kio_sieveResponse::setKey(const QCString& newKey)
+void kio_sieveResponse::setKey(const TQCString& newKey)
{
rType = KEY_VAL_PAIR;
key = newKey.copy();
}
/* ---------------------------------------------------------------------------------- */
-void kio_sieveResponse::setVal(const QCString& newVal)
+void kio_sieveResponse::setVal(const TQCString& newVal)
{
val = newVal.copy();
}
/* ---------------------------------------------------------------------------------- */
-void kio_sieveResponse::setExtra(const QCString& newExtra)
+void kio_sieveResponse::setExtra(const TQCString& newExtra)
{
extra = newExtra.copy();
}
@@ -183,12 +183,12 @@ void kio_sieveResponse::setExtra(const QCString& newExtra)
void kio_sieveResponse::clear()
{
rType = NONE;
- extra = key = val = QCString("");
+ extra = key = val = TQCString("");
quantity = 0;
}
/* ---------------------------------------------------------------------------------- */
-kio_sieveProtocol::kio_sieveProtocol(const QCString &pool_socket, const QCString &app_socket)
+kio_sieveProtocol::kio_sieveProtocol(const TQCString &pool_socket, const TQCString &app_socket)
: TCPSlaveBase( SIEVE_DEFAULT_PORT, "sieve", pool_socket, app_socket, false)
, m_connMode(NORMAL)
, m_supportsTLS(false)
@@ -204,7 +204,7 @@ kio_sieveProtocol::~kio_sieveProtocol()
}
/* ---------------------------------------------------------------------------------- */
-void kio_sieveProtocol::setHost (const QString &host, int port, const QString &user, const QString &pass)
+void kio_sieveProtocol::setHost (const TQString &host, int port, const TQString &user, const TQString &pass)
{
if ( isConnectionValid() &&
( m_sServer != host ||
@@ -258,13 +258,13 @@ bool kio_sieveProtocol::parseCapabilities(bool requestCapabilities/* = false*/)
} else if (r.getKey() == "SASL") {
// Save list of available SASL methods
- m_sasl_caps = QStringList::split(' ', r.getVal());
+ m_sasl_caps = TQStringList::split(' ', r.getVal());
ksDebug() << "Server SASL authentication methods: " << m_sasl_caps.join(", ") << endl;
setMetaData("saslMethods", r.getVal());
} else if (r.getKey() == "SIEVE") {
// Save script capabilities; report back as meta data:
- ksDebug() << "Server script capabilities: " << QStringList::split(' ', r.getVal()).join(", ") << endl;
+ ksDebug() << "Server script capabilities: " << TQStringList::split(' ', r.getVal()).join(", ") << endl;
setMetaData("sieveExtensions", r.getVal());
} else if (r.getKey() == "STARTTLS") {
@@ -293,15 +293,15 @@ bool kio_sieveProtocol::parseCapabilities(bool requestCapabilities/* = false*/)
*/
void kio_sieveProtocol::changeCheck( const KURL &url )
{
- QString auth;
+ TQString auth;
if (!metaData("sasl").isEmpty())
auth = metaData("sasl").upper();
else {
- QString query = url.query();
+ TQString query = url.query();
if ( query.startsWith("?") ) query.remove( 0, 1 );
- QStringList q = QStringList::split( ",", query );
- QStringList::iterator it;
+ TQStringList q = TQStringList::split( ",", query );
+ TQStringList::iterator it;
for ( it = q.begin(); it != q.end(); ++it ) {
if ( ( (*it).section('=',0,0) ).lower() == "x-mech" ) {
@@ -415,10 +415,10 @@ void kio_sieveProtocol::disconnect(bool forcibly)
}*/
/* ---------------------------------------------------------------------------------- */
-void kio_sieveProtocol::special(const QByteArray &data)
+void kio_sieveProtocol::special(const TQByteArray &data)
{
int tmp;
- QDataStream stream(data, IO_ReadOnly);
+ TQDataStream stream(data, IO_ReadOnly);
KURL url;
stream >> tmp;
@@ -452,7 +452,7 @@ bool kio_sieveProtocol::activate(const KURL& url)
infoMessage(i18n("Activating script..."));
- QString filename = url.fileName(false);
+ TQString filename = url.fileName(false);
if (filename.isEmpty()) {
error(ERR_DOES_NOT_EXIST, url.prettyURL());
@@ -489,7 +489,7 @@ bool kio_sieveProtocol::deactivate()
}
}
-static void append_lf2crlf( QByteArray & out, const QByteArray & in ) {
+static void append_lf2crlf( TQByteArray & out, const TQByteArray & in ) {
if ( in.isEmpty() )
return;
const unsigned int oldOutSize = out.size();
@@ -514,17 +514,17 @@ void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwri
infoMessage(i18n("Sending data..."));
- QString filename = url.fileName(false);
+ TQString filename = url.fileName(false);
if (filename.isEmpty()) {
error(ERR_MALFORMED_URL, url.prettyURL());
return;
}
- QByteArray data;
+ TQByteArray data;
for (;;) {
dataReq();
- QByteArray buffer;
+ TQByteArray buffer;
const int newSize = readData(buffer);
append_lf2crlf( data, buffer );
if ( newSize < 0 ) {
@@ -552,7 +552,7 @@ void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwri
#ifndef HAVE_BROKEN_TIMSIEVED
// first, check quota (it's a SHOULD in draft std)
if (!sendData("HAVESPACE \"" + filename.utf8() + "\" "
- + QCString().setNum( bufLen )))
+ + TQCString().setNum( bufLen )))
return;
if (!operationSuccessful()) {
@@ -562,7 +562,7 @@ void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwri
#endif
if (!sendData("PUTSCRIPT \"" + filename.utf8() + "\" {"
- + QCString().setNum( bufLen ) + "+}"))
+ + TQCString().setNum( bufLen ) + "+}"))
return;
// atEnd() lies so the code below doesn't work.
@@ -612,7 +612,7 @@ void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwri
* error is reported. */
if (r.getAction().length() > 3) {
// make a copy of the extra info
- QCString extra = r.getAction().right(r.getAction().length() - 3);
+ TQCString extra = r.getAction().right(r.getAction().length() - 3);
// send the extra message off for re-processing
receiveData(false, &extra);
@@ -621,7 +621,7 @@ void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwri
// length of the error message
uint len = r.getQuantity();
- QCString errmsg(len + 1);
+ TQCString errmsg(len + 1);
read(errmsg.data(), len);
@@ -655,10 +655,10 @@ void kio_sieveProtocol::put(const KURL& url, int /*permissions*/, bool /*overwri
finished();
}
-static void inplace_crlf2lf( QByteArray & in ) {
+static void inplace_crlf2lf( TQByteArray & in ) {
if ( in.isEmpty() )
return;
- QByteArray & out = in; // inplace
+ TQByteArray & out = in; // inplace
const char * s = in.begin();
const char * const end = in.end();
char * d = out.begin();
@@ -680,14 +680,14 @@ void kio_sieveProtocol::get(const KURL& url)
infoMessage(i18n("Retrieving data..."));
- QString filename = url.fileName(false);
+ TQString filename = url.fileName(false);
if (filename.isEmpty()) {
error(ERR_MALFORMED_URL, url.prettyURL());
return;
}
- //SlaveBase::mimetype( QString("text/plain") ); // "application/sieve");
+ //SlaveBase::mimetype( TQString("text/plain") ); // "application/sieve");
if (!sendData("GETSCRIPT \"" + filename.utf8() + "\""))
return;
@@ -709,7 +709,7 @@ void kio_sieveProtocol::get(const KURL& url)
// ...read data...
// Only read as much as we need, otherwise we slurp in the OK that
// operationSuccessful() is expecting below.
- QByteArray dat( kMin( total_len - recv_len, ssize_t(64 * 1024 )) );
+ TQByteArray dat( kMin( total_len - recv_len, ssize_t(64 * 1024 )) );
ssize_t this_recv_len = read( dat.data(), dat.size() );
if ( this_recv_len < 1 && !isConnectionValid() ) {
@@ -728,7 +728,7 @@ void kio_sieveProtocol::get(const KURL& url)
} while ( recv_len < total_len );
infoMessage(i18n("Finishing up...") );
- data(QByteArray());
+ data(TQByteArray());
if (operationSuccessful())
ksDebug() << "Script retrieval complete." << endl;
@@ -757,7 +757,7 @@ void kio_sieveProtocol::del(const KURL &url, bool isfile)
infoMessage(i18n("Deleting file..."));
- QString filename = url.fileName(false);
+ TQString filename = url.fileName(false);
if (filename.isEmpty()) {
error(ERR_MALFORMED_URL, url.prettyURL());
@@ -808,7 +808,7 @@ void kio_sieveProtocol::stat(const KURL& url)
UDSEntry entry;
- QString filename = url.fileName(false);
+ TQString filename = url.fileName(false);
if (filename.isEmpty()) {
UDSAtom atom;
@@ -837,12 +837,12 @@ void kio_sieveProtocol::stat(const KURL& url)
break;
} else
- if (filename == QString::fromUtf8(r.getKey())) {
+ if (filename == TQString::fromUtf8(r.getKey())) {
entry.clear();
UDSAtom atom;
atom.m_uds = KIO::UDS_NAME;
- atom.m_str = QString::fromUtf8(r.getKey());
+ atom.m_str = TQString::fromUtf8(r.getKey());
entry.append(atom);
atom.m_uds = KIO::UDS_FILE_TYPE;
@@ -894,7 +894,7 @@ void kio_sieveProtocol::listDir(const KURL& url)
UDSAtom atom;
atom.m_uds = KIO::UDS_NAME;
- atom.m_str = QString::fromUtf8(r.getKey());
+ atom.m_str = TQString::fromUtf8(r.getKey());
entry.append(atom);
atom.m_uds = KIO::UDS_FILE_TYPE;
@@ -973,7 +973,7 @@ bool kio_sieveProtocol::saslInteract( void *in, AuthInfo &ai )
}
#define SASLERROR error(ERR_COULD_NOT_AUTHENTICATE, i18n("An error occurred during authentication: %1").arg( \
- QString::fromUtf8( sasl_errdetail( conn ) )));
+ TQString::fromUtf8( sasl_errdetail( conn ) )));
bool kio_sieveProtocol::authenticate()
{
@@ -983,7 +983,7 @@ bool kio_sieveProtocol::authenticate()
const char *out = NULL;
uint outlen;
const char *mechusing = NULL;
- QByteArray challenge, tmp;
+ TQByteArray challenge, tmp;
/* Retrieve authentication details from user.
* Note: should this require realm as well as user & pass details
@@ -1010,7 +1010,7 @@ bool kio_sieveProtocol::authenticate()
return false;
}
- QStringList strList;
+ TQStringList strList;
// strList.append("NTLM");
if ( !m_sAuth.isEmpty() )
@@ -1038,20 +1038,20 @@ bool kio_sieveProtocol::authenticate()
ksDebug() << "Preferred authentication method is " << mechusing << "." << endl;
- QString firstCommand = "AUTHENTICATE \"" + QString::fromLatin1( mechusing ) + "\"";
+ TQString firstCommand = "AUTHENTICATE \"" + TQString::fromLatin1( mechusing ) + "\"";
tmp.setRawData( out, outlen );
KCodecs::base64Encode( tmp, challenge );
tmp.resetRawData( out, outlen );
if ( !challenge.isEmpty() ) {
firstCommand += " \"";
- firstCommand += QString::fromLatin1( challenge.data(), challenge.size() );
+ firstCommand += TQString::fromLatin1( challenge.data(), challenge.size() );
firstCommand += "\"";
}
if (!sendData( firstCommand.latin1() ))
return false;
- QCString command;
+ TQCString command;
do {
receiveData();
@@ -1085,7 +1085,7 @@ bool kio_sieveProtocol::authenticate()
KCodecs::base64Decode( tmp, challenge );
tmp.resetRawData( r.getAction().data(), qty );
// ksDebug() << "S: [" << r.getAction() << "]." << endl;
-// ksDebug() << "S-1: [" << QCString(challenge.data(), challenge.size()+1) << "]." << endl;
+// ksDebug() << "S-1: [" << TQCString(challenge.data(), challenge.size()+1) << "]." << endl;
do {
result = sasl_client_step(conn, challenge.isEmpty() ? 0 : challenge.data(),
@@ -1111,8 +1111,8 @@ bool kio_sieveProtocol::authenticate()
tmp.setRawData( out, outlen );
KCodecs::base64Encode( tmp, challenge );
tmp.resetRawData( out, outlen );
- sendData("\"" + QCString( challenge.data(), challenge.size()+1 ) + "\"");
-// ksDebug() << "C: [" << QCString(challenge.data(), challenge.size()+1) << "]." << endl;
+ sendData("\"" + TQCString( challenge.data(), challenge.size()+1 ) + "\"");
+// ksDebug() << "C: [" << TQCString(challenge.data(), challenge.size()+1) << "]." << endl;
// ksDebug() << "C-1: [" << out << "]." << endl;
} while ( true );
@@ -1144,9 +1144,9 @@ void kio_sieveProtocol::mimetype(const KURL & url)
/* --------------------------------------------------------------------------- */
-bool kio_sieveProtocol::sendData(const QCString &data)
+bool kio_sieveProtocol::sendData(const TQCString &data)
{
- QCString write_buf = data + "\r\n";
+ TQCString write_buf = data + "\r\n";
//ksDebug() << "C: " << data << endl;
@@ -1162,9 +1162,9 @@ bool kio_sieveProtocol::sendData(const QCString &data)
}
/* --------------------------------------------------------------------------- */
-bool kio_sieveProtocol::receiveData(bool waitForData, QCString *reparse)
+bool kio_sieveProtocol::receiveData(bool waitForData, TQCString *reparse)
{
- QCString interpret;
+ TQCString interpret;
int start, end;
if (!reparse) {
@@ -1178,7 +1178,7 @@ bool kio_sieveProtocol::receiveData(bool waitForData, QCString *reparse)
buffer[SIEVE_DEFAULT_RECIEVE_BUFFER-1] = '\0';
// strip LF/CR
- interpret = QCString(buffer).left(qstrlen(buffer) - 2);
+ interpret = TQCString(buffer).left(qstrlen(buffer) - 2);
} else {
interpret = reparse->copy();
@@ -1252,7 +1252,7 @@ bool kio_sieveProtocol::operationSuccessful()
{
while (receiveData(false)) {
if (r.getType() == kio_sieveResponse::ACTION) {
- QCString response = r.getAction().left(2);
+ TQCString response = r.getAction().left(2);
if (response == "OK") {
return true;
} else if (response == "NO") {
@@ -1266,7 +1266,7 @@ bool kio_sieveProtocol::operationSuccessful()
int kio_sieveProtocol::operationResult()
{
if (r.getType() == kio_sieveResponse::ACTION) {
- QCString response = r.getAction().left(2);
+ TQCString response = r.getAction().left(2);
if (response == "OK") {
return OK;
} else if (response == "NO") {
@@ -1284,12 +1284,12 @@ bool kio_sieveProtocol::requestCapabilitiesAfterStartTLS() const
// Cyrus didn't send CAPABILITIES after STARTTLS until 2.3.11, which is
// not standard conform, but we need to support that anyway.
// m_implementation looks like this 'Cyrus timsieved v2.2.12' for Cyrus btw.
- QRegExp regExp( "Cyrus\\stimsieved\\sv(\\d+)\\.(\\d+)\\.(\\d+)([-\\w]*)", false );
+ TQRegExp regExp( "Cyrus\\stimsieved\\sv(\\d+)\\.(\\d+)\\.(\\d+)([-\\w]*)", false );
if ( regExp.search( m_implementation ) >= 0 ) {
const int major = regExp.cap( 1 ).toInt();
const int minor = regExp.cap( 2 ).toInt();
const int patch = regExp.cap( 3 ).toInt();
- const QString vendor = regExp.cap( 4 );
+ const TQString vendor = regExp.cap( 4 );
if ( major < 2 || (major == 2 && (minor < 3 || (minor == 3 && patch < 11))) || (vendor == "-kolab-nocaps") ) {
ksDebug() << k_funcinfo << "Enabling compat mode for Cyrus < 2.3.11 or Cyrus marked as \"kolab-nocaps\"" << endl;
return true;