aboutsummaryrefslogtreecommitdiff
path: root/internal/imap/folder.go
blob: 1f4e0bff281532a6f6434d7290ef620b4b079f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package imap

import "strings"

type Folder struct {
	str       string
	delimiter string
}

func (f Folder) String() string {
	return f.str
}

func (f Folder) Append(other Folder) Folder {
	if f.delimiter != other.delimiter {
		panic("Delimiters do not match")
	}
	return Folder{
		str:       f.str + f.delimiter + other.str,
		delimiter: f.delimiter,
	}
}

func (client *Client) folderName(path []string) Folder {
	return Folder{
		strings.Join(path, client.delimiter),
		client.delimiter,
	}
}

func (client *Client) NewFolder(path []string) Folder {
	return client.toplevel.Append(client.folderName(path))
}
lass='insertions'>+1 2017-02-12FixRené 'Necoro' Neumann1-1/+1 2016-07-08Constant -> KonstantRené 'Necoro' Neumann1-1/+1 2016-07-052to3 fixed too muchRené 'Necoro' Neumann1-1/+1 2016-07-052to3 conversionRené 'Necoro' Neumann12-42/+42 2016-07-05First batch of py3 changesRené 'Necoro' Neumann7-8/+7 2016-05-01Removed base 'Expense' class; introduce CategoryModel insteadRené 'Necoro' Neumann1-6/+7 2016-05-01Ignore .pyoRené 'Necoro' Neumann1-0/+1