activesync

package
v0.0.0-...-547b272 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2018 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

* Omega is an advanced email service that supports Microsoft ActiveSync. * * Copyright (C) 2016, 2017 Kitae Kim <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseWBXMLRequest

func ParseWBXMLRequest(req *http.Request, dest interface{}) error

func RegisterFactory

func RegisterFactory(f Factory)

Types

type CertLoader

type CertLoader interface {
	GetCertificate(*tls.ClientHelloInfo) (*tls.Certificate, error)
}

type CommonSync

type CommonSync interface {
	UserUID() uint64
	DeviceID() string
	ClearSyncKeys() error
	// LoadSyncKey returns a history ID related with syncKey. It is necessary
	// to acquire a read or write lock depending on the lock mode for the
	// syncKey to prevent any concurrent updates from another transaction.
	LoadSyncKey(syncKey uint64, lock database.LockMode) (historyID uint64, err error)
	NewSyncKey(historyID uint64) (syncKey uint64, err error)
	// GetLastSyncKey returns the last issued sync key. It is necessary
	// to acquire a read or write lock depending on the lock mode for the
	// syncKey to prevent any concurrent updates from another transaction.
	GetLastSyncKey(lock database.LockMode) (syncKey uint64, ok bool, err error)
}

type Config

type Config struct {
	Port      uint16
	Cert      CertLoader
	AllowHTTP bool
	Param     Parameter
}

type Factory

type Factory interface {
	// Commands returns supported commands on this handler.
	Commands() []string
	New(Parameter) Handler
	// Version returns the version of this handler.
	Version() string
}

type FolderSync

type FolderSync interface {
	CommonSync
	ClearVirtualFolders() error
	AddVirtualFolder(folder backend.Folder, lastHistoryID uint64) error
	// GetVirtualFolder returns a virtual folder whose folder ID is folderID.
	// It is necessary to acquire a read or write lock depending on the lock
	// mode for the virtual folder to prevent any concurrent updates from
	// another transaction.
	GetVirtualFolder(folderID uint64, lock database.LockMode) (folder VirtualFolder, err error)
	UpdateVirtualFolder(folder backend.Folder) error
	RemoveVirtualFolder(folderID uint64) error
}

type Handler

type Handler interface {
	Handle(c backend.Credential, w http.ResponseWriter, req *http.Request)
}

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

func NewListener

func NewListener(conf Config) *Listener

func (*Listener) Run

func (r *Listener) Run(ctx context.Context) error

TODO: Use ctx for graceful shutdown, but how can we use it with http.ListenAndServeTLS?

type Mailer

type Mailer interface {
	Send(from string, to []string, msg []byte) error
}

type Parameter

type Parameter struct {
	Authenticator  backend.Authenticator
	ASStorage      Storage
	BackendStorage backend.Storage
	Transaction    database.TransactionManager
	Mailer         Mailer
}

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter is a buffered response writer.

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *ResponseWriter

func (*ResponseWriter) Clear

func (r *ResponseWriter) Clear()

func (*ResponseWriter) Flush

func (r *ResponseWriter) Flush() error

func (*ResponseWriter) SetWBXML

func (r *ResponseWriter) SetWBXML(v bool)

func (*ResponseWriter) Write

func (r *ResponseWriter) Write(v []byte)

func (*ResponseWriter) WriteHeader

func (r *ResponseWriter) WriteHeader(status int)

type Storage

type Storage interface {
	NewFolderSync(queryer database.Queryer, userUID uint64, deviceID string) FolderSync
	NewSync(queryer database.Queryer, userUID uint64, deviceID string, folderID uint64) Sync
}

NOTE: All methods of Storage should return database.TransactionError if an error occurrs.

type Sync

type Sync interface {
	CommonSync
	FolderID() uint64
	ClearVirtualEmails() error
	// GetOldestVirtualEmail returns the most oldest email in the virtual
	// folder. It is necessary to acquire a read or write lock depending on
	// the lock mode for the virtual email to prevent any concurrent updates
	// from another transaction.
	GetOldestVirtualEmail(lock database.LockMode) (email VirtualEmail, ok bool, err error)
	AddVirtualEmail(email *backend.Email, lastHistoryID uint64) error
	// GetOldVirtualEmails returns virtual emails whose timestamps are past
	// threshold. It is necessary to acquire a read or write lock depending
	// on the lock mode for the virtual emails to prevent any concurrent
	// updates from another transaction. limit is the maximum number of
	// virtual emails that can be returned. GetOldVirtualEmails can return
	// nil if there is no virtual emails we find.
	GetOldVirtualEmails(threshold time.Time, limit uint, lock database.LockMode) ([]VirtualEmail, error)
	// GetVirtualEmail returns a virtual email whose ID is emailID. It is
	// necessary to acquire a read or write lock depending on the lock mode
	// for the virtual email to prevent any concurrent updates from another
	// transaction.
	GetVirtualEmail(emailID uint64, lock database.LockMode) (email VirtualEmail, err error)
	UpdateVirtualEmailSeen(emailID uint64, seen bool) error
	RemoveVirtualEmail(emailID uint64) error
}

type VirtualEmail

type VirtualEmail struct {
	ID            uint64 // Email ID, not virtual one's ID.
	Seen          bool
	Timestamp     time.Time
	LastHistoryID uint64
}

type VirtualFolder

type VirtualFolder struct {
	ID            uint64
	Name          string
	ParentID      uint64
	LastHistoryID uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL