1
This commit is contained in:
parent
b85af87e19
commit
338f311cf4
@ -38,6 +38,7 @@ type Player interface {
|
|||||||
GetAttachment([]Mail) error
|
GetAttachment([]Mail) error
|
||||||
DeleteMails([]Mail) error
|
DeleteMails([]Mail) error
|
||||||
IsReadable(Mail) bool
|
IsReadable(Mail) bool
|
||||||
|
IsUnread(Mail) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type PlayerMgr interface {
|
type PlayerMgr interface {
|
||||||
|
@ -95,6 +95,11 @@ func (this *mail) fillMailDto(hum common.Player, p *common.MailDto) bool {
|
|||||||
p.Subject = this.subject
|
p.Subject = this.subject
|
||||||
p.Content = this.content
|
p.Content = this.content
|
||||||
//p.Flags
|
//p.Flags
|
||||||
|
if hum.IsUnread(this) {
|
||||||
|
p.Flags = 1 << 0
|
||||||
|
} else {
|
||||||
|
p.Flags = 0
|
||||||
|
}
|
||||||
p.SendTime = this.sendTime
|
p.SendTime = this.sendTime
|
||||||
p.ExpireTime = this.expireTime
|
p.ExpireTime = this.expireTime
|
||||||
p.MailType = this.mailType
|
p.MailType = this.mailType
|
||||||
|
@ -117,7 +117,7 @@ func (this *player) DeleteMails(mails []common.Mail) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *player) checkLock() {
|
func (this *player) checkLock() {
|
||||||
if !this.lock.TryLock() {
|
if this.lock.TryLock() {
|
||||||
panic("player checkLock error")
|
panic("player checkLock error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,19 @@ func (this *player) getInbox(mailId int64) *inbox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this* player) IsReadable(mail common.Mail) bool {
|
func (this* player) IsReadable(m common.Mail) bool {
|
||||||
|
mi := this.getInbox(m.GetMailId())
|
||||||
|
if mi != nil {
|
||||||
|
return mi.state != constant.INBOX_STATE_DELETED
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this* player) IsUnread(m common.Mail) bool {
|
||||||
|
mi := this.getInbox(m.GetMailId())
|
||||||
|
if mi != nil {
|
||||||
|
return mi.state != constant.INBOX_STATE_NONE
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user