summaryrefslogtreecommitdiffstats
path: root/kmail/sievedebugdialog.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-01 00:37:02 +0000
commitcc29364f06178f8f6b457384f2ec37a042bd9d43 (patch)
tree7c77a3184c698bbf9d98cef09fb1ba8124daceba /kmail/sievedebugdialog.cpp
parent4f6c584bacc8c3c694228f36ada3de77a76614a6 (diff)
downloadtdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.tar.gz
tdepim-cc29364f06178f8f6b457384f2ec37a042bd9d43.zip
* 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
Diffstat (limited to 'kmail/sievedebugdialog.cpp')
-rw-r--r--kmail/sievedebugdialog.cpp65
1 files changed, 32 insertions, 33 deletions
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 );