Implementing the forgotten diff() function for DiffState
diff --git a/model/sync-diff-state.cc b/model/sync-diff-state.cc
index a804a8e..1c6a41c 100644
--- a/model/sync-diff-state.cc
+++ b/model/sync-diff-state.cc
@@ -43,7 +43,7 @@
 DiffState::diff () const
 {
   DiffStatePtr ret = make_shared<DiffState> ();
-
+  
   DiffStatePtr state = m_next;
   while (state != 0)
     {
@@ -57,6 +57,21 @@
 DiffState &
 DiffState::operator += (const DiffState &state)
 {
+  BOOST_FOREACH (LeafConstPtr _leaf, state.getLeaves ())
+    {
+      DiffLeafConstPtr leaf = dynamic_pointer_cast<const DiffLeaf> (_leaf);
+      BOOST_ASSERT (leaf != 0);
+
+      if (leaf->getOperation () == UPDATE)
+        update (leaf->getInfo (), leaf->getSeq ());
+      else if (leaf->getOperation () == REMOVE)
+        remove (leaf->getInfo ());
+      else
+        {
+          BOOST_ASSERT (false);
+        }
+    }
+  
   return *this;
 }
   
diff --git a/model/sync-logic.cc b/model/sync-logic.cc
index c4a8487..e39b86b 100644
--- a/model/sync-logic.cc
+++ b/model/sync-logic.cc
@@ -246,6 +246,10 @@
         }
 
       diffLog->setDigest(m_state.getDigest());
+      if (m_log.size () > 0)
+        {
+          m_log.get<sequenced> ().front ()->setNext (diffLog);
+        }
       m_log.insert (diffLog);
     }
   catch (Error::SyncXmlDecodingFailure &e)
@@ -256,15 +260,6 @@
 
   if (diffLog->getLeaves ().size () > 0)
     {
-      // notify upper layer
-      BOOST_FOREACH (LeafConstPtr leaf, diffLog->getLeaves ())
-        {
-          DiffLeafConstPtr diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
-          BOOST_ASSERT (diffLeaf != 0);
-          
-          // m_fetchCallback (prefix, 1, seq.getSeq());
-        }
-  
       sendSyncInterest();
     }
 }