get calandars and there names

This commit is contained in:
2026-07-27 22:01:10 -07:00
parent cdb79f75b5
commit 2e5814e46d
3 changed files with 36 additions and 4 deletions
+21 -2
View File
@@ -26,9 +26,13 @@ func init_dav_client() {
client = &http.Client{}
}
type Calandar struct {
DisplayName string
}
type SimpleCalDavData struct {
DisplayName string
Calandars []string
Calandars []Calandar
}
// this makes stalwart assumptions
@@ -60,8 +64,23 @@ func get_caldav_data(username string, password string) SimpleCalDavData {
log.Fatal(err)
}
fmt.Print(string(body))
calandars := []Calandar{}
for i := range len(davResp.Responses) {
if davResp.Responses[i].PropStat[0].Prop.Type.Calendar == nil {
continue
}
var new_cal Calandar = Calandar{
DisplayName: davResp.Responses[i].PropStat[0].Prop.DisplayName,
}
calandars = append(calandars, new_cal)
}
return SimpleCalDavData{
DisplayName: davResp.Responses[0].PropStat[0].Prop.DisplayName,
Calandars: []string{},
Calandars: calandars,
}
}