Skip to content

Commit

Permalink
imap邮件移动问题解决 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
midoks committed Sep 25, 2021
1 parent 8761f89 commit 3f546c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions internal/db/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ func MailPosContentForPop(uid int64, pos int64) (string, int, error) {
func MailSoftDeleteById(id int64, status int64) bool {

var result []Mail
sql := fmt.Sprintf("SELECT id FROM `%s` WHERE is_delete=1 and id='%d' order by id limit 10", MailTableName(), id)
sql := fmt.Sprintf("SELECT id FROM `%s` WHERE is_delete=1 and id='%d' order by id limit 1", MailTableName(), id)
ret := db.Raw(sql).Scan(&result)
if ret.Error == nil {
if len(result) > 0 {
if len(result) > 0 && status == 1 {
MailHardDeleteById(id)
return false
return true
}
}

Expand Down
2 changes: 0 additions & 2 deletions internal/imap/component/bodystructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ type BodyStructure struct {
}

func (bs *BodyStructure) Format() (fields []interface{}) {
// fmt.Println("format:", bs)
if strings.EqualFold(bs.MimeType, "multipart") {
for _, part := range bs.Parts {
fields = append(fields, part.Format())
Expand Down Expand Up @@ -251,7 +250,6 @@ func FormatParamList(params map[string]string) []interface{} {
fields = append(fields, key, value)
}

fmt.Println(fields)
return fields
}

Expand Down
6 changes: 4 additions & 2 deletions internal/imap/imap.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,24 @@ func (this *ImapServer) cmdUid(input string) bool {
if this.cmdCompare(inputN[1], CMD_UID) {

if this.cmdCompare(inputN[2], CMD_FETCH) {

if strings.Index(inputN[3], ":") > 0 {
se := strings.SplitN(inputN[3], ":", 2)
start, _ := strconv.ParseInt(se[0], 10, 64)
end, _ := strconv.ParseInt(se[1], 10, 64)
mailList, _ := db.BoxListByImap(this.userID, this.selectBox, start, end)
for i, m := range mailList {

c, _ := this.parseArgsConent(inputN[4], m)
this.writeArgs("* %d FETCH "+c, i+1)
this.writeArgs("* %d FETCH %s", i+1, c)
}
}

if libs.IsNumeric(inputN[3]) {
mid, _ := strconv.ParseInt(inputN[3], 10, 64)
mailList, _ := db.BoxListByMid(this.userID, this.selectBox, mid)
c, _ := this.parseArgsConent(inputN[4], mailList[0])
this.writeArgs("* %d FETCH "+c, mid)
this.writeArgs("* %d FETCH %s", mid, c)
}
} else if this.cmdCompare(inputN[2], CMD_SEARCH) {

Expand Down

0 comments on commit 3f546c1

Please sign in to comment.