From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmail/sievedebugdialog.cpp | 65 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 33 deletions(-) (limited to 'kmail/sievedebugdialog.cpp') diff --git a/kmail/sievedebugdialog.cpp b/kmail/sievedebugdialog.cpp index 5ab305e83..bc5d2cca0 100644 --- a/kmail/sievedebugdialog.cpp +++ b/kmail/sievedebugdialog.cpp @@ -219,6 +219,32 @@ SieveDebugDialog::~SieveDebugDialog() kdDebug( 5006 ) << k_funcinfo << endl; } +static KURL urlFromAccount( const KMail::ImapAccountBase * a ) { + const SieveConfig sieve = a->sieveConfig(); + if ( !sieve.managesieveSupported() ) + return KURL(); + + KURL u; + if ( sieve.reuseConfig() ) { + // assemble Sieve url from the settings of the account: + u.setProtocol( "sieve" ); + u.setHost( a->host() ); + u.setUser( a->login() ); + u.setPass( a->passwd() ); + u.setPort( sieve.port() ); + + // Translate IMAP LOGIN to PLAIN: + u.addQueryItem( "x-mech", a->auth() == "*" ? "PLAIN" : a->auth() ); + if ( !a->useSSL() && !a->useTLS() ) + u.addQueryItem( "x-allow-unencrypted", "true" ); + } else { + u = sieve.alternateURL(); + if ( u.protocol().lower() == "sieve" && !a->useSSL() && !a->useTLS() && u.queryItem("x-allow-unencrypted").isEmpty() ) + u.addQueryItem( "x-allow-unencrypted", "true" ); + } + return u; +} + void SieveDebugDialog::slotDiagNextAccount() { if ( mAccountList.isEmpty() ) @@ -233,26 +259,12 @@ void SieveDebugDialog::slotDiagNextAccount() if ( mAccountBase ) { // Detect URL for this IMAP account - SieveConfig sieve = mAccountBase->sieveConfig(); - if ( !sieve.managesieveSupported() ) + const KURL url = urlFromAccount( mAccountBase ); + if ( !url.isValid() ) { mEdit->append( i18n( "(Account does not support Sieve)\n\n" ) ); } else { - if ( sieve.reuseConfig() ) - { - // assemble Sieve url from the settings of the account: - mUrl.setProtocol( "sieve" ); - mUrl.setHost( mAccountBase->host() ); - mUrl.setUser( mAccountBase->login() ); - mUrl.setPass( mAccountBase->passwd() ); - mUrl.setPort( sieve.port() ); - - // Translate IMAP LOGIN to PLAIN: - mUrl.setQuery( "x-mech=" + ( mAccountBase->auth() == "*" ? "PLAIN" : mAccountBase->auth() ) ); - } else { - sieve.alternateURL(); - mUrl.setFileName( sieve.vacationFileName() ); - } + mUrl = url; mSieveJob = SieveJob::list( mUrl ); @@ -284,22 +296,9 @@ void SieveDebugDialog::slotDiagNextScript() mScriptList.pop_front(); mEdit->append( i18n( "Contents of script '%1':\n" ).arg( scriptFile ) ); - SieveConfig sieve = mAccountBase->sieveConfig(); - if ( sieve.reuseConfig() ) - { - // assemble Sieve url from the settings of the account: - mUrl.setProtocol( "sieve" ); - mUrl.setHost( mAccountBase->host() ); - mUrl.setUser( mAccountBase->login() ); - mUrl.setPass( mAccountBase->passwd() ); - mUrl.setPort( sieve.port() ); - // Translate IMAP LOGIN to PLAIN - mUrl.setQuery( "x-mech=" + ( mAccountBase->auth() == "*" ? "PLAIN" : mAccountBase->auth() ) ); - mUrl.setFileName( scriptFile ); - } else { - sieve.alternateURL(); - mUrl.setFileName( scriptFile ); - } + + mUrl = urlFromAccount( mAccountBase ); + mUrl.setFileName( scriptFile ); mSieveJob = SieveJob::get( mUrl ); -- cgit v1.2.1