mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-11 14:13:49 +02:00
feat:#49 switch to new branch for ical altrep
This commit is contained in:
@@ -33,10 +33,14 @@ func generateUserAgentSpecificDescription(vEvent *ics.VEvent, event model.Event,
|
||||
if isThunderbird(userAgent) && altrep != "" {
|
||||
// Thunderbird-specific handling: Add DESCRIPTION with ALTREP attribute.
|
||||
// create property altrep
|
||||
altrepParam := WithAltRep(altrep)
|
||||
//altrepParam := WithAltRep(altrep)
|
||||
|
||||
vEvent.AddProperty(ics.ComponentPropertyDescription, description, altrepParam)
|
||||
AddProperty(ics.ComponentPropertyDescription, description, altrepParam, vEvent)
|
||||
uri := &url.URL{
|
||||
Scheme: "data",
|
||||
Opaque: altrep,
|
||||
}
|
||||
|
||||
vEvent.AddProperty(ics.ComponentPropertyDescription, description, ics.WithAlternativeRepresentation(uri))
|
||||
} else {
|
||||
// Default handling: Add plain DESCRIPTION property for other user agents.
|
||||
vEvent.AddProperty("DESCRIPTION", description)
|
||||
@@ -44,23 +48,6 @@ func generateUserAgentSpecificDescription(vEvent *ics.VEvent, event model.Event,
|
||||
|
||||
}
|
||||
|
||||
func AddProperty(property ics.ComponentProperty, value string, prop ics.PropertyParameter, cb *ics.VEvent) {
|
||||
baseProperty := &ics.BaseProperty{
|
||||
IANAToken: string(property),
|
||||
Value: value,
|
||||
ICalParameters: map[string][]string{},
|
||||
}
|
||||
|
||||
customProperty := NewCustomProperty(*baseProperty)
|
||||
|
||||
r := ics.IANAProperty{
|
||||
BaseProperty: customProperty,
|
||||
}
|
||||
k, v := prop.KeyValue()
|
||||
r.ICalParameters[k] = v
|
||||
cb.Properties = append(cb.Properties, r)
|
||||
}
|
||||
|
||||
// Generates description based on the event details and user agent.
|
||||
func generateDescription(event model.Event, userAgent string) (string, string) {
|
||||
plainDescription := buildPlainTextDescription(event)
|
||||
@@ -68,7 +55,7 @@ func generateDescription(event model.Event, userAgent string) (string, string) {
|
||||
if isThunderbird(userAgent) {
|
||||
// Thunderbird-specific: Generate HTML and ALTREP format for Thunderbird users.
|
||||
htmlDescription := generateThunderbirdHTMLDescription(event)
|
||||
altrep := `"data:text/html,` + url.PathEscape(htmlDescription) + `"`
|
||||
altrep := `text/html,` + url.PathEscape(htmlDescription)
|
||||
return plainDescription, altrep
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user