~psic4t/qcard

ref: 85dd70da644380a0a96770d6379b4e4e480d2279 qcard/defines.go -rw-r--r-- 2.5 KiB
85dd70dapsic4t enable sorting by last name in configuration 4 months ago
                                                                                
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package main

import (
	"encoding/xml"
	"os"
	"time"
)

var err string
var homedir string = os.Getenv("HOME")
var editor string = os.Getenv("EDITOR")
var configLocation string = (homedir + "/" + ConfigDir + "/config.json")
var cacheLocation string = (homedir + "/" + CacheDir)
var versionLocation string = (cacheLocation + "/version.json")
var timezone, _ = time.Now().Zone()
var xmlContent []byte
var showDetails bool
var showFilename bool
var showEmailOnly *bool
var displayFlag bool
var toFile bool
var filter string
var searchterm string

//var colorBlock string = "█"
var colorBlock string = "|"
var contactsSlice []contactStruct
var Colors = [10]string{"\033[0;31m", "\033[0;32m", "\033[1;33m", "\033[1;34m", "\033[1;35m", "\033[1;36m", "\033[1;37m", "\033[1;38m", "\033[1;39m", "\033[1;40m"}
var showColor bool = true
var qcardversion string = "0.6.0"

const (
	ConfigDir  = ".config/qcard"
	CacheDir   = ".cache/qcard"
	IcsFormat  = "20060102T150405Z"
	ColWhite   = "\033[1;37m"
	ColDefault = "\033[0m"
	ColGreen   = "\033[0;32m"
	ColYellow  = "\033[1;33m"
	ColBlue    = "\033[1;34m"
)

type configStruct struct {
	Addressbooks []struct {
		Url      string
		Username string
		Password string
	}
	DetailThreshold int
	SortByLastname  bool
}

type contactStruct struct {
	Href         string
	Color        string
	fullName     string
	name         string
	title        string
	organisation string
	phoneCell    string
	phoneHome    string
	phoneWork    string
	emailHome    string
	emailWork    string
	addressHome  string
	addressWork  string
	birthday     string
	note         string
}

type xmlProps struct {
	calNo        string
	Url          string
	XMLName      xml.Name `xml:"multistatus"`
	Href         string   `xml:"response>href"`
	DisplayName  string   `xml:"response>propstat>prop>displayname"`
	Color        string   `xml:"response>propstat>prop>calendar-color"`
	CTag         string   `xml:"response>propstat>prop>getctag"`
	ETag         string   `xml:"response>propstat>prop>getetag"`
	LastModified string   `xml:"response>propstat>prop>getlastmodified"`
}

type calProps struct {
	calNo       int
	displayName string
	url         string
	color       string
}

type XmlDataStruct struct {
	XMLName  xml.Name          `xml:"multistatus"`
	Elements []xmlDataElements `xml:"response"`
}

type xmlDataElements struct {
	XMLName xml.Name `xml:"response"`
	Href    string   `xml:"href"`
	ETag    string   `xml:"propstat>prop>getetag"`
	Data    string   `xml:"propstat>prop>address-data"`
}