summaryrefslogtreecommitdiffstats
path: root/libkpimexchange/core/exchangemonitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkpimexchange/core/exchangemonitor.cpp')
-rw-r--r--libkpimexchange/core/exchangemonitor.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/libkpimexchange/core/exchangemonitor.cpp b/libkpimexchange/core/exchangemonitor.cpp
index c659efb15..8e5525038 100644
--- a/libkpimexchange/core/exchangemonitor.cpp
+++ b/libkpimexchange/core/exchangemonitor.cpp
@@ -18,11 +18,11 @@
Boston, MA 02110-1301, USA.
*/
-#include <qstring.h>
-#include <qregexp.h>
-#include <qsocketdevice.h>
-#include <qsocketnotifier.h>
-#include <qtextstream.h>
+#include <tqstring.h>
+#include <tqregexp.h>
+#include <tqsocketdevice.h>
+#include <tqsocketnotifier.h>
+#include <tqtextstream.h>
#include <kurl.h>
#include <kdebug.h>
@@ -54,24 +54,24 @@ extern "C" {
using namespace KPIM;
-QString makeIDString( const ExchangeMonitor::IDList& IDs )
+TQString makeIDString( const ExchangeMonitor::IDList& IDs )
{
- QString result;
+ TQString result;
ExchangeMonitor::IDList::ConstIterator it;
for ( it = IDs.begin(); it != IDs.end(); ++it ) {
if ( it == IDs.begin() )
- result += QString::number( (*it) );
+ result += TQString::number( (*it) );
else
- result += "," + QString::number( (*it) );
+ result += "," + TQString::number( (*it) );
}
return result;
}
-ExchangeMonitor::IDList makeIDList( const QString& input )
+ExchangeMonitor::IDList makeIDList( const TQString& input )
{
ExchangeMonitor::IDList IDs;
- QStringList numbers = QStringList::split( ",", input );
- QStringList::iterator j;
+ TQStringList numbers = TQStringList::split( ",", input );
+ TQStringList::iterator j;
for ( j = numbers.begin(); j != numbers.end(); ++j ) {
ExchangeMonitor::ID id = (*j).toLong();
IDs.append( id );
@@ -79,7 +79,7 @@ ExchangeMonitor::IDList makeIDList( const QString& input )
return IDs;
}
-ExchangeMonitor::ExchangeMonitor( ExchangeAccount* account, int pollMode, const QHostAddress& ownInterface )
+ExchangeMonitor::ExchangeMonitor( ExchangeAccount* account, int pollMode, const TQHostAddress& ownInterface )
{
kdDebug() << "Called ExchangeMonitor" << endl;
@@ -89,12 +89,12 @@ ExchangeMonitor::ExchangeMonitor( ExchangeAccount* account, int pollMode, const
mPollTimer = 0;
if ( pollMode == CallBack ) {
- mSocket = new QSocketDevice( QSocketDevice::Datagram );
+ mSocket = new TQSocketDevice( TQSocketDevice::Datagram );
if ( ! mSocket->bind( ownInterface, 0 ) )
kdDebug() << "bind() returned false" << endl;
mSocket->setBlocking( false );
- mNotifier = new QSocketNotifier( mSocket->socket(), QSocketNotifier::Read );
- connect( mNotifier, SIGNAL(activated( int )), this, SLOT( slotActivated(int)));
+ mNotifier = new TQSocketNotifier( mSocket->socket(), TQSocketNotifier::Read );
+ connect( mNotifier, TQT_SIGNAL(activated( int )), this, TQT_SLOT( slotActivated(int)));
//mSocket.setSocketFlags( KExtendedSocket::inetSocket | KExtendedSocket::passiveSocket | KExtendedSocket::datagramSocket | KExtendedSocket::bufferedSocket );
//mSocket.setHost( "jupiter.tbm.tudelft.nl" ); // Does this work?
@@ -105,17 +105,17 @@ ExchangeMonitor::ExchangeMonitor( ExchangeAccount* account, int pollMode, const
//mSocket.enableRead( true );
kdDebug() << "Port: " << mSocket->port() << endl;
kdDebug() << "Host: " << mSocket->address().toString() << endl;
- // mStream = new QTextStream( mSocket );
+ // mStream = new TQTextStream( mSocket );
}
if ( mPollMode == Poll ) {
- mPollTimer = new QTimer( this, "mPollTimer" );
- connect( mPollTimer, SIGNAL(timeout()), this, SLOT(slotPollTimer()) );
+ mPollTimer = new TQTimer( this, "mPollTimer" );
+ connect( mPollTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotPollTimer()) );
mPollTimer->start( 60000 ); // 1 minute timer
}
- mRenewTimer = new QTimer( this, "mRenewTimer" );
- connect( mRenewTimer, SIGNAL(timeout()), this, SLOT(slotRenewTimer()) );
+ mRenewTimer = new TQTimer( this, "mRenewTimer" );
+ connect( mRenewTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotRenewTimer()) );
mRenewTimer->start( mSubscriptionLifetime * 900 ); // 10% early so as to be in time
}
@@ -127,13 +127,13 @@ ExchangeMonitor::~ExchangeMonitor()
if ( mPollTimer ) delete mPollTimer;
if ( mRenewTimer ) delete mRenewTimer;
if ( ! mSubscriptionMap.isEmpty() ) {
- QString headers = "Subscription-ID: " + makeIDString( mSubscriptionMap.keys() );
+ TQString headers = "Subscription-ID: " + makeIDString( mSubscriptionMap.keys() );
kdDebug() << "Subsubscribing all watches, headers:" << endl << headers << endl;
- KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_UNSUBSCRIBE, QString::null, false );
+ KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_UNSUBSCRIBE, TQString::null, false );
job->addMetaData( "customHTTPHeader", headers );
// Can't do, this is a destructor!
// job->addMetaData( "PropagateHttpHeader", "true" );
- // connect(job, SIGNAL(result( KIO::Job * )), this, SLOT(slotUnsubscribeResult(KIO::Job *)));
+ // connect(job, TQT_SIGNAL(result( KIO::Job * )), this, TQT_SLOT(slotUnsubscribeResult(KIO::Job *)));
}
kdDebug() << "Finished ExchangeMonitor destructor" << endl;
@@ -141,7 +141,7 @@ ExchangeMonitor::~ExchangeMonitor()
void ExchangeMonitor::addWatch( const KURL &url, int mode, int depth )
{
- QString headers = "Notification-type: ";
+ TQString headers = "Notification-type: ";
switch( mode ) {
case Delete: headers += "delete\r\n"; break;
case Move: headers += "move\r\n"; break;
@@ -150,24 +150,24 @@ void ExchangeMonitor::addWatch( const KURL &url, int mode, int depth )
case UpdateNewMember: headers += "update/newmember\r\n"; break;
}
- headers += "Depth: " + QString::number( depth );
+ headers += "Depth: " + TQString::number( depth );
if (mPollMode == CallBack )
- headers += "\r\nCall-Back: httpu://" + mSocket->address().toString() + ":" + QString::number(mSocket->port());
+ headers += "\r\nCall-Back: httpu://" + mSocket->address().toString() + ":" + TQString::number(mSocket->port());
kdDebug() << "Headers: " << headers << endl;
KURL myURL = toDAV( url );
- KIO::DavJob *job = new KIO::DavJob( myURL, (int) KIO::DAV_SUBSCRIBE, QString::null, false );
+ KIO::DavJob *job = new KIO::DavJob( myURL, (int) KIO::DAV_SUBSCRIBE, TQString::null, false );
job->addMetaData( "customHTTPHeader", headers );
job->addMetaData( "PropagateHttpHeader", "true" );
- connect(job, SIGNAL(result( KIO::Job * )), this, SLOT(slotSubscribeResult(KIO::Job *)));
+ connect(job, TQT_SIGNAL(result( KIO::Job * )), this, TQT_SLOT(slotSubscribeResult(KIO::Job *)));
}
void ExchangeMonitor::removeWatch( const KURL &url )
{
KURL myURL = toDAV( url );
- QMap<ID,KURL>::Iterator it;
+ TQMap<ID,KURL>::Iterator it;
for ( it = mSubscriptionMap.begin(); it != mSubscriptionMap.end(); ++it ) {
if ( it.data() == myURL ) {
removeWatch( it.key() );
@@ -179,17 +179,17 @@ void ExchangeMonitor::removeWatch( const KURL &url )
void ExchangeMonitor::removeWatch( ID id )
{
- KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_UNSUBSCRIBE, QString::null, false );
- job->addMetaData( "customHTTPHeader", "Subscription-id: " + QString::number( id ));
+ KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_UNSUBSCRIBE, TQString::null, false );
+ job->addMetaData( "customHTTPHeader", "Subscription-id: " + TQString::number( id ));
job->addMetaData( "PropagateHttpHeader", "true" );
- connect(job, SIGNAL(result( KIO::Job * )), this, SLOT(slotUnsubscribeResult(KIO::Job *)));
+ connect(job, TQT_SIGNAL(result( KIO::Job * )), this, TQT_SLOT(slotUnsubscribeResult(KIO::Job *)));
}
void ExchangeMonitor::slotSubscribeResult( KIO::Job * job )
{
if ( job->error() ) {
job->showErrorDialog( 0L );
- emit error( ExchangeClient::CommunicationError, "IO Error: " + QString::number(job->error()) + ":" + job->errorString() );
+ emit error( ExchangeClient::CommunicationError, "IO Error: " + TQString::number(job->error()) + ":" + job->errorString() );
return;
}
@@ -198,12 +198,12 @@ void ExchangeMonitor::slotSubscribeResult( KIO::Job * job )
bool gotID = false;
bool gotURL = false;
- QStringList headers = QStringList::split( "\n", job->queryMetaData( "HTTP-Headers" ) );
- for ( QStringList::Iterator it = headers.begin(); it != headers.end(); ++it ) {
+ TQStringList headers = TQStringList::split( "\n", job->queryMetaData( "HTTP-Headers" ) );
+ for ( TQStringList::Iterator it = headers.begin(); it != headers.end(); ++it ) {
int colon = (*it).find( ": " );
if ( colon<0 ) continue;
- QString tag = (*it).left( colon ).stripWhiteSpace().lower();
- QString value = (*it).mid( colon+1 ).stripWhiteSpace();
+ TQString tag = (*it).left( colon ).stripWhiteSpace().lower();
+ TQString value = (*it).mid( colon+1 ).stripWhiteSpace();
if ( tag == "subscription-lifetime" ) {
int lifetime = value.toInt();
if ( lifetime < mSubscriptionLifetime ) {
@@ -249,15 +249,15 @@ void ExchangeMonitor::slotUnsubscribeResult( KIO::Job * job )
{
if ( job->error() ) {
job->showErrorDialog( 0L );
- emit error( ExchangeClient::CommunicationError, "IO Error: " + QString::number(job->error()) + ":" + job->errorString() );
+ emit error( ExchangeClient::CommunicationError, "IO Error: " + TQString::number(job->error()) + ":" + job->errorString() );
return;
}
- QDomDocument& response = static_cast<KIO::DavJob *>( job )->response();
+ TQDomDocument& response = static_cast<KIO::DavJob *>( job )->response();
kdDebug() << "UNSUBSCRIBE result: " << endl << response.toString() << endl;
- QDomElement status = response.documentElement().namedItem( "response" ).namedItem( "status" ).toElement();
- QDomElement subscriptionID = response.documentElement().namedItem( "response" ).namedItem( "subscriptionID" ).toElement();
+ TQDomElement status = response.documentElement().namedItem( "response" ).namedItem( "status" ).toElement();
+ TQDomElement subscriptionID = response.documentElement().namedItem( "response" ).namedItem( "subscriptionID" ).toElement();
kdDebug() << "Subscription ID.text(): " << subscriptionID.text() << endl;
bool ok;
ID id = subscriptionID.text().toLong( &ok );
@@ -284,7 +284,7 @@ void ExchangeMonitor::slotActivated( int )
if ( maxLen == 0 )
return;
- QCString response( maxLen+2 );
+ TQCString response( maxLen+2 );
Q_LONG len = mSocket->readBlock ( response.data(), maxLen+1 );
if ( len <= 0 ) {
@@ -295,13 +295,13 @@ void ExchangeMonitor::slotActivated( int )
kdDebug() << "Got data of " << len << " bytes." << endl;
kdDebug() << response << endl;
- QString s(response);
+ TQString s(response);
IDList IDs;
- QStringList lines = QStringList::split( "\n", s );
- QStringList::iterator it;
+ TQStringList lines = TQStringList::split( "\n", s );
+ TQStringList::iterator it;
for ( it = lines.begin(); it != lines.end(); ++it ) {
- QString line = (*it).stripWhiteSpace().lower();
+ TQString line = (*it).stripWhiteSpace().lower();
if ( line.startsWith( "subscription-id: " ) )
IDs = makeIDList( line.section(":",1).stripWhiteSpace() );
}
@@ -321,35 +321,35 @@ void ExchangeMonitor::poll( const IDList& IDs ) {
// }
// confirm it
- KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_POLL, QString::null, false );
+ KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_POLL, TQString::null, false );
job->addMetaData( "customHTTPHeader", "Subscription-ID: " + makeIDString( IDs ) );
- connect(job, SIGNAL(result( KIO::Job * )), this, SLOT(slotPollResult(KIO::Job *)));
+ connect(job, TQT_SIGNAL(result( KIO::Job * )), this, TQT_SLOT(slotPollResult(KIO::Job *)));
}
void ExchangeMonitor::slotPollResult( KIO::Job * job )
{
if ( job->error() ) {
job->showErrorDialog( 0L );
- emit error( ExchangeClient::CommunicationError, "IO Error: " + QString::number(job->error()) + ":" + job->errorString() );
+ emit error( ExchangeClient::CommunicationError, "IO Error: " + TQString::number(job->error()) + ":" + job->errorString() );
return;
}
- QDomDocument& response = static_cast<KIO::DavJob *>( job )->response();
+ TQDomDocument& response = static_cast<KIO::DavJob *>( job )->response();
kdDebug() << "POLL result: " << endl << response.toString() << endl;
// Multiple results!
- QDomNodeList responses = response.documentElement().elementsByTagName( "response" );
+ TQDomNodeList responses = response.documentElement().elementsByTagName( "response" );
if ( responses.count() == 0 ) {
emit error( ExchangeClient::ServerResponseError, "Poll result is wrong: \n" + response.toString() );
return;
}
for( uint i=0; i<responses.count(); i++ ) {
- QDomElement item = responses.item( i ).toElement();
- QDomElement status = item.namedItem( "status" ).toElement();
- QDomElement subscriptionID = item.namedItem( "subscriptionID" ).toElement();
+ TQDomElement item = responses.item( i ).toElement();
+ TQDomElement status = item.namedItem( "status" ).toElement();
+ TQDomElement subscriptionID = item.namedItem( "subscriptionID" ).toElement();
if ( status.text().contains( "200" ) ) {
kdDebug() << "subscriptionID: " << subscriptionID.text() << endl;
IDList IDs = makeIDList( subscriptionID.text() );
- QValueList<KURL> urls;
+ TQValueList<KURL> urls;
IDList::ConstIterator it;
for ( it = IDs.begin(); it != IDs.end(); ++it ) {
urls += mSubscriptionMap[ *it ];
@@ -366,16 +366,16 @@ void ExchangeMonitor::slotRenewTimer()
{
kdDebug() << "ExchangeMonitor::slotRenewTimer()" << endl;
- KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_SUBSCRIBE, QString::null, false );
+ KIO::DavJob *job = new KIO::DavJob( mAccount->calendarURL(), (int) KIO::DAV_SUBSCRIBE, TQString::null, false );
job->addMetaData( "customHTTPHeader", "Subscription-id: " + makeIDString( mSubscriptionMap.keys() ) );
- connect(job, SIGNAL(result( KIO::Job * )), this, SLOT(slotRenewResult(KIO::Job *)));
+ connect(job, TQT_SIGNAL(result( KIO::Job * )), this, TQT_SLOT(slotRenewResult(KIO::Job *)));
}
void ExchangeMonitor::slotRenewResult( KIO::Job* job )
{
if ( job->error() ) {
job->showErrorDialog( 0L );
- emit error( ExchangeClient::CommunicationError, "IO Error: " + QString::number(job->error()) + ":" + job->errorString() );
+ emit error( ExchangeClient::CommunicationError, "IO Error: " + TQString::number(job->error()) + ":" + job->errorString() );
return;
}
kdDebug() << "ExchangeMonitor::slotRenewResult()" << endl;