From 8e337bdb90e72dc64edf82e5ff0af3b2957236e0 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Mar 04 2009 21:32:45 +0000 Subject: upstream patch, speed up folder syncing --- diff --git a/kdepim-4.2.1-imap.patch b/kdepim-4.2.1-imap.patch new file mode 100644 index 0000000..71b26a9 --- /dev/null +++ b/kdepim-4.2.1-imap.patch @@ -0,0 +1,158 @@ +Index: kmail/kmfoldercachedimap.cpp +=================================================================== +--- kmail/kmfoldercachedimap.cpp (Revision 935084) ++++ kmail/kmfoldercachedimap.cpp (Revision 935085) +@@ -202,7 +202,8 @@ + /*mHoldSyncs( false ),*/ + mFolderRemoved( false ), + mRecurse( true ), +- mStatusChangedLocally( false ), mAnnotationFolderTypeChanged( false ), ++ mStatusChangedLocally( false ), ++ mAnnotationFolderTypeChanged( false ), + mIncidencesForChanged( false ), mPersonalNamespacesCheckDone( true ), + mQuotaInfo(), mAlarmsBlocked( false ), + mRescueCommandCount( 0 ), +@@ -303,18 +304,22 @@ + KMFolderMaildir::readConfig(); + + mStatusChangedLocally = group.readEntry( "StatusChangedLocally", false ); ++ QStringList uidsChanged = group.readEntry( "UIDStatusChangedLocally", QStringList() ); ++ foreach( const QString &uid, uidsChanged ) { ++ mUIDsOfLocallyChangedStatuses.append( uid.toUInt() ); ++ } + mAnnotationFolderTypeChanged = group.readEntry( "AnnotationFolderTypeChanged", false ); + mIncidencesForChanged = group.readEntry( "IncidencesForChanged", false ); + if ( mImapPath.isEmpty() ) { + mImapPathCreation = group.readEntry("ImapPathCreation"); + } + +- QStringList uids = group.readEntry( "UIDSDeletedSinceLastSync", QStringList() ); ++ QStringList delUids = group.readEntry( "UIDSDeletedSinceLastSync" , QStringList() ); + #if MAIL_LOSS_DEBUGGING + kDebug( 5006 ) << "READING IN UIDSDeletedSinceLastSync: " << folder()->prettyUrl() << endl << uids; + #endif +- for ( QStringList::iterator it = uids.begin(); it != uids.end(); ++it ) { +- mDeletedUIDsSinceLastSync.insert( (*it).toULong(), 0); ++ for ( QStringList::iterator it = delUids.begin(); it != delUids.end(); it++ ) { ++ mDeletedUIDsSinceLastSync.insert( (*it).toULong(), 0); + } + } + +@@ -331,7 +336,14 @@ + configGroup.writeEntry( "NoContent", mNoContent ); + configGroup.writeEntry( "ReadOnly", mReadOnly ); + configGroup.writeEntry( "FolderAttributes", mFolderAttributes ); +- configGroup.writeEntry( "StatusChangedLocally", mStatusChangedLocally ); ++ ++ // StatusChangedLocally is always false, as we use UIDStatusChangedLocally now ++ configGroup.writeEntry( "StatusChangedLocally", false ); ++ QStringList uidsToWrite; ++ foreach( const ulong uid, mUIDsOfLocallyChangedStatuses ) { ++ uidsToWrite.append( QString::number( uid ) ); ++ } ++ configGroup.writeEntry( "UIDStatusChangedLocally", uidsToWrite ); + if ( !mImapPathCreation.isEmpty() ) { + if ( mImapPath.isEmpty() ) { + configGroup.writeEntry( "ImapPathCreation", mImapPathCreation ); +@@ -953,12 +965,13 @@ + // Upload flags, unless we know from the ACL that we're not allowed + // to do that or they did not change locally + if ( mUserRights <= 0 || ( mUserRights & KMail::ACLJobs::WriteFlags ) ) { +- if ( mStatusChangedLocally ) { ++ if ( !mUIDsOfLocallyChangedStatuses.isEmpty() || mStatusChangedLocally ) { + uploadFlags(); + break; + } +- } else if ( mUserRights & KMail::ACLJobs::WriteSeenFlag ) { +- if ( mStatusChangedLocally ) { ++ } ++ else if ( mUserRights & KMail::ACLJobs::WriteSeenFlag ) { ++ if ( !mUIDsOfLocallyChangedStatuses.isEmpty() || mStatusChangedLocally ) { + uploadSeenFlags(); + break; + } +@@ -1425,6 +1438,10 @@ + // Either not a valid message or not one that is on the server yet + continue; + } ++ if ( mUIDsOfLocallyChangedStatuses.indexOf( msg->UID() ) < 0 && !mStatusChangedLocally ) { ++ // This message has not had its status changed locally ++ continue; ++ } + + QString flags = KMFolderImap::statusToFlags( msg->status(), mPermanentFlags ); + // Collect uids for each typem of flags. +@@ -1468,6 +1485,11 @@ + // Either not a valid message or not one that is on the server yet + continue; + ++ if ( mUIDsOfLocallyChangedStatuses.indexOf( msg->UID() ) < 0 && !mStatusChangedLocally ) { ++ // This message has not had its status changed locally ++ continue; ++ } ++ + if ( msg->status().isOld() || msg->status().isRead() ) + seenUids.append( msg->UID() ); + else +@@ -1525,13 +1547,21 @@ + void KMFolderCachedImap::setStatus( int idx, const MessageStatus &status, bool toggle ) + { + KMFolderMaildir::setStatus( idx, status, toggle ); +- mStatusChangedLocally = true; ++ const KMMsgBase *msg = getMsgBase( idx ); ++ Q_ASSERT( msg ); ++ if ( msg ) ++ mUIDsOfLocallyChangedStatuses.append( msg->UID() ); + } + + void KMFolderCachedImap::setStatus( QList &ids, const MessageStatus &status, bool toggle ) + { + KMFolderMaildir::setStatus( ids, status, toggle ); +- mStatusChangedLocally = true; ++ foreach( const int id, ids ) { ++ const KMMsgBase *msg = getMsgBase( id ); ++ Q_ASSERT( msg ); ++ if ( msg ) ++ mUIDsOfLocallyChangedStatuses.append( msg->UID() ); ++ } + } + + /* Upload new folders to server */ +@@ -1888,7 +1918,8 @@ + } else { + if ( lastSet ) { // always true here (this comes from online-imap...) + mContentState = imapFinished; +- mStatusChangedLocally = false; // we are up to date again ++ mUIDsOfLocallyChangedStatuses.clear(); // we are up to date again ++ mStatusChangedLocally = false; + } + } + serverSyncInternal(); +Index: kmail/kmfoldercachedimap.h +=================================================================== +--- kmail/kmfoldercachedimap.h (Revision 935084) ++++ kmail/kmfoldercachedimap.h (Revision 935085) +@@ -627,12 +627,18 @@ + bool mFolderRemoved; + bool mRecurse; + ++ /** ++ * UIDs added by setStatus. Indicates that the client has changed ++ * the status of those mails. The mail flags for changed mails will be ++ * uploaded to the server, overwriting the server's notion of the status ++ * of the mails in this folder. ++ */ ++ QList mUIDsOfLocallyChangedStatuses; ++ + /** +- Set to true by setStatus. Indicates that the client has changed +- the status of at least one mail. The mail flags will therefore be +- uploaded to the server, overwriting the server's notion of the status +- of the mails in this folder. +- */ ++ * Same as above, but uploads the flags of all mails, even if not all changed. ++ * Only still here for config compatibility. ++ */ + bool mStatusChangedLocally; + + /** diff --git a/kdepim.spec b/kdepim.spec index 021b5d5..1e08be7 100644 --- a/kdepim.spec +++ b/kdepim.spec @@ -6,7 +6,7 @@ Name: kdepim Summary: PIM (Personal Information Manager) applications Epoch: 6 Version: 4.2.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Group: Applications/Productivity @@ -14,6 +14,8 @@ URL: http://www.kde.org/ Source0: ftp://ftp.kde.org/pub/kde/stable/%{version}/src/%{name}-%{version}.tar.bz2 Patch0: kdepim-4.1.80-libqgpgme-link-fix.patch # upstream patches +Patch100: kdepim-4.2.1-imap.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Provides: kdepim4 = %{version}-%{release} @@ -92,6 +94,7 @@ Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} %patch0 -p1 -b .libqgpgme-link-fix # upstream patches +%patch100 -p0 -b .imap %build mkdir -p %{_target_platform} @@ -181,6 +184,9 @@ rm -rf %{buildroot} %changelog +* Wed Mar 04 2009 Than Ngo - 4.2.1-2 +- upstream patch, speed up folder syncing + * Fri Feb 27 2009 Than Ngo - 4.2.1-1 - 4.2.1