diff --git a/carddav/carddav.go b/carddav/carddav.go index 7f68fbe..ecd3900 100644 --- a/carddav/carddav.go +++ b/carddav/carddav.go @@ -9,9 +9,9 @@ import ( "sync" "time" - "github.com/emersion/hydroxide/protonmail" "github.com/emersion/go-vcard" "github.com/emersion/go-webdav/carddav" + "github.com/emersion/hydroxide/protonmail" ) type contextKey string @@ -62,7 +62,7 @@ func (fi *addressFileInfo) Sys() interface{} { } type addressObject struct { - c *protonmail.Client + c *protonmail.Client contact *protonmail.Contact } @@ -118,16 +118,16 @@ func (ao *addressObject) SetCard(card vcard.Card) error { } type addressBook struct { - c *protonmail.Client - cache map[string]*addressObject + c *protonmail.Client + cache map[string]*addressObject locker sync.Mutex - total int + total int } func (ab *addressBook) Info() (*carddav.AddressBookInfo, error) { return &carddav.AddressBookInfo{ - Name: "ProtonMail", - Description: "ProtonMail contacts", + Name: "ProtonMail", + Description: "ProtonMail contacts", MaxResourceSize: 100 * 1024, }, nil } @@ -177,7 +177,7 @@ func (ab *addressBook) ListAddressObjects() ([]carddav.AddressObject, error) { for _, contact := range contacts { if _, ok := ab.addressObject(contact.ID); !ok { ab.cacheAddressObject(&addressObject{ - c: ab.c, + c: ab.c, contact: contact, }) } @@ -200,7 +200,7 @@ func (ab *addressBook) ListAddressObjects() ([]carddav.AddressObject, error) { ao, ok := ab.addressObject(contact.ID) if !ok { ao = &addressObject{ - c: ab.c, + c: ab.c, contact: &protonmail.Contact{ID: contact.ID}, } ab.cacheAddressObject(ao) @@ -233,7 +233,7 @@ func (ab *addressBook) GetAddressObject(id string) (carddav.AddressObject, error } ao := &addressObject{ - c: ab.c, + c: ab.c, contact: contact, } ab.cacheAddressObject(ao) @@ -261,7 +261,7 @@ func (ab *addressBook) CreateAddressObject(card vcard.Card) (carddav.AddressObje contact.Cards = contactImport.Cards // Not returned by the server ao := &addressObject{ - c: ab.c, + c: ab.c, contact: contact, } ab.cacheAddressObject(ao) @@ -282,7 +282,7 @@ func (ab *addressBook) receiveEvents(events <-chan *protonmail.Event) { fallthrough case protonmail.EventUpdate: ab.cache[eventContact.ID] = &addressObject{ - c: ab.c, + c: ab.c, contact: eventContact.Contact, } case protonmail.EventDelete: @@ -297,7 +297,7 @@ func (ab *addressBook) receiveEvents(events <-chan *protonmail.Event) { func NewHandler(c *protonmail.Client, events <-chan *protonmail.Event) http.Handler { ab := &addressBook{ - c: c, + c: c, cache: make(map[string]*addressObject), total: -1, } diff --git a/cmd/hydroxide/hydroxide.go b/cmd/hydroxide/hydroxide.go index a073092..d6372d2 100644 --- a/cmd/hydroxide/hydroxide.go +++ b/cmd/hydroxide/hydroxide.go @@ -24,7 +24,7 @@ const authFile = "auth.json" type cachedAuth struct { protonmail.Auth - LoginPassword string + LoginPassword string MailboxPassword string // TODO: add padding } @@ -144,7 +144,7 @@ func receiveEvents(c *protonmail.Client, last string, ch chan<- *protonmail.Even } type session struct { - h http.Handler + h http.Handler hashedSecretKey []byte } @@ -236,7 +236,7 @@ func main() { sessions := make(map[string]*session) s := &http.Server{ - Addr: "127.0.0.1:"+port, + Addr: "127.0.0.1:" + port, Handler: http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { resp.Header().Set("WWW-Authenticate", "Basic") @@ -322,7 +322,7 @@ func main() { h = carddav.NewHandler(c, events) sessions[username] = &session{ - h: h, + h: h, hashedSecretKey: hashed, } } diff --git a/protonmail/adresses.go b/protonmail/adresses.go index 2910157..9d4e96c 100644 --- a/protonmail/adresses.go +++ b/protonmail/adresses.go @@ -1,21 +1,21 @@ package protonmail type ( - AddressSend int + AddressSend int AddressStatus int - AddressType int + AddressType int ) type Address struct { - ID string - DomainID string - Email string - Send AddressSend - Receive int - Status AddressStatus - Type AddressType + ID string + DomainID string + Email string + Send AddressSend + Receive int + Status AddressStatus + Type AddressType DisplayName string - Signature string // HTML - HasKeys int - Keys []*Key + Signature string // HTML + HasKeys int + Keys []*Key } diff --git a/protonmail/events.go b/protonmail/events.go index f5e9527..7585a8e 100644 --- a/protonmail/events.go +++ b/protonmail/events.go @@ -5,7 +5,7 @@ import ( ) type Event struct { - ID string `json:"EventID"` + ID string `json:"EventID"` Refresh int //Messages Contacts []*EventContact @@ -30,8 +30,8 @@ const ( ) type EventContact struct { - ID string - Action EventAction + ID string + Action EventAction Contact *Contact } diff --git a/protonmail/keys.go b/protonmail/keys.go index f900a44..670ac8e 100644 --- a/protonmail/keys.go +++ b/protonmail/keys.go @@ -1,10 +1,10 @@ package protonmail type Key struct { - ID string - Version int - PublicKey string - PrivateKey string + ID string + Version int + PublicKey string + PrivateKey string Fingerprint string - Activation interface{} // TODO + Activation interface{} // TODO } diff --git a/protonmail/users.go b/protonmail/users.go index ba3bc32..091764d 100644 --- a/protonmail/users.go +++ b/protonmail/users.go @@ -5,63 +5,63 @@ import ( ) type ( - LogAuth int - ComposerMode int + LogAuth int + ComposerMode int MessageButtons int - ImagesMode int - ViewMode int - ViewLayout int - SwipeAction int + ImagesMode int + ViewMode int + ViewLayout int + SwipeAction int ) type User struct { - ID string - Name string - NotificationEmail string - Signature string // HTML - NumMessagePerPage int - UsedSpace int - Notify int - AutoSaveContacts int - Language string // e.g. en_US - LogAuth LogAuth - ComposerMode ComposerMode - MessageButtons MessageButtons - Images ImagesMode - Moved int - ShowImages int - ShowEmbedded int - ViewMode ViewMode - ViewLayout ViewLayout - SwipeLeft SwipeAction - SwipeRight SwipeAction - Theme string - Currency string // e.g. EUR - Credit int - InvoiceText string - AlsoArchive int - Hotkeys int - PMSignature int - TwoFactor int - PasswordReset int - PasswordMode PasswordMode - News int - AutoResponder interface{} // TODO + ID string + Name string + NotificationEmail string + Signature string // HTML + NumMessagePerPage int + UsedSpace int + Notify int + AutoSaveContacts int + Language string // e.g. en_US + LogAuth LogAuth + ComposerMode ComposerMode + MessageButtons MessageButtons + Images ImagesMode + Moved int + ShowImages int + ShowEmbedded int + ViewMode ViewMode + ViewLayout ViewLayout + SwipeLeft SwipeAction + SwipeRight SwipeAction + Theme string + Currency string // e.g. EUR + Credit int + InvoiceText string + AlsoArchive int + Hotkeys int + PMSignature int + TwoFactor int + PasswordReset int + PasswordMode PasswordMode + News int + AutoResponder interface{} // TODO AutoWildcardSearch int - DraftMIMEType string - ReceiveMIMEType string - ImageProxy int - DisplayName string - MaxSpace int - MaxUpload int - Subscribed int // TODO - Services int // TODO - Role int // TODO - Private int - VPN interface{} // TODO - Delinquent int - Addresses []*Address - Keys []*Key + DraftMIMEType string + ReceiveMIMEType string + ImageProxy int + DisplayName string + MaxSpace int + MaxUpload int + Subscribed int // TODO + Services int // TODO + Role int // TODO + Private int + VPN interface{} // TODO + Delinquent int + Addresses []*Address + Keys []*Key } func (c *Client) GetCurrentUser() (*User, error) {