mail

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	C_mail_max             = 200
	C_mail_days_attachment = 15
	C_mail_days_unread     = 7
	C_mail_days_read       = 2
)
View Source
const (
	C_gmail_max = 300
)

Variables

View Source
var (
	GMailBox = &gmail_box_t{}
)

Functions

func New

func New(toplr interface{}) *sendmail_t

Types

type IPlayer

type IPlayer interface {
	comp.IPlayer

	GetMailBox() *MailBox
	CheckGmailDeliverCond(cond string) bool
}

type Mail

type Mail struct {
	Id         int32             `bson:"id"`              // mail id
	Key        int32             `bson:"key"`             // mail key
	Sender     string            `bson:"sender"`          // sender
	Title      string            `bson:"title,omitempty"` // mail title (id | string)
	Text       string            `bson:"text,omitempty"`  // mail text  (id | string)
	Dict       map[string]string `bson:"dict,omitempty"`  // dict
	Attachment []*PB.MailRes     `bson:"a,omitempty"`     // attachment
	Read       bool              `bson:"read"`            // read flag
	Taken      bool              `bson:"taken"`           // taken flag
	Ts         int64             `bson:"ts"`              // create timestamp
	ExpireTs   int64             `bson:"ets"`             // expire timestamp
	Cond       string            `bson:",omitempty"`      // deliver condition for gmail
}

Mail struct

Title, Text support both id and string formats
id:     "n:123456"
string: "s:helloworld"

if no 'prefix' is found, it'll be treated as a plane-string

Deliver condition format:

  1. empty: no condition

  2. cond|cond|... satisfy all 'cond'

  3. any unrecognized 'cond' will block the delivery

    cond: var op val

    var: lv: player level cdate: player creation date ldate: player last login date

    op: <, <=, >, >=, ==, !=

    val: number string date: format -> 2017-1-1 3:4:5

func (*Mail) ToMsg

func (self *Mail) ToMsg() *PB.Mail

type MailBox

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

MailBox struct

seqid:   number
gmailid: number
mails:   {
	id: {
		contents
	}
}

func NewMailBox

func NewMailBox() *MailBox

func (*MailBox) GetAttachment

func (self *MailBox) GetAttachment(id int32) (ec PB.RetType, a []*PB.MailRes)

func (*MailBox) GetMails

func (self *MailBox) GetMails() map[int32]*Mail

func (*MailBox) Init

func (self *MailBox) Init(plr IPlayer)

func (*MailBox) Read

func (self *MailBox) Read(id int32) (ec PB.RetType, affected *Mail)

func (*MailBox) Remove

func (self *MailBox) Remove(id int32) PB.RetType

func (*MailBox) RemoveOnekey

func (self *MailBox) RemoveOnekey() (ids []int32)

func (*MailBox) SyncGMails

func (self *MailBox) SyncGMails()

func (*MailBox) TakeAttachment

func (self *MailBox) TakeAttachment(id int32) (ec PB.RetType, a []*PB.MailRes, affected *Mail)

func (*MailBox) TakeAttachmentAll

func (self *MailBox) TakeAttachmentAll() (ec PB.RetType, a []*PB.MailRes, affected []*Mail)

func (*MailBox) ToMsg

func (self *MailBox) ToMsg() (ret []*PB.Mail)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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