~ubuntu-branches/ubuntu/lucid/tomboy/lucid-proposed

« back to all changes in this revision

Viewing changes to Tomboy/Addins/WebSyncService/WebSyncServer.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-02-09 00:30:16 UTC
  • mfrom: (1.3.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100209003016-0yytp54kcu2n6m67
Tags: 1.1.2-0ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
{
35
35
        public class WebSyncServer : SyncServer
36
36
        {
37
 
                private string serverUrl;
 
37
                private string rootUri;
38
38
                private IWebConnection connection;
39
39
 
40
40
                private RootInfo root;
43
43
                
44
44
                public WebSyncServer (string serverUrl, IWebConnection connection)
45
45
                {
46
 
                        this.serverUrl = serverUrl;
47
46
                        this.connection = connection;
 
47
                        rootUri = serverUrl + "/api/1.0/"; // TODO: Trim trailing / from serverUrl if necessary
48
48
                }
49
49
 
50
50
                #region SyncServer implementation
52
52
                public bool BeginSyncTransaction ()
53
53
                {
54
54
                        // TODO: Check connection and auth (is getting root/user resources a sufficient check?)
55
 
                        string rootUri = serverUrl + "/api/1.0/";
56
55
                        root = RootInfo.GetRoot (rootUri, connection);
57
56
                        user = UserInfo.GetUser (root.User.ApiRef, connection);
58
57
                        if (user.LatestSyncRevision.HasValue)
141
140
                        foreach (Note note in notes)
142
141
                                pendingCommits.Add (NoteConvert.ToNoteInfo (note));
143
142
                }
 
143
 
 
144
                public bool UpdatesAvailableSince (int revision)
 
145
                {
 
146
                        root = RootInfo.GetRoot (rootUri, connection);
 
147
                        user = UserInfo.GetUser (root.User.ApiRef, connection);
 
148
                        return user.LatestSyncRevision.HasValue &&
 
149
                                user.LatestSyncRevision.Value > revision;
 
150
                }
144
151
                
145
152
                #endregion
146
153