]> code.delx.au - offlineimap/commitdiff
TESTS PASS
authorJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 07:22:33 +0000 (02:22 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 07:22:33 +0000 (02:22 -0500)
Ready for code cleanup or work on recursive stuff

src/Data/Syncable.hs

index f583466c7bc372e54e919f8c7a69f3e1cbb18f2d..69841c44d58da1a6fb4340b0958140ee85d455bc 100644 (file)
@@ -140,7 +140,18 @@ diffCollection :: (Ord k, Show k, Eq v, Show v) =>
                -> [SyncCommand k v]
 diffCollection coll1 coll2 = 
     (map DeleteItem . findDeleted coll2 coll1 $ coll1) ++
-    (map (pairToFunc CopyItem) . findAdded coll2 coll1 $ coll1)
+    (map (pairToFunc CopyItem) . findAdded coll2 coll1 $ coll1) ++
+    modifiedData
+    where modifiedData = 
+              map (pairToFunc ModifyContent) .
+              Map.toList . 
+              Map.mapMaybe id .
+              Map.intersectionWith compareFunc coll1 $ coll2
+          compareFunc v1 v2
+              | v1 /= v2 = Just v2
+              | otherwise = Nothing
+              
+                         
     {-
     (map (pairToFunc ModifyContent) . Map.toList .
          findModified coll1 coll2 $ coll1)