about summary refs log tree commit diff stats
path: root/subx/020syscalls.cc
Commit message (Expand)AuthorAgeFilesLines
* 5188Kartik Agaram2019-05-181-3/+2
* 5157Kartik Agaram2019-05-111-9/+7
* 5155 - check for overflow in mmap segmentsKartik Agaram2019-05-111-0/+5
* 5151 - use mmap everywhere we need a heapKartik Agaram2019-05-101-8/+13
* 4987 - support `browse_trace` tool in SubXKartik Agaram2019-02-251-24/+24
* 4773 - done with crenshaw chapter 2-1Kartik Agaram2018-11-241-1/+0
* 4695Kartik Agaram2018-10-141-2/+2
* 4694Kartik Agaram2018-10-131-1/+1
* 4693Kartik Agaram2018-10-131-1/+1
* 4665Kartik Agaram2018-10-051-11/+11
* 4648Kartik Agaram2018-10-011-0/+1
* 4619 - new syscall: mmap()Kartik Agaram2018-09-291-0/+17
* 4614 - redo simulated RAMKartik Agaram2018-09-291-14/+1
* 4613Kartik Agaram2018-09-291-1/+1
* 4552Kartik Agaram2018-09-201-6/+13
* 4522Kartik Agaram2018-08-141-3/+3
* 4520 - several syscalls for filesKartik Agaram2018-08-131-0/+78
* 4469Kartik Agaram2018-08-031-0/+32
nstance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
package imap

import (
	"io"

	"git.sr.ht/~sircmpwn/aerc/worker/types"
)

func (imapw *IMAPWorker) handleCopyMessages(msg *types.CopyMessages) {
	uids := toSeqSet(msg.Uids)
	if err := imapw.client.UidCopy(uids, msg.Destination); err != nil {
		imapw.worker.PostMessage(&types.Error{
			Message: types.RespondTo(msg),
			Error:   err,
		}, nil)
	} else {
		imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil)
	}
}

type appendLiteral struct {
	io.Reader
	Length int
}

func (m appendLiteral) Len() int {
	return m.Length
}

func (imapw *IMAPWorker) handleAppendMessage(msg *types.AppendMessage) {
	if err := imapw.client.Append(msg.Destination, msg.Flags, msg.Date,
		&appendLiteral{
			Reader: msg.Reader,
			Length: msg.Length,
		}); err != nil {

		imapw.worker.PostMessage(&types.Error{
			Message: types.RespondTo(msg),
			Error:   err,
		}, nil)
	} else {
		imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil)
	}
}