~psic4t/qcal

60590b9b590761be4b249d3e19b6b126e8267b85 — psic4t 2 months ago 101a6f3
support attendees in additional info
3 files changed, 22 insertions(+), 10 deletions(-)

M defines.go
M helpers.go
M parse.go
M defines.go => defines.go +1 -0
@@ 75,6 75,7 @@ type Event struct {
	Summary     string
	Description string
	Location    string
	Attendees   []string
}

type xmlProps struct {

M helpers.go => helpers.go +8 -2
@@ 150,11 150,17 @@ func (e Event) fancyOutput() {
	if showInfo {
		if e.Description != "" {
			fmt.Printf(`%15s`, ` `)
			fmt.Println(`Beschreibung: ` + e.Description)
			fmt.Println(`Description: ` + e.Description)
		}
		if e.Location != "" {
			fmt.Printf(`%15s`, ` `)
			fmt.Println("Ort: " + e.Location)
			fmt.Println("Location: " + e.Location)
		}
		if len(e.Attendees) != 0 {
			for i := range e.Attendees {
				fmt.Printf(`%15s`, ` `)
				fmt.Println("Attendee: " + e.Attendees[i])
			}
		}
	}
	if showFilename {

M parse.go => parse.go +13 -8
@@ 171,17 171,22 @@ func parseEventLocation(eventData *string) string {
	return trimField(result, "LOCATION:")
}

func parseEventAttendees(eventData *string) {
	re, _ := regexp.Compile(`ATTENDEE:.*?\n`)
	attendees := re.FindAllString(*eventData, -1)
func parseEventAttendees(eventData *string) []string {
	//re, _ := regexp.Compile(`ATTENDEE;.*?\n`)
	re, _ := regexp.Compile(`ATTENDEE;.+\"(.+?)\".*\n`)
	attendeesstring := re.FindAllString(*eventData, -1)
	var attendees []string

	for i := range attendees {
	for i := range attendeesstring {
		//fmt.Println(eventData)
		fmt.Println(i)
		fmt.Println(attendees[i])
		result := re.FindStringSubmatch(attendeesstring[i])
		attendees = append(attendees, result[1])

		//attendee := trimField(attendees[i], `ATTENDEE;.*\"`)
		//fmt.Println(result[1])
	}

	//	return trimField(result, "ATTENDEE:")
	return attendees
}

func parseEventRRule(eventData *string) string {


@@ 217,7 222,6 @@ func parseMain(eventData *string, elementsP *[]Event, href, color string) {
	eventEnd, tzId := parseEventEnd(eventData)
	eventDuration := parseEventDuration(eventData)
	freq := parseEventFreq(eventData)
	parseEventAttendees(eventData)

	if eventEnd.Before(eventStart) {
		eventEnd = eventStart.Add(eventDuration)


@@ 263,6 267,7 @@ func parseMain(eventData *string, elementsP *[]Event, href, color string) {
				Summary:     parseEventSummary(eventData),
				Description: parseEventDescription(eventData),
				Location:    parseEventLocation(eventData),
				Attendees:   parseEventAttendees(eventData),
			}
			*elementsP = append(*elementsP, data)