Documentation ¶
Index ¶
- func EnvelopeFromHeaders(headers Headers) *imap.Envelope
- func HeaderAddressList(value string) ([]*imap.Address, error)
- type ChangeStreamEvent
- type Headers
- type Mailbox
- type MailboxRepository
- func (repo *MailboxRepository) AllocateUid(name, owner string) (uint32, error)
- func (repo *MailboxRepository) AllocateUidById(mailboxId string) (uint32, error)
- func (repo *MailboxRepository) ChangeMailboxName(id, newName string) error
- func (i *MailboxRepository) CountUnseenMessages(id string) (int64, error)
- func (repo *MailboxRepository) CreateMailbox(name, owner string, access map[string]Permission) (*Mailbox, error)
- func (repo *MailboxRepository) DeleteMailbox(name, owner string) error
- func (repo *MailboxRepository) FindByNameAndOwner(name, owner string) (*Mailbox, error)
- func (repo *MailboxRepository) FindChildren(name, owner string) ([]Mailbox, error)
- func (i *MailboxRepository) FindFirstUnseenMessageUid(mailboxId string) (uint32, error)
- func (i *MailboxRepository) FindMailboxFlags(id string) (map[string]struct{}, error)
- func (repo *MailboxRepository) FindUserMailboxes(username string, subscribed bool) ([]Mailbox, error)
- func (repo *MailboxRepository) SetSubscriptionByUser(name, owner, user string, state bool) error
- type Message
- type MessageRepository
- func (repo *MessageRepository) AcquireRecentMessage(messageId string) (bool, error)
- func (repo *MessageRepository) AcquireRecents(mailboxId string) (map[uint32]struct{}, error)
- func (repo *MessageRepository) CopyMessage(mailboxSource string, uid uint32, mailboxTarget string, targetUid uint32) (uint32, error)
- func (repo *MessageRepository) CreateBodyWriter(mailboxId string, uid uint32) (io.WriteCloser, error)
- func (repo *MessageRepository) ExpungeMailbox(mailboxId string) (int64, error)
- func (repo *MessageRepository) FetchMessage(mailboxId string, uid uint32, seqNum uint32, items []imap.FetchItem) (*imap.Message, error)
- func (repo *MessageRepository) FetchUids(mailboxId string) ([]int, error)
- func (repo *MessageRepository) FindMessage(criteria *imap.SearchCriteria, uidList []uint32, mailboxId string) ([]uint32, error)
- func (repo *MessageRepository) Insert(message *Message) error
- func (repo *MessageRepository) UpdateFlags(uid bool, set *imap.SeqSet, op imap.FlagsOp, flags []string, uids []uint32, ...) (map[uint32][]string, error)
- func (repo *MessageRepository) WatchMailbox(ctx context.Context, mailboxId string) (<-chan ChangeStreamEvent, error)
- type MessageUpdateNamespace
- type OperationType
- type Permission
- type User
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnvelopeFromHeaders ¶
func EnvelopeFromHeaders(headers Headers) *imap.Envelope
The message document "caches" message headers that are not only needed for the envelope, but sometimes requested by mail clients on their own. See https://github.com/foxcpp/go-imap-sql/blob/9d2bcb71fca8a3b467b5ae7be92b91656fa0c1e3/sql_fetch.go#L16 for some popular headers. This function converts some of these headers into an envelope
func HeaderAddressList ¶
Types ¶
type ChangeStreamEvent ¶
type ChangeStreamEvent struct { Id bson.M `bson:"_id"` OperationType OperationType FullDocument *Message Ns MessageUpdateNamespace To *MessageUpdateNamespace DocumentKey struct { Id string `bson:"_id"` } UpdateDescription *struct { UpdatedFields bson.M RemovedFields []string } ClusterTime time.Time // contains filtered or unexported fields }
type MailboxRepository ¶
type MailboxRepository struct {
// contains filtered or unexported fields
}
func NewMailboxRepository ¶
func NewMailboxRepository(conn *mongodbConnection.Connection) (*MailboxRepository, error)
func (*MailboxRepository) AllocateUid ¶
func (repo *MailboxRepository) AllocateUid(name, owner string) (uint32, error)
func (*MailboxRepository) AllocateUidById ¶
func (repo *MailboxRepository) AllocateUidById(mailboxId string) (uint32, error)
func (*MailboxRepository) ChangeMailboxName ¶
func (repo *MailboxRepository) ChangeMailboxName(id, newName string) error
func (*MailboxRepository) CountUnseenMessages ¶
func (i *MailboxRepository) CountUnseenMessages(id string) (int64, error)
func (*MailboxRepository) CreateMailbox ¶
func (repo *MailboxRepository) CreateMailbox(name, owner string, access map[string]Permission) (*Mailbox, error)
func (*MailboxRepository) DeleteMailbox ¶
func (repo *MailboxRepository) DeleteMailbox(name, owner string) error
func (*MailboxRepository) FindByNameAndOwner ¶
func (repo *MailboxRepository) FindByNameAndOwner(name, owner string) (*Mailbox, error)
func (*MailboxRepository) FindChildren ¶
func (repo *MailboxRepository) FindChildren(name, owner string) ([]Mailbox, error)
Determines if the mailbox has any children, this causes different behavior when renaming or deleting
if an error is returned, the boolean return value can NOT be used
func (*MailboxRepository) FindFirstUnseenMessageUid ¶
func (i *MailboxRepository) FindFirstUnseenMessageUid(mailboxId string) (uint32, error)
func (*MailboxRepository) FindMailboxFlags ¶
func (i *MailboxRepository) FindMailboxFlags(id string) (map[string]struct{}, error)
func (*MailboxRepository) FindUserMailboxes ¶
func (repo *MailboxRepository) FindUserMailboxes(username string, subscribed bool) ([]Mailbox, error)
func (*MailboxRepository) SetSubscriptionByUser ¶
func (repo *MailboxRepository) SetSubscriptionByUser(name, owner, user string, state bool) error
type Message ¶
type MessageRepository ¶
type MessageRepository struct {
// contains filtered or unexported fields
}
func NewMessageRepository ¶
func NewMessageRepository(conn *mongodbConnection.Connection) (*MessageRepository, error)
func (*MessageRepository) AcquireRecentMessage ¶
func (repo *MessageRepository) AcquireRecentMessage(messageId string) (bool, error)
func (*MessageRepository) AcquireRecents ¶
func (repo *MessageRepository) AcquireRecents(mailboxId string) (map[uint32]struct{}, error)
func (*MessageRepository) CopyMessage ¶
func (*MessageRepository) CreateBodyWriter ¶
func (repo *MessageRepository) CreateBodyWriter(mailboxId string, uid uint32) (io.WriteCloser, error)
Creates a io.Writer that points to the gridfs bucket for messages
func (*MessageRepository) ExpungeMailbox ¶
func (repo *MessageRepository) ExpungeMailbox(mailboxId string) (int64, error)
func (*MessageRepository) FetchMessage ¶
func (repo *MessageRepository) FetchMessage(mailboxId string, uid uint32, seqNum uint32, items []imap.FetchItem) (*imap.Message, error)
func (*MessageRepository) FetchUids ¶
func (repo *MessageRepository) FetchUids(mailboxId string) ([]int, error)
func (*MessageRepository) FindMessage ¶
func (repo *MessageRepository) FindMessage(criteria *imap.SearchCriteria, uidList []uint32, mailboxId string) ([]uint32, error)
func (*MessageRepository) Insert ¶
func (repo *MessageRepository) Insert(message *Message) error
func (*MessageRepository) UpdateFlags ¶
func (*MessageRepository) WatchMailbox ¶
func (repo *MessageRepository) WatchMailbox(ctx context.Context, mailboxId string) (<-chan ChangeStreamEvent, error)
Opens a change stream for a mailbox
type MessageUpdateNamespace ¶
type OperationType ¶
type OperationType string
const ( OpInsert OperationType = "insert" OpDelete OperationType = "delete" )
type Permission ¶
type Permission string
const ( READONLY Permission = "r" READWRITE Permission = "rw" )
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func NewUserRepository ¶
func NewUserRepository(conn *mongodbConnection.Connection) (*UserRepository, error)
func (*UserRepository) FindUserByMail ¶
func (repo *UserRepository) FindUserByMail(mail string) (*User, error)
func (*UserRepository) FindUserByName ¶
func (repo *UserRepository) FindUserByName(name string) (*User, error)
func (*UserRepository) ProvisionUserFromUserInfo ¶
func (repo *UserRepository) ProvisionUserFromUserInfo(userInfo *ldap.UserInfo, mailboxRepo *MailboxRepository) (*User, error)
* Method that creates necessary documents for a ldap user if necessary. If the user already exists, bring existing data in line with ldap contents