get calandars and there names
This commit is contained in:
+21
-2
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user