[tomboy] Update use of LatestSyncRevision/LastSyncRevision in WebSyncServer, UserInfo, and NoteInfo.



commit bb36f530330dec981c31cb5eac091d3862b01c60
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Mon May 18 06:55:56 2009 -0700

    Update use of LatestSyncRevision/LastSyncRevision in WebSyncServer, UserInfo, and NoteInfo.
---
 Tomboy/Addins/WebSyncService/Api/NoteInfo.cs  |    5 +++--
 Tomboy/Addins/WebSyncService/Api/UserInfo.cs  |    7 ++++++-
 Tomboy/Addins/WebSyncService/WebSyncServer.cs |    4 ++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Tomboy/Addins/WebSyncService/Api/NoteInfo.cs b/Tomboy/Addins/WebSyncService/Api/NoteInfo.cs
index a634a6e..a8a452a 100644
--- a/Tomboy/Addins/WebSyncService/Api/NoteInfo.cs
+++ b/Tomboy/Addins/WebSyncService/Api/NoteInfo.cs
@@ -125,8 +125,9 @@ namespace Tomboy.WebSync.Api
 				noteUpdateObj [CreateDateElementName] =
 					CreateDate.Value.ToString (NoteArchiver.DATE_TIME_FORMAT);
 
-			if (LastSyncRevision.HasValue)
-				noteUpdateObj [LastSyncRevisionElementName] = LastSyncRevision;
+			// TODO: Figure out what we do on client side for this
+//			if (LastSyncRevision.HasValue)
+//				noteUpdateObj [LastSyncRevisionElementName] = LastSyncRevision;
 			if (OpenOnStartup.HasValue)
 				noteUpdateObj [OpenOnStartupElementName] = OpenOnStartup;
 
diff --git a/Tomboy/Addins/WebSyncService/Api/UserInfo.cs b/Tomboy/Addins/WebSyncService/Api/UserInfo.cs
index 8bc9b0d..beaaa93 100644
--- a/Tomboy/Addins/WebSyncService/Api/UserInfo.cs
+++ b/Tomboy/Addins/WebSyncService/Api/UserInfo.cs
@@ -62,7 +62,12 @@ namespace Tomboy.WebSync.Api
 			UserInfo user = new UserInfo ();
 			user.FirstName = (string) jsonObj ["first-name"];
 			user.LastName = (string) jsonObj ["last-name"];
-			user.LatestSyncRevision = (int) jsonObj ["latest-sync-revision"];
+			
+			object latestSyncObj;
+			if (jsonObj.TryGetValue ("latest-sync-revision", out latestSyncObj))
+				user.LatestSyncRevision = (int) latestSyncObj;
+			else
+				user.LatestSyncRevision = -1;
 
 			Hyena.Json.JsonObject notesRefJsonObj =
 				(Hyena.Json.JsonObject) jsonObj ["notes-ref"];
diff --git a/Tomboy/Addins/WebSyncService/WebSyncServer.cs b/Tomboy/Addins/WebSyncService/WebSyncServer.cs
index ee1cbec..b330811 100644
--- a/Tomboy/Addins/WebSyncService/WebSyncServer.cs
+++ b/Tomboy/Addins/WebSyncService/WebSyncServer.cs
@@ -117,6 +117,10 @@ namespace Tomboy.WebSync
 		
 		public int LatestRevision {
 			get {
+				// TODO: Is this really the right way to do this?
+				//       If we just pushed and update, should trust
+				//       value returned from the PUT. Other client
+				//       may have pushed a new rev in intervening time!
 				RefreshUser ();	// TODO: Test that latest sync rev hasn't changed
 				return user.LatestSyncRevision.Value;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]