Skip to content

Commit 8aa9f02

Browse files
authored
fix sync token update (#1744)
1 parent bdb96f0 commit 8aa9f02

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

core/Services/CalDAV/CalDAVClient.vala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,16 @@ public class Services.CalDAV.CalDAVClient : Services.CalDAV.WebDAVClient {
370370
}
371371
}
372372
}
373-
374-
var sync_token = propstat.get_first_prop_with_tagname ("sync-token");
375-
if (sync_token != null) {
376-
project.sync_id = sync_token.text_content;
377-
project.update_local ();
378-
}
379373
}
380374
}
381375
}
382376
377+
var sync_token = multi_status.get_first_text_content_by_tag_name ("sync-token");
378+
if (sync_token != null && sync_token != project.sync_id) {
379+
project.sync_id = sync_token;
380+
project.update_local ();
381+
}
382+
383383
project.loading = false;
384384
}
385385

core/Services/CalDAV/WebDAVClient.vala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,17 @@ public class Services.CalDAV.WebDAVMultiStatus : Object {
143143
}
144144
return list;
145145
}
146+
147+
public string ? get_first_text_content_by_tag_name (string tag_name) {
148+
foreach (var h in root.get_elements_by_tag_name (tag_name)) {
149+
var text = h.text_content.strip ();
150+
if (text != null && text.length > 0) {
151+
return text;
152+
}
153+
}
154+
155+
return null;
156+
}
146157
}
147158

148159

0 commit comments

Comments
 (0)