[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: Re: [Kde-pim] Disabling signing after saving a draft
From: Alexis Papadopoulos <iacp () free ! fr>
Date: 2007-06-28 14:06:36
Message-ID: 200706281606.39210.iacp () free ! fr
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
[Attachment #4 (multipart/mixed)]
Ok, I have something that works now. The problem with IMAP accounts was that,
altough headers were properly parsed, the encryption and signature (at least
those two) ones were ignored.
I'm sending the patch for this, but I need to mention a couple of issues that
might come up:
_ the modifications in headeritem.cpp: I don't know if the key generation is
for the index or not, but by modifying the switch (see path), that could be a
small problem since s="5" now is not the default case anymore
_ KMMsgSignatureTemporarilyDisabled means that the message is not signed,
therefore the modifications in kmcommans.cpp, but I'm not 100% certain about
those, someone needs to check
_ same comment for kmfolderimap.cpp and modification in
KMReaderWin::slotTouchMessage()
_ last but NOT least, kmmessage.cpp, KMMessage::fromDwString
a quick couple of greps showed that the boolean passed as parameter is always
set to false (might be wrong though). Even if set to true, I didn't
understand the following lines:
if (aSetStatus) {
setStatus(headerField("Status").latin1(), headerField("X-Status").latin1
());
setEncryptionStateChar( headerField("X-KMail-EncryptionState").at(0) );
setSignatureStateChar( headerField("X-KMail-SignatureState").at(0) );
setMDNSentState( static_cast<KMMsgMDNSentState>(
headerField("X-KMail-MDN-Sent").at(0).latin1() ) );
}
since they don't make use of the newly parsed information, therefore I added
this :
if ( mMsg->Headers().FindField("X-KMail-SignatureState") )
setSignatureStateChar(
mMsg->Headers().FindField("X-KMail-SignatureState")->FieldBodyStr().at(0) );
if ( mMsg->Headers().FindField("X-KMail-EncryptionState") )
setEncryptionStateChar(
mMsg->Headers().FindField("X-KMail-EncryptionState")->FieldBodyStr().at(0) );
Now, enough with the modifications. I fell on some other issues, unrelated to
the above patch. Steps to undertake:
_ create a new message and save a draft (signed, so the option "never sign &
encrypt when saving drafts" needs to be unchecked) without adding any body
content
_ re-open it, uncheck the signature button and resave as draft
_ if you check the headers, the X-KMail-SignatureState is still on F (for
fully signed), although there is no signed content
Small issue, but thought I should mention it.
Keep me posted if something seems wrong with the patch,
Alexis
P.S: If it seems right, please close http://bugs.kde.org/103240
["patch.diff" (text/x-diff)]
Common subdirectories: kmail.orig/kdepim-3.5.7/kmail/about and \
kmail/kdepim-3.5.7/kmail/about Common subdirectories: \
kmail.orig/kdepim-3.5.7/kmail/avscripts and kmail/kdepim-3.5.7/kmail/avscripts Only \
in kmail/kdepim-3.5.7/kmail/: .deps Only in kmail/kdepim-3.5.7/kmail/: Doxyfile
diff -u -p kmail.orig/kdepim-3.5.7/kmail/headeritem.cpp \
kmail/kdepim-3.5.7/kmail/headeritem.cpp
--- kmail.orig/kdepim-3.5.7/kmail/headeritem.cpp 2007-05-14 09:54:39.000000000 +0200
+++ kmail/kdepim-3.5.7/kmail/headeritem.cpp 2007-06-27 16:59:07.000000000 +0200
@@ -504,11 +504,12 @@ QString HeaderItem::generate_key( KMHead
QString s;
switch ( msg->signatureState() )
{
- case KMMsgFullySigned : s = "1"; break;
- case KMMsgPartiallySigned : s = "2"; break;
- case KMMsgSignatureStateUnknown: s = "3"; break;
- case KMMsgSignatureProblematic : s = "4"; break;
- default : s = "5"; break;
+ case KMMsgFullySigned : s = "1"; break;
+ case KMMsgPartiallySigned : s = "2"; break;
+ case KMMsgSignatureStateUnknown : s = "3"; break;
+ case KMMsgSignatureProblematic : s = "4"; break;
+ case KMMsgSignatureTemporarilyDisabled : s = "5"; break;
+ default : s = "6"; break;
}
return ret + s + sortArrival;
}
@@ -516,11 +517,12 @@ QString HeaderItem::generate_key( KMHead
QString s;
switch ( msg->encryptionState() )
{
- case KMMsgFullyEncrypted : s = "1"; break;
- case KMMsgPartiallyEncrypted : s = "2"; break;
- case KMMsgEncryptionStateUnknown: s = "3"; break;
- case KMMsgEncryptionProblematic : s = "4"; break;
- default : s = "5"; break;
+ case KMMsgFullyEncrypted : s = "1"; break;
+ case KMMsgPartiallyEncrypted : s = "2"; break;
+ case KMMsgEncryptionStateUnknown : s = "3"; break;
+ case KMMsgEncryptionProblematic : s = "4"; break;
+ case KMMsgEncryptionTemporarilyDisabled : s = "5"; break;
+ default : s = "6"; break;
}
return ret + s + sortArrival;
}
Only in kmail/kdepim-3.5.7/kmail/: .imapjob.cpp.swp
Common subdirectories: kmail.orig/kdepim-3.5.7/kmail/interfaces and \
kmail/kdepim-3.5.7/kmail/interfaces Only in kmail/kdepim-3.5.7/kmail/: kmail.kdevses
diff -u -p kmail.orig/kdepim-3.5.7/kmail/kmcommands.cpp \
kmail/kdepim-3.5.7/kmail/kmcommands.cpp
--- kmail.orig/kdepim-3.5.7/kmail/kmcommands.cpp 2007-05-14 09:54:39.000000000 +0200
+++ kmail/kdepim-3.5.7/kmail/kmcommands.cpp 2007-06-27 20:58:49.000000000 +0200
@@ -2580,7 +2580,7 @@ KMCommand::Result KMSaveAttachmentsComma
const KURL& url )
{
bool bSaveEncrypted = false;
- bool bEncryptedParts = node->encryptionState() != KMMsgNotEncrypted;
+ bool bEncryptedParts = ( node->encryptionState() != KMMsgNotEncrypted && \
node->encryptionState() != KMMsgEncryptionTemporarilyDisabled ); if( bEncryptedParts \
) if( KMessageBox::questionYesNo( parentWidget(),
i18n( "The part %1 of the message is encrypted. Do you want to keep the \
encryption when saving?" ). @@ -2590,7 +2590,7 @@ KMCommand::Result \
KMSaveAttachmentsComma bSaveEncrypted = true;
bool bSaveWithSig = true;
- if( node->signatureState() != KMMsgNotSigned )
+ if( node->signatureState() != KMMsgNotSigned && node->signatureState() != \
KMMsgSignatureTemporarilyDisabled ) if( KMessageBox::questionYesNo( parentWidget(),
i18n( "The part %1 of the message is signed. Do you want to keep the \
signature when saving?" ). arg( url.fileName() ),
diff -u -p kmail.orig/kdepim-3.5.7/kmail/kmcomposewin.cpp \
kmail/kdepim-3.5.7/kmail/kmcomposewin.cpp
--- kmail.orig/kdepim-3.5.7/kmail/kmcomposewin.cpp 2007-05-14 09:54:39.000000000 \
+0200
+++ kmail/kdepim-3.5.7/kmail/kmcomposewin.cpp 2007-06-27 20:32:14.000000000 +0200
@@ -1803,6 +1803,7 @@ void KMComposeWin::setMsg(KMMessage* new
// enable/disable encryption if the message was/wasn't encrypted
switch ( mMsg->encryptionState() ) {
case KMMsgFullyEncrypted: // fall through
+ case KMMsgEncryptionTemporarilyDisabled: // fall through
case KMMsgPartiallyEncrypted:
mLastEncryptActionState = true;
break;
@@ -1816,6 +1817,7 @@ void KMComposeWin::setMsg(KMMessage* new
// enable/disable signing if the message was/wasn't signed
switch ( mMsg->signatureState() ) {
case KMMsgFullySigned: // fall through
+ case KMMsgSignatureTemporarilyDisabled: // fall through
case KMMsgPartiallySigned:
mLastSignActionState = true;
break;
diff -u -p kmail.orig/kdepim-3.5.7/kmail/kmfolderimap.cpp \
kmail/kdepim-3.5.7/kmail/kmfolderimap.cpp
--- kmail.orig/kdepim-3.5.7/kmail/kmfolderimap.cpp 2007-05-14 09:54:39.000000000 \
+0200
+++ kmail/kdepim-3.5.7/kmail/kmfolderimap.cpp 2007-06-27 11:30:12.000000000 +0200
@@ -1637,8 +1637,10 @@ KMFolderImap::doCreateJob( KMMessage *ms
account() && account()->loadOnDemand() &&
( msg->msgSizeServer() > 5000 || msg->msgSizeServer() == 0 ) &&
( msg->signatureState() == KMMsgNotSigned ||
+ msg->signatureState() == KMMsgSignatureTemporarilyDisabled ||
msg->signatureState() == KMMsgSignatureStateUnknown ) &&
( msg->encryptionState() == KMMsgNotEncrypted ||
+ msg->encryptionState() == KMMsgEncryptionTemporarilyDisabled ||
msg->encryptionState() == KMMsgEncryptionStateUnknown ) )
{
// load-on-demand: retrieve the BODYSTRUCTURE and to speed things up also the \
headers
diff -u -p kmail.orig/kdepim-3.5.7/kmail/kmmessage.cpp \
kmail/kdepim-3.5.7/kmail/kmmessage.cpp
--- kmail.orig/kdepim-3.5.7/kmail/kmmessage.cpp 2007-05-14 09:54:39.000000000 +0200
+++ kmail/kdepim-3.5.7/kmail/kmmessage.cpp 2007-06-28 15:38:32.000000000 +0200
@@ -403,6 +403,13 @@ void KMMessage::fromDwString(const DwStr
setSignatureStateChar( headerField("X-KMail-SignatureState").at(0) );
setMDNSentState( static_cast<KMMsgMDNSentState>( \
headerField("X-KMail-MDN-Sent").at(0).latin1() ) ); }
+ // If the message contains information on signature/encryption
+ // state apply it here
+ if ( mMsg->Headers().FindField("X-KMail-SignatureState") )
+ setSignatureStateChar( \
mMsg->Headers().FindField("X-KMail-SignatureState")->FieldBodyStr().at(0) ); + if ( \
mMsg->Headers().FindField("X-KMail-EncryptionState") ) + setEncryptionStateChar( \
mMsg->Headers().FindField("X-KMail-EncryptionState")->FieldBodyStr().at(0) ); +
if (attachmentState() == KMMsgAttachmentUnknown && readyToShow())
updateAttachmentState();
diff -u -p kmail.orig/kdepim-3.5.7/kmail/kmmsgbase.cpp \
kmail/kdepim-3.5.7/kmail/kmmsgbase.cpp
--- kmail.orig/kdepim-3.5.7/kmail/kmmsgbase.cpp 2007-05-14 09:54:39.000000000 +0200
+++ kmail/kdepim-3.5.7/kmail/kmmsgbase.cpp 2007-06-28 15:27:21.000000000 +0200
@@ -317,6 +317,8 @@ void KMMsgBase::setEncryptionStateChar(
setEncryptionState( KMMsgPartiallyEncrypted, idx );
else if( status.latin1() == (char)KMMsgFullyEncrypted )
setEncryptionState( KMMsgFullyEncrypted, idx );
+ else if( status.latin1() == (char)KMMsgEncryptionTemporarilyDisabled )
+ setEncryptionState( KMMsgEncryptionTemporarilyDisabled, idx );
else
setEncryptionState( KMMsgEncryptionStateUnknown, idx );
}
@@ -348,6 +350,8 @@ void KMMsgBase::setSignatureStateChar( Q
setSignatureState( KMMsgPartiallySigned,idx );
else if( status.latin1() == (char)KMMsgFullySigned )
setSignatureState( KMMsgFullySigned, idx );
+ else if( status.latin1() == (char)KMMsgSignatureTemporarilyDisabled )
+ setSignatureState( KMMsgSignatureTemporarilyDisabled, idx );
else
setSignatureState( KMMsgSignatureStateUnknown, idx );
}
diff -u -p kmail.orig/kdepim-3.5.7/kmail/kmmsgbase.h \
kmail/kdepim-3.5.7/kmail/kmmsgbase.h
--- kmail.orig/kdepim-3.5.7/kmail/kmmsgbase.h 2007-01-15 12:28:47.000000000 +0100
+++ kmail/kdepim-3.5.7/kmail/kmmsgbase.h 2007-06-27 11:25:27.000000000 +0200
@@ -89,7 +89,8 @@ typedef enum
KMMsgNotEncrypted='N',
KMMsgPartiallyEncrypted='P',
KMMsgFullyEncrypted='F',
- KMMsgEncryptionProblematic='X'
+ KMMsgEncryptionProblematic='X',
+ KMMsgEncryptionTemporarilyDisabled='D'
} KMMsgEncryptionState;
/** Flags for the signature state. */
@@ -99,7 +100,8 @@ typedef enum
KMMsgNotSigned='N',
KMMsgPartiallySigned='P',
KMMsgFullySigned='F',
- KMMsgSignatureProblematic='X'
+ KMMsgSignatureProblematic='X',
+ KMMsgSignatureTemporarilyDisabled='D'
} KMMsgSignatureState;
/** Flags for the "MDN sent" state. */
diff -u -p kmail.orig/kdepim-3.5.7/kmail/kmreaderwin.cpp \
kmail/kdepim-3.5.7/kmail/kmreaderwin.cpp
--- kmail.orig/kdepim-3.5.7/kmail/kmreaderwin.cpp 2007-05-14 09:54:39.000000000 +0200
+++ kmail/kdepim-3.5.7/kmail/kmreaderwin.cpp 2007-06-28 15:32:34.000000000 +0200
@@ -310,7 +310,7 @@ kdDebug(5006) << "pgp signed" << endl;
kdDebug(5006) << "pkcs7 mime" << endl;
// note: subtype Pkcs7Mime can also be signed
// and we do NOT want to remove the signature!
- if ( child && curNode->encryptionState() != KMMsgNotEncrypted )
+ if ( child && curNode->encryptionState() != KMMsgNotEncrypted && \
curNode->encryptionState() != KMMsgEncryptionTemporarilyDisabled ) dataNode = child;
}
break;
@@ -1556,7 +1556,9 @@ void KMReaderWin::parseMsg(KMMessage* aM
// - this can only be done *after* calling parseObjectTree()
KMMsgEncryptionState encryptionState = mRootNode->overallEncryptionState();
KMMsgSignatureState signatureState = mRootNode->overallSignatureState();
- aMsg->setEncryptionState( encryptionState );
+
+ if (aMsg->encryptionState() != KMMsgEncryptionTemporarilyDisabled)
+ aMsg->setEncryptionState( encryptionState );
// Don't reset the signature state to "not signed" (e.g. if one canceled the
// decryption of a signed messages which has already been decrypted before).
if ( signatureState != KMMsgNotSigned ||
@@ -1796,6 +1798,7 @@ void KMReaderWin::slotTouchMessage()
command->start();
if ( mNoMDNsWhenEncrypted &&
message()->encryptionState() != KMMsgNotEncrypted &&
+ message()->encryptionState() != KMMsgEncryptionTemporarilyDisabled &&
message()->encryptionState() != KMMsgEncryptionStateUnknown )
return;
if ( KMMessage * receipt = message()->createMDN( MDN::ManualAction,
Only in kmail/kdepim-3.5.7/kmail/: Makefile
diff -u -p kmail.orig/kdepim-3.5.7/kmail/messagecomposer.cpp \
kmail/kdepim-3.5.7/kmail/messagecomposer.cpp
--- kmail.orig/kdepim-3.5.7/kmail/messagecomposer.cpp 2007-05-14 09:54:39.000000000 \
+0200
+++ kmail/kdepim-3.5.7/kmail/messagecomposer.cpp 2007-06-28 15:33:05.000000000 +0200
@@ -712,6 +712,16 @@ void MessageComposer::adjustCryptFlags()
if ( !mRc )
return;
+ // Setting signature/encryption states
+ if (!mDoSign && mSigningRequested)
+ mReferenceMessage->setSignatureStateChar('D');
+ if (!mDoEncrypt && mEncryptionRequested)
+ mReferenceMessage->setEncryptionStateChar('D');
+ if (!mSigningRequested && mReferenceMessage->signatureState() == \
KMMsgSignatureTemporarilyDisabled) + mReferenceMessage->setSignatureStateChar(' \
'); + if (!mEncryptionRequested && mReferenceMessage->encryptionState() == \
KMMsgEncryptionTemporarilyDisabled) + mReferenceMessage->setEncryptionStateChar(' \
'); +
// resolveAllKeys needs to run even if mDisableCrypto == true, since
// we depend on it collecting all recipients into one dummy
// SplitInfo to avoid special-casing all over the place:
Common subdirectories: kmail.orig/kdepim-3.5.7/kmail/pics and \
kmail/kdepim-3.5.7/kmail/pics Common subdirectories: \
kmail.orig/kdepim-3.5.7/kmail/profiles and kmail/kdepim-3.5.7/kmail/profiles Common \
subdirectories: kmail.orig/kdepim-3.5.7/kmail/tests and \
kmail/kdepim-3.5.7/kmail/tests
["signature.asc" (application/pgp-signature)]
_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic