From 4b546e7709c5c0ec709e7e987338a8124752ffc7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 May 2024 16:20:05 +0800 Subject: [PATCH] 1 --- server/mailserver/mail/mail.go | 26 ++++++++++++++++++++++++-- server/mailserver/mail/mailmgr.go | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/server/mailserver/mail/mail.go b/server/mailserver/mail/mail.go index fb29342d..29c69e9f 100644 --- a/server/mailserver/mail/mail.go +++ b/server/mailserver/mail/mail.go @@ -108,6 +108,24 @@ func (this *mail) fillMailDto(p *common.MailDto) bool { return true } +func (this* mail) isMailUser(accountId string) bool { + { + p := this.recipients + if p != nil { + if _, ok := p.Load(accountId); ok { + return true + } + } + } + { + this.traverseUserGroup( + func (groupId int64, group *userGroup) bool { + return true + }) + } + return false +} + func (this *mail) traverseRecipients(cb func(string) bool) { p := this.recipients if p != nil { @@ -117,11 +135,15 @@ func (this *mail) traverseRecipients(cb func(string) bool) { } } -func (this *mail) traverseUserGroup(cb func(int64) bool) { +func (this *mail) traverseUserGroup(cb func(int64, *userGroup) bool) { p := this.userGroups if p != nil { p.Range(func (k, v interface{}) bool { - return cb(k.(int64)) + if v != nil { + return cb(k.(int64), v.(*userGroup)) + } else { + return cb(k.(int64), nil) + } }) } } diff --git a/server/mailserver/mail/mailmgr.go b/server/mailserver/mail/mailmgr.go index 914e45da..76d9b0c6 100644 --- a/server/mailserver/mail/mailmgr.go +++ b/server/mailserver/mail/mailmgr.go @@ -234,7 +234,7 @@ func (this *mailMgr) addMail(m *mail) { this.wholeMails.Store(m.mailId, m) } else if m.isType(constant.MAIL_TYPE_GROUP) { m.traverseUserGroup( - func (int64) bool { + func (int64, *userGroup) bool { this.groupMails.Store(m.mailId, m) return false })